linux-hyperv.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Drivers: hv: vmbus: Don't wait for the ACPI device upon initialization
@ 2022-09-21 18:39 Stanislav Kinsburskii
  2022-09-22 17:19 ` Wei Liu
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Stanislav Kinsburskii @ 2022-09-21 18:39 UTC (permalink / raw)
  To: skinsburskii
  Cc: Stanislav Kinsburskiy, K. Y. Srinivasan, Haiyang Zhang,
	Stephen Hemminger, Wei Liu, Dexuan Cui, linux-hyperv,
	linux-kernel

From: Stanislav Kinsburskiy <stanislav.kinsburskiy@gmail.com>

Waiting to 5 seconds in case of missing VMBUS ACPI device is redundant as the
device is either present already or won't be available at all.
This patch enforces synchronous probing to make sure the bus traversal,
happening upon driver registering will either find the device (if present) or
not spend any additional time if device is absent.

Signed-off-by: Stanislav Kinsburskiy <stanislav.kinsburskiy@gmail.com>
CC: "K. Y. Srinivasan" <kys@microsoft.com>
CC: Haiyang Zhang <haiyangz@microsoft.com>
CC: Stephen Hemminger <sthemmin@microsoft.com>
CC: Wei Liu <wei.liu@kernel.org>
CC: Dexuan Cui <decui@microsoft.com>
CC: linux-hyperv@vger.kernel.org
CC: linux-kernel@vger.kernel.org
---
 drivers/hv/vmbus_drv.c |   13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index 7b9f3fc3adf7..32d0009631a6 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -46,8 +46,6 @@ struct vmbus_dynid {
 
 static struct acpi_device  *hv_acpi_dev;
 
-static struct completion probe_event;
-
 static int hyperv_cpuhp_online;
 
 static void *hv_panic_page;
@@ -2468,7 +2466,6 @@ static int vmbus_acpi_add(struct acpi_device *device)
 	ret_val = 0;
 
 acpi_walk_err:
-	complete(&probe_event);
 	if (ret_val)
 		vmbus_acpi_remove(device);
 	return ret_val;
@@ -2647,6 +2644,7 @@ static struct acpi_driver vmbus_acpi_driver = {
 		.remove = vmbus_acpi_remove,
 	},
 	.drv.pm = &vmbus_bus_pm,
+	.drv.probe_type = PROBE_FORCE_SYNCHRONOUS,
 };
 
 static void hv_kexec_handler(void)
@@ -2719,7 +2717,7 @@ static struct syscore_ops hv_synic_syscore_ops = {
 
 static int __init hv_acpi_init(void)
 {
-	int ret, t;
+	int ret;
 
 	if (!hv_is_hyperv_initialized())
 		return -ENODEV;
@@ -2727,8 +2725,6 @@ static int __init hv_acpi_init(void)
 	if (hv_root_partition)
 		return 0;
 
-	init_completion(&probe_event);
-
 	/*
 	 * Get ACPI resources first.
 	 */
@@ -2737,9 +2733,8 @@ static int __init hv_acpi_init(void)
 	if (ret)
 		return ret;
 
-	t = wait_for_completion_timeout(&probe_event, 5*HZ);
-	if (t == 0) {
-		ret = -ETIMEDOUT;
+	if (!hv_acpi_dev) {
+		ret = -ENODEV;
 		goto cleanup;
 	}
 



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

* Re: [PATCH] Drivers: hv: vmbus: Don't wait for the ACPI device upon initialization
  2022-09-21 18:39 [PATCH] Drivers: hv: vmbus: Don't wait for the ACPI device upon initialization Stanislav Kinsburskii
@ 2022-09-22 17:19 ` Wei Liu
  2022-09-22 20:07   ` Dexuan Cui
  2022-09-22 21:59 ` Michael Kelley (LINUX)
  2022-09-23 10:39 ` Wei Liu
  2 siblings, 1 reply; 5+ messages in thread
From: Wei Liu @ 2022-09-22 17:19 UTC (permalink / raw)
  To: Stanislav Kinsburskii
  Cc: skinsburskii, Stanislav Kinsburskiy, K. Y. Srinivasan,
	Haiyang Zhang, Stephen Hemminger, Wei Liu, Dexuan Cui,
	linux-hyperv, linux-kernel, Michael Kelley

On Wed, Sep 21, 2022 at 06:39:05PM +0000, Stanislav Kinsburskii wrote:
> From: Stanislav Kinsburskiy <stanislav.kinsburskiy@gmail.com>
> 
> Waiting to 5 seconds in case of missing VMBUS ACPI device is redundant as the
> device is either present already or won't be available at all.
> This patch enforces synchronous probing to make sure the bus traversal,
> happening upon driver registering will either find the device (if present) or
> not spend any additional time if device is absent.
> 
> Signed-off-by: Stanislav Kinsburskiy <stanislav.kinsburskiy@gmail.com>
> CC: "K. Y. Srinivasan" <kys@microsoft.com>
> CC: Haiyang Zhang <haiyangz@microsoft.com>
> CC: Stephen Hemminger <sthemmin@microsoft.com>
> CC: Wei Liu <wei.liu@kernel.org>
> CC: Dexuan Cui <decui@microsoft.com>
> CC: linux-hyperv@vger.kernel.org
> CC: linux-kernel@vger.kernel.org

Looks good to me. I will wait for a few days for others to chime in.

CC Michael.

> ---
>  drivers/hv/vmbus_drv.c |   13 ++++---------
>  1 file changed, 4 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
> index 7b9f3fc3adf7..32d0009631a6 100644
> --- a/drivers/hv/vmbus_drv.c
> +++ b/drivers/hv/vmbus_drv.c
> @@ -46,8 +46,6 @@ struct vmbus_dynid {
>  
>  static struct acpi_device  *hv_acpi_dev;
>  
> -static struct completion probe_event;
> -
>  static int hyperv_cpuhp_online;
>  
>  static void *hv_panic_page;
> @@ -2468,7 +2466,6 @@ static int vmbus_acpi_add(struct acpi_device *device)
>  	ret_val = 0;
>  
>  acpi_walk_err:
> -	complete(&probe_event);
>  	if (ret_val)
>  		vmbus_acpi_remove(device);
>  	return ret_val;
> @@ -2647,6 +2644,7 @@ static struct acpi_driver vmbus_acpi_driver = {
>  		.remove = vmbus_acpi_remove,
>  	},
>  	.drv.pm = &vmbus_bus_pm,
> +	.drv.probe_type = PROBE_FORCE_SYNCHRONOUS,
>  };
>  
>  static void hv_kexec_handler(void)
> @@ -2719,7 +2717,7 @@ static struct syscore_ops hv_synic_syscore_ops = {
>  
>  static int __init hv_acpi_init(void)
>  {
> -	int ret, t;
> +	int ret;
>  
>  	if (!hv_is_hyperv_initialized())
>  		return -ENODEV;
> @@ -2727,8 +2725,6 @@ static int __init hv_acpi_init(void)
>  	if (hv_root_partition)
>  		return 0;
>  
> -	init_completion(&probe_event);
> -
>  	/*
>  	 * Get ACPI resources first.
>  	 */
> @@ -2737,9 +2733,8 @@ static int __init hv_acpi_init(void)
>  	if (ret)
>  		return ret;
>  
> -	t = wait_for_completion_timeout(&probe_event, 5*HZ);
> -	if (t == 0) {
> -		ret = -ETIMEDOUT;
> +	if (!hv_acpi_dev) {
> +		ret = -ENODEV;
>  		goto cleanup;
>  	}
>  
> 
> 

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

* RE: [PATCH] Drivers: hv: vmbus: Don't wait for the ACPI device upon initialization
  2022-09-22 17:19 ` Wei Liu
@ 2022-09-22 20:07   ` Dexuan Cui
  0 siblings, 0 replies; 5+ messages in thread
From: Dexuan Cui @ 2022-09-22 20:07 UTC (permalink / raw)
  To: Wei Liu, Stanislav Kinsburskii
  Cc: Stanislav Kinsburskii, Stanislav Kinsburskiy, KY Srinivasan,
	Haiyang Zhang, Stephen Hemminger, linux-hyperv, linux-kernel,
	Michael Kelley (LINUX)

> From: Wei Liu <wei.liu@kernel.org>
> Sent: Thursday, September 22, 2022 10:20 AM
> ...
> On Wed, Sep 21, 2022 at 06:39:05PM +0000, Stanislav Kinsburskii wrote:
> > From: Stanislav Kinsburskiy <stanislav.kinsburskiy@gmail.com>
> >
> > Waiting to 5 seconds in case of missing VMBUS ACPI device is redundant as
> the
> > device is either present already or won't be available at all.
> > This patch enforces synchronous probing to make sure the bus traversal,
> > happening upon driver registering will either find the device (if present) or
> > not spend any additional time if device is absent.
> >
> > Signed-off-by: Stanislav Kinsburskiy <stanislav.kinsburskiy@gmail.com>
> > CC: "K. Y. Srinivasan" <kys@microsoft.com>
> > CC: Haiyang Zhang <haiyangz@microsoft.com>
> > CC: Stephen Hemminger <sthemmin@microsoft.com>
> > CC: Wei Liu <wei.liu@kernel.org>
> > CC: Dexuan Cui <decui@microsoft.com>
> > CC: linux-hyperv@vger.kernel.org
> > CC: linux-kernel@vger.kernel.org
> 
> Looks good to me. I will wait for a few days for others to chime in.
> 
> CC Michael.

Looks good to me.

Reviewed-by: Dexuan Cui <decui@microsoft.com>


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

* RE: [PATCH] Drivers: hv: vmbus: Don't wait for the ACPI device upon initialization
  2022-09-21 18:39 [PATCH] Drivers: hv: vmbus: Don't wait for the ACPI device upon initialization Stanislav Kinsburskii
  2022-09-22 17:19 ` Wei Liu
@ 2022-09-22 21:59 ` Michael Kelley (LINUX)
  2022-09-23 10:39 ` Wei Liu
  2 siblings, 0 replies; 5+ messages in thread
From: Michael Kelley (LINUX) @ 2022-09-22 21:59 UTC (permalink / raw)
  To: Stanislav Kinsburskii, Stanislav Kinsburskii
  Cc: Stanislav Kinsburskiy, KY Srinivasan, Haiyang Zhang,
	Stephen Hemminger, Wei Liu, Dexuan Cui, linux-hyperv,
	linux-kernel

From: Stanislav Kinsburskii <skinsburskii@linux.microsoft.com> Sent: Wednesday, September 21, 2022 11:39 AM
> 
> Waiting to 5 seconds in case of missing VMBUS ACPI device is redundant as the

A nit:  We've been all over the map on the capitalization of "VMBus".  Somebody
outside of Microsoft recently did a census in the Linux code and commits, and
"VMbus" is the most popular, closely followed by "VMBus".  The preferred approach
in Microsoft public documentation is "VMBus", so that's what we should try to 
use going forward.  Not "VMBUS" and not "vmbus", though the latter is fine in
variable and function names.

> device is either present already or won't be available at all.
> This patch enforces synchronous probing to make sure the bus traversal,
> happening upon driver registering will either find the device (if present) or
> not spend any additional time if device is absent.
> 
> Signed-off-by: Stanislav Kinsburskiy <stanislav.kinsburskiy@gmail.com>
> CC: "K. Y. Srinivasan" <kys@microsoft.com>
> CC: Haiyang Zhang <haiyangz@microsoft.com>
> CC: Stephen Hemminger <sthemmin@microsoft.com>
> CC: Wei Liu <wei.liu@kernel.org>
> CC: Dexuan Cui <decui@microsoft.com>
> CC: linux-hyperv@vger.kernel.org
> CC: linux-kernel@vger.kernel.org
> ---
>  drivers/hv/vmbus_drv.c |   13 ++++---------
>  1 file changed, 4 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
> index 7b9f3fc3adf7..32d0009631a6 100644
> --- a/drivers/hv/vmbus_drv.c
> +++ b/drivers/hv/vmbus_drv.c
> @@ -46,8 +46,6 @@ struct vmbus_dynid {
> 
>  static struct acpi_device  *hv_acpi_dev;
> 
> -static struct completion probe_event;
> -
>  static int hyperv_cpuhp_online;
> 
>  static void *hv_panic_page;
> @@ -2468,7 +2466,6 @@ static int vmbus_acpi_add(struct acpi_device *device)
>  	ret_val = 0;
> 
>  acpi_walk_err:
> -	complete(&probe_event);
>  	if (ret_val)
>  		vmbus_acpi_remove(device);
>  	return ret_val;
> @@ -2647,6 +2644,7 @@ static struct acpi_driver vmbus_acpi_driver = {
>  		.remove = vmbus_acpi_remove,
>  	},
>  	.drv.pm = &vmbus_bus_pm,
> +	.drv.probe_type = PROBE_FORCE_SYNCHRONOUS,
>  };
> 
>  static void hv_kexec_handler(void)
> @@ -2719,7 +2717,7 @@ static struct syscore_ops hv_synic_syscore_ops = {
> 
>  static int __init hv_acpi_init(void)
>  {
> -	int ret, t;
> +	int ret;
> 
>  	if (!hv_is_hyperv_initialized())
>  		return -ENODEV;
> @@ -2727,8 +2725,6 @@ static int __init hv_acpi_init(void)
>  	if (hv_root_partition)
>  		return 0;
> 
> -	init_completion(&probe_event);
> -
>  	/*
>  	 * Get ACPI resources first.
>  	 */
> @@ -2737,9 +2733,8 @@ static int __init hv_acpi_init(void)
>  	if (ret)
>  		return ret;
> 
> -	t = wait_for_completion_timeout(&probe_event, 5*HZ);
> -	if (t == 0) {
> -		ret = -ETIMEDOUT;
> +	if (!hv_acpi_dev) {
> +		ret = -ENODEV;
>  		goto cleanup;
>  	}
> 
> 

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


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

* Re: [PATCH] Drivers: hv: vmbus: Don't wait for the ACPI device upon initialization
  2022-09-21 18:39 [PATCH] Drivers: hv: vmbus: Don't wait for the ACPI device upon initialization Stanislav Kinsburskii
  2022-09-22 17:19 ` Wei Liu
  2022-09-22 21:59 ` Michael Kelley (LINUX)
@ 2022-09-23 10:39 ` Wei Liu
  2 siblings, 0 replies; 5+ messages in thread
From: Wei Liu @ 2022-09-23 10:39 UTC (permalink / raw)
  To: Stanislav Kinsburskii
  Cc: skinsburskii, Stanislav Kinsburskiy, K. Y. Srinivasan,
	Haiyang Zhang, Stephen Hemminger, Wei Liu, Dexuan Cui,
	linux-hyperv, linux-kernel

On Wed, Sep 21, 2022 at 06:39:05PM +0000, Stanislav Kinsburskii wrote:
> From: Stanislav Kinsburskiy <stanislav.kinsburskiy@gmail.com>
> 
> Waiting to 5 seconds in case of missing VMBUS ACPI device is redundant as the
> device is either present already or won't be available at all.
> This patch enforces synchronous probing to make sure the bus traversal,
> happening upon driver registering will either find the device (if present) or
> not spend any additional time if device is absent.
> 
> Signed-off-by: Stanislav Kinsburskiy <stanislav.kinsburskiy@gmail.com>
> CC: "K. Y. Srinivasan" <kys@microsoft.com>
> CC: Haiyang Zhang <haiyangz@microsoft.com>
> CC: Stephen Hemminger <sthemmin@microsoft.com>
> CC: Wei Liu <wei.liu@kernel.org>
> CC: Dexuan Cui <decui@microsoft.com>
> CC: linux-hyperv@vger.kernel.org
> CC: linux-kernel@vger.kernel.org

Applied to hyperv-next. I changed vmbus to VMBus in the first paragraph
and added a line break.

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

end of thread, other threads:[~2022-09-23 10:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-21 18:39 [PATCH] Drivers: hv: vmbus: Don't wait for the ACPI device upon initialization Stanislav Kinsburskii
2022-09-22 17:19 ` Wei Liu
2022-09-22 20:07   ` Dexuan Cui
2022-09-22 21:59 ` Michael Kelley (LINUX)
2022-09-23 10:39 ` 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).