linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] Drivers: hv: vmbus: Fix initialization of device object in vmbus_device_register()
@ 2022-03-15 14:10 Andrea Parri (Microsoft)
  2022-03-15 16:46 ` Michael Kelley (LINUX)
  0 siblings, 1 reply; 3+ messages in thread
From: Andrea Parri (Microsoft) @ 2022-03-15 14:10 UTC (permalink / raw)
  To: KY Srinivasan, Haiyang Zhang, Stephen Hemminger, Wei Liu,
	Dexuan Cui, Tianyu Lan, Michael Kelley, Long Li
  Cc: linux-hyperv, linux-kernel, Andrea Parri (Microsoft)

Initialize the device's dma_{mask,parms} pointers and the device's
dma_mask value before invoking device_register().  Address the
following trace with 5.17-rc7:

[   49.646839] WARNING: CPU: 0 PID: 189 at include/linux/dma-mapping.h:543
	netvsc_probe+0x37a/0x3a0 [hv_netvsc]
[   49.646928] Call Trace:
[   49.646930]  <TASK>
[   49.646935]  vmbus_probe+0x40/0x60 [hv_vmbus]
[   49.646942]  really_probe+0x1ce/0x3b0
[   49.646948]  __driver_probe_device+0x109/0x180
[   49.646952]  driver_probe_device+0x23/0xa0
[   49.646955]  __device_attach_driver+0x76/0xe0
[   49.646958]  ? driver_allows_async_probing+0x50/0x50
[   49.646961]  bus_for_each_drv+0x84/0xd0
[   49.646964]  __device_attach+0xed/0x170
[   49.646967]  device_initial_probe+0x13/0x20
[   49.646970]  bus_probe_device+0x8f/0xa0
[   49.646973]  device_add+0x41a/0x8e0
[   49.646975]  ? hrtimer_init+0x28/0x80
[   49.646981]  device_register+0x1b/0x20
[   49.646983]  vmbus_device_register+0x5e/0xf0 [hv_vmbus]
[   49.646991]  vmbus_add_channel_work+0x12d/0x190 [hv_vmbus]
[   49.646999]  process_one_work+0x21d/0x3f0
[   49.647002]  worker_thread+0x4a/0x3b0
[   49.647005]  ? process_one_work+0x3f0/0x3f0
[   49.647007]  kthread+0xff/0x130
[   49.647011]  ? kthread_complete_and_exit+0x20/0x20
[   49.647015]  ret_from_fork+0x22/0x30
[   49.647020]  </TASK>
[   49.647021] ---[ end trace 0000000000000000 ]---

Fixes: 743b237c3a7b0 ("scsi: storvsc: Add Isolation VM support for storvsc driver")
Signed-off-by: Andrea Parri (Microsoft) <parri.andrea@gmail.com>
---
Changes since v1[1]:
  - Move dma_set_mask() as well (Michael)

[1] https://lkml.kernel.org/r/20220311133738.38649-1-parri.andrea@gmail.com

 drivers/hv/vmbus_drv.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index 12a2b37e87f30..0a05e10ab36c7 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -2097,6 +2097,10 @@ int vmbus_device_register(struct hv_device *child_device_obj)
 	child_device_obj->device.parent = &hv_acpi_dev->dev;
 	child_device_obj->device.release = vmbus_device_release;
 
+	child_device_obj->device.dma_parms = &child_device_obj->dma_parms;
+	child_device_obj->device.dma_mask = &child_device_obj->dma_mask;
+	dma_set_mask(&child_device_obj->device, DMA_BIT_MASK(64));
+
 	/*
 	 * Register with the LDM. This will kick off the driver/device
 	 * binding...which will eventually call vmbus_match() and vmbus_probe()
@@ -2122,9 +2126,6 @@ int vmbus_device_register(struct hv_device *child_device_obj)
 	}
 	hv_debug_add_dev_dir(child_device_obj);
 
-	child_device_obj->device.dma_parms = &child_device_obj->dma_parms;
-	child_device_obj->device.dma_mask = &child_device_obj->dma_mask;
-	dma_set_mask(&child_device_obj->device, DMA_BIT_MASK(64));
 	return 0;
 
 err_kset_unregister:
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [PATCH v2] Drivers: hv: vmbus: Fix initialization of device object in vmbus_device_register()
  2022-03-15 14:10 [PATCH v2] Drivers: hv: vmbus: Fix initialization of device object in vmbus_device_register() Andrea Parri (Microsoft)
@ 2022-03-15 16:46 ` Michael Kelley (LINUX)
  2022-03-29 12:03   ` Wei Liu
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Kelley (LINUX) @ 2022-03-15 16:46 UTC (permalink / raw)
  To: Andrea Parri (Microsoft),
	KY Srinivasan, Haiyang Zhang, Stephen Hemminger, Wei Liu,
	Dexuan Cui, Tianyu Lan, Long Li
  Cc: linux-hyperv, linux-kernel

From: Andrea Parri (Microsoft) <parri.andrea@gmail.com> Sent: Tuesday, March 15, 2022 7:11 AM
> 
> Initialize the device's dma_{mask,parms} pointers and the device's
> dma_mask value before invoking device_register().  Address the
> following trace with 5.17-rc7:
> 
> [   49.646839] WARNING: CPU: 0 PID: 189 at include/linux/dma-mapping.h:543
> 	netvsc_probe+0x37a/0x3a0 [hv_netvsc]
> [   49.646928] Call Trace:
> [   49.646930]  <TASK>
> [   49.646935]  vmbus_probe+0x40/0x60 [hv_vmbus]
> [   49.646942]  really_probe+0x1ce/0x3b0
> [   49.646948]  __driver_probe_device+0x109/0x180
> [   49.646952]  driver_probe_device+0x23/0xa0
> [   49.646955]  __device_attach_driver+0x76/0xe0
> [   49.646958]  ? driver_allows_async_probing+0x50/0x50
> [   49.646961]  bus_for_each_drv+0x84/0xd0
> [   49.646964]  __device_attach+0xed/0x170
> [   49.646967]  device_initial_probe+0x13/0x20
> [   49.646970]  bus_probe_device+0x8f/0xa0
> [   49.646973]  device_add+0x41a/0x8e0
> [   49.646975]  ? hrtimer_init+0x28/0x80
> [   49.646981]  device_register+0x1b/0x20
> [   49.646983]  vmbus_device_register+0x5e/0xf0 [hv_vmbus]
> [   49.646991]  vmbus_add_channel_work+0x12d/0x190 [hv_vmbus]
> [   49.646999]  process_one_work+0x21d/0x3f0
> [   49.647002]  worker_thread+0x4a/0x3b0
> [   49.647005]  ? process_one_work+0x3f0/0x3f0
> [   49.647007]  kthread+0xff/0x130
> [   49.647011]  ? kthread_complete_and_exit+0x20/0x20
> [   49.647015]  ret_from_fork+0x22/0x30
> [   49.647020]  </TASK>
> [   49.647021] ---[ end trace 0000000000000000 ]---
> 
> Fixes: 743b237c3a7b0 ("scsi: storvsc: Add Isolation VM support for storvsc driver")
> Signed-off-by: Andrea Parri (Microsoft) <parri.andrea@gmail.com>
> ---
> Changes since v1[1]:
>   - Move dma_set_mask() as well (Michael)
> 
> [1] https://lore.kernel.org/all/20220311133738.38649-1-parri.andrea@gmail.com/T/#u
> 
>  drivers/hv/vmbus_drv.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
> index 12a2b37e87f30..0a05e10ab36c7 100644
> --- a/drivers/hv/vmbus_drv.c
> +++ b/drivers/hv/vmbus_drv.c
> @@ -2097,6 +2097,10 @@ int vmbus_device_register(struct hv_device
> *child_device_obj)
>  	child_device_obj->device.parent = &hv_acpi_dev->dev;
>  	child_device_obj->device.release = vmbus_device_release;
> 
> +	child_device_obj->device.dma_parms = &child_device_obj->dma_parms;
> +	child_device_obj->device.dma_mask = &child_device_obj->dma_mask;
> +	dma_set_mask(&child_device_obj->device, DMA_BIT_MASK(64));
> +
>  	/*
>  	 * Register with the LDM. This will kick off the driver/device
>  	 * binding...which will eventually call vmbus_match() and vmbus_probe()
> @@ -2122,9 +2126,6 @@ int vmbus_device_register(struct hv_device
> *child_device_obj)
>  	}
>  	hv_debug_add_dev_dir(child_device_obj);
> 
> -	child_device_obj->device.dma_parms = &child_device_obj->dma_parms;
> -	child_device_obj->device.dma_mask = &child_device_obj->dma_mask;
> -	dma_set_mask(&child_device_obj->device, DMA_BIT_MASK(64));
>  	return 0;
> 
>  err_kset_unregister:
> --
> 2.25.1

Reviewed-by: Michael Kelley <mikelley@microsoft.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] Drivers: hv: vmbus: Fix initialization of device object in vmbus_device_register()
  2022-03-15 16:46 ` Michael Kelley (LINUX)
@ 2022-03-29 12:03   ` Wei Liu
  0 siblings, 0 replies; 3+ messages in thread
From: Wei Liu @ 2022-03-29 12:03 UTC (permalink / raw)
  To: Michael Kelley (LINUX)
  Cc: Andrea Parri (Microsoft),
	KY Srinivasan, Haiyang Zhang, Stephen Hemminger, Wei Liu,
	Dexuan Cui, Tianyu Lan, Long Li, linux-hyperv, linux-kernel

On Tue, Mar 15, 2022 at 04:46:34PM +0000, Michael Kelley (LINUX) wrote:
> From: Andrea Parri (Microsoft) <parri.andrea@gmail.com> Sent: Tuesday, March 15, 2022 7:11 AM
[...]
> 
> Reviewed-by: Michael Kelley <mikelley@microsoft.com>
> 

Applied to hyperv-fixes. Thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-03-29 12:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-15 14:10 [PATCH v2] Drivers: hv: vmbus: Fix initialization of device object in vmbus_device_register() Andrea Parri (Microsoft)
2022-03-15 16:46 ` Michael Kelley (LINUX)
2022-03-29 12:03   ` Wei Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).