Skip to content

Commit

Permalink
Drivers: hv: vmbus: Don't wait for the ACPI device upon initialization
Browse files Browse the repository at this point in the history
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 <[email protected]>
CC: "K. Y. Srinivasan" <[email protected]>
CC: Haiyang Zhang <[email protected]>
CC: Stephen Hemminger <[email protected]>
CC: Wei Liu <[email protected]>
CC: Dexuan Cui <[email protected]>
CC: [email protected]
CC: [email protected]
Reviewed-by: Michael Kelley <[email protected]>
Reviewed-by: Dexuan Cui <[email protected]>
Link: https://lore.kernel.org/r/166378554568.581670.1124852716698789244.stgit@skinsburskii-cloud-desktop.internal.cloudapp.net
Signed-off-by: Wei Liu <[email protected]>
(cherry picked from commit f7ac541)
  • Loading branch information
skinsbursky authored and rbradford committed Oct 4, 2022
1 parent 0330241 commit 7f1768c
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions drivers/hv/vmbus_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,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;
Expand Down Expand Up @@ -2489,7 +2487,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;
Expand Down Expand Up @@ -2661,6 +2658,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)
Expand Down Expand Up @@ -2733,16 +2731,14 @@ 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;

if (hv_root_partition)
return 0;

init_completion(&probe_event);

/*
* Get ACPI resources first.
*/
Expand All @@ -2751,9 +2747,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;
}

Expand Down

0 comments on commit 7f1768c

Please sign in to comment.