Drivers: hv: vmbus: make bus ids in sysfs persistent
v2 cover Drivers: hv: vmbus: make bus ids in sysfs persistent
Bus ids for VMBus devices in /sys/bus/vmbus/devices/ are not guaranteed to be persistent across reboot or kernel restart and this causes problems for some tools. E.g. kexec tools use these ids to identify NIC on kdump. Fix the issue by using if_instance from channel offer as the unique id instead of an auto incremented counter.
Changes since v1:
- Use if_instance instead of relid [K. Y. Srinivasan]
Vitaly Kuznetsov (2):
Drivers: hv: make VMBus bus ids persistent
Drivers: hv: get rid of id in struct vmbus_channel
drivers/hv/channel_mgmt.c | 2 -- drivers/hv/vmbus_drv.c | 4 ++-- include/linux/hyperv.h | 3 --- 3 files changed, 2 insertions(+), 7 deletions(-)
Signature · 1 line
2.7.4
PATCH v2 1/2 Drivers: hv: make VMBus bus ids persistent
Some tools use bus ids to identify devices and they count on the fact that these ids are persistent across reboot. This may be not true for VMBus as we use auto incremented counter from alloc_channel() as such id. Switch to using if_instance from channel offer, this id is supposed to be persistent.
--- drivers/hv/vmbus_drv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/hv/vmbus_drv.c +2 -2
@@ -961,8 +961,8 @@ int vmbus_device_register(struct hv_device *child_device_obj) {int ret =0 ; -dev_set_name (&child_device_obj->device,"vmbus_%d" , - child_device_obj->channel->id); +dev_set_name (&child_device_obj->device,"vmbus-%pUl" , + child_device_obj->channel->offermsg.offer.if_instance.b); child_device_obj->device.bus = &hv_bus; child_device_obj->device.parent = &hv_acpi_dev->dev;
Signature · 1 line
2.7.4
PATCH v2 2/2 Drivers: hv: get rid of id in struct vmbus_channel
In reply to Vitaly KuznetsovThe auto incremented counter is not being used anymore, get rid of it.
--- drivers/hv/channel_mgmt.c | 2 -- include/linux/hyperv.h | 3 --- 2 files changed, 5 deletions(-)
drivers/hv/channel_mgmt.c +0 -2
@@ -251,14 +251,12 @@ EXPORT_SYMBOL_GPL(vmbus_prep_negotiate_resp);*/ static struct vmbus_channel *alloc_channel (void ) { -static atomic_t chan_num =ATOMIC_INIT (0 );struct vmbus_channel *channel; channel =kzalloc (sizeof (*channel),GFP_ATOMIC );if (!channel)return NULL ; - channel->id =atomic_inc_return (&chan_num); channel->acquire_ring_lock = true;spin_lock_init (&channel->inbound_lock);spin_lock_init (&channel->lock);
include/linux/hyperv.h +0 -3
@@ -701,9 +701,6 @@ struct vmbus_device { };struct vmbus_channel { -/* Unique channel id */ -int id; -struct list_head listentry;struct hv_device *device_obj;
Signature · 1 line
2.7.4
Quoted 6 lines · Vitaly Kuznetsov
Bus ids for VMBus devices in
/sys/bus/vmbus/devices/are not guaranteed to be persistent across reboot or kernel restart and this causes problems for some tools. E.g. kexec tools use these ids to identify NIC on kdump. Fix the issue by usingif_instancefrom channel offer as the unique id instead of an auto incremented counter.
Quoted 7 lines
Changes since v1:
- Useif_instanceinstead of relid [K. Y. Srinivasan]Vitaly Kuznetsov (2):
Drivers: hv: make VMBus bus ids persistent
Drivers: hv: get rid of id in structvmbus_channel
K. Y.,
I don't see these patches in your submissions to Greg. Could you please pick them up (in case there are no issues with them in your opinion, of course).
Thanks!
Quoted 4 lines
drivers/hv/channel_mgmt.c | 2 -- drivers/hv/vmbus_drv.c | 4 ++-- include/linux/hyperv.h | 3 --- 3 files changed, 2 insertions(+), 7 deletions(-)
Signature · 1 line
Vitaly
Quoted 27 lines
-----Original Message-----
From: Vitaly Kuznetsov [mailto:[email protected]]
Sent: Friday, September 16, 2016 4:53 PM
To: KY Srinivasan <[email protected]>
Cc: [email protected]; [email protected]; Haiyang Zhang <[email protected]>
Subject: Re: [PATCH v2 0/2] Drivers: hv: vmbus: make bus ids in sysfs persistentQuoted 6 lines · Vitaly Kuznetsov
Bus ids for VMBus devices in
/sys/bus/vmbus/devices/are not guaranteed to be persistent across reboot or kernel restart and this causes problems for some tools. E.g. kexec tools use these ids to identify NIC on kdump. Fix the issue by usingif_instancefrom channel offer as the unique id instead of an auto incremented counter.Quoted 7 lines
Changes since v1:
- Useif_instanceinstead of relid [K. Y. Srinivasan]Vitaly Kuznetsov (2):
Drivers: hv: make VMBus bus ids persistent
Drivers: hv: get rid of id in structvmbus_channel
Quoted 7 lines
K. Y.,
I don't see these patches in your submissions to Greg. Could you please pick them up (in case there are no issues with them in your opinion, of course).
Thanks!
Sorry about that; patches sent out.
K. Y
Quoted 8 lines
Quoted 5 lines
drivers/hv/channel_mgmt.c | 2 -- drivers/hv/vmbus_drv.c | 4 ++-- include/linux/hyperv.h | 3 --- 3 files changed, 2 insertions(+), 7 deletions(-)--
Vitaly