linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] usb: ehci-pci: Set PROBE_PREFER_ASYNCHRONOUS
@ 2022-10-28 21:19 Brian Norris
  2022-10-28 21:19 ` [PATCH 2/2] usb: xhci-pci: " Brian Norris
  2022-10-29  1:13 ` [PATCH 1/2] usb: ehci-pci: " Alan Stern
  0 siblings, 2 replies; 4+ messages in thread
From: Brian Norris @ 2022-10-28 21:19 UTC (permalink / raw)
  To: Alan Stern, Greg Kroah-Hartman, Mathias Nyman
  Cc: Brian Norris, linux-kernel, linux-usb

This driver often takes on the order of 8ms to start, but every little
bit counts. It shouldn't have many cross-device dependencies to
race with, nor racy access to shared state with other drivers, so this
should be a relatively low risk change.

This driver was pinpointed as part of a survey of top slowest initcalls
(i.e., are built in, and probing synchronously) on a lab of ChromeOS
systems.

Signed-off-by: Brian Norris <briannorris@chromium.org>
---

 drivers/usb/host/ehci-pci.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c
index 17f8b6ea0c35..4b148fe5e43b 100644
--- a/drivers/usb/host/ehci-pci.c
+++ b/drivers/usb/host/ehci-pci.c
@@ -411,11 +411,12 @@ static struct pci_driver ehci_pci_driver = {
 	.remove =	ehci_pci_remove,
 	.shutdown = 	usb_hcd_pci_shutdown,
 
-#ifdef CONFIG_PM
 	.driver =	{
-		.pm =	&usb_hcd_pci_pm_ops
-	},
+#ifdef CONFIG_PM
+		.pm =	&usb_hcd_pci_pm_ops,
 #endif
+		.probe_type = PROBE_PREFER_ASYNCHRONOUS,
+	},
 };
 
 static int __init ehci_pci_init(void)
-- 
2.38.1.273.g43a17bfeac-goog


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

* [PATCH 2/2] usb: xhci-pci: Set PROBE_PREFER_ASYNCHRONOUS
  2022-10-28 21:19 [PATCH 1/2] usb: ehci-pci: Set PROBE_PREFER_ASYNCHRONOUS Brian Norris
@ 2022-10-28 21:19 ` Brian Norris
  2022-10-29  1:13 ` [PATCH 1/2] usb: ehci-pci: " Alan Stern
  1 sibling, 0 replies; 4+ messages in thread
From: Brian Norris @ 2022-10-28 21:19 UTC (permalink / raw)
  To: Alan Stern, Greg Kroah-Hartman, Mathias Nyman
  Cc: Brian Norris, linux-kernel, linux-usb

This driver often takes on the order of 10ms to start, but in some cases
takes more than 100ms. It shouldn't have many cross-device dependencies
to race with, nor racy access to shared state with other drivers, so
this should be a relatively low risk change.

This driver was pinpointed as part of a survey of top slowest initcalls
(i.e., are built in, and probing synchronously) on a lab of ChromeOS
systems.

Signed-off-by: Brian Norris <briannorris@chromium.org>
---

 drivers/usb/host/xhci-pci.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index 40228a3d77a0..4da03de1be70 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -689,7 +689,8 @@ static struct pci_driver xhci_pci_driver = {
 	.shutdown = 	usb_hcd_pci_shutdown,
 #ifdef CONFIG_PM
 	.driver = {
-		.pm = &usb_hcd_pci_pm_ops
+		.pm = &usb_hcd_pci_pm_ops,
+		.probe_type = PROBE_PREFER_ASYNCHRONOUS,
 	},
 #endif
 };
-- 
2.38.1.273.g43a17bfeac-goog


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

* Re: [PATCH 1/2] usb: ehci-pci: Set PROBE_PREFER_ASYNCHRONOUS
  2022-10-28 21:19 [PATCH 1/2] usb: ehci-pci: Set PROBE_PREFER_ASYNCHRONOUS Brian Norris
  2022-10-28 21:19 ` [PATCH 2/2] usb: xhci-pci: " Brian Norris
@ 2022-10-29  1:13 ` Alan Stern
  2022-10-29  1:44   ` Brian Norris
  1 sibling, 1 reply; 4+ messages in thread
From: Alan Stern @ 2022-10-29  1:13 UTC (permalink / raw)
  To: Brian Norris; +Cc: Greg Kroah-Hartman, Mathias Nyman, linux-kernel, linux-usb

On Fri, Oct 28, 2022 at 02:19:07PM -0700, Brian Norris wrote:
> This driver often takes on the order of 8ms to start, but every little
> bit counts. It shouldn't have many cross-device dependencies to
> race with, nor racy access to shared state with other drivers, so this
> should be a relatively low risk change.
> 
> This driver was pinpointed as part of a survey of top slowest initcalls
> (i.e., are built in, and probing synchronously) on a lab of ChromeOS
> systems.
> 
> Signed-off-by: Brian Norris <briannorris@chromium.org>
> ---

Acked-by: Alan Stern <stern@rowland.harvard.edu>

However, I'm curious to know why this patch makes ehci-pci use 
PROBE_PREFER_ASYNCHRONOUS even when CONFIG_PM isn't set, whereas the 2/2 
patch makes xhci-pci use PROBE_PREFER_ASYNCHRONOUS only when CONFIG_PM 
is set.

Alan Stern

>  drivers/usb/host/ehci-pci.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c
> index 17f8b6ea0c35..4b148fe5e43b 100644
> --- a/drivers/usb/host/ehci-pci.c
> +++ b/drivers/usb/host/ehci-pci.c
> @@ -411,11 +411,12 @@ static struct pci_driver ehci_pci_driver = {
>  	.remove =	ehci_pci_remove,
>  	.shutdown = 	usb_hcd_pci_shutdown,
>  
> -#ifdef CONFIG_PM
>  	.driver =	{
> -		.pm =	&usb_hcd_pci_pm_ops
> -	},
> +#ifdef CONFIG_PM
> +		.pm =	&usb_hcd_pci_pm_ops,
>  #endif
> +		.probe_type = PROBE_PREFER_ASYNCHRONOUS,
> +	},
>  };
>  
>  static int __init ehci_pci_init(void)
> -- 
> 2.38.1.273.g43a17bfeac-goog
> 

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

* Re: [PATCH 1/2] usb: ehci-pci: Set PROBE_PREFER_ASYNCHRONOUS
  2022-10-29  1:13 ` [PATCH 1/2] usb: ehci-pci: " Alan Stern
@ 2022-10-29  1:44   ` Brian Norris
  0 siblings, 0 replies; 4+ messages in thread
From: Brian Norris @ 2022-10-29  1:44 UTC (permalink / raw)
  To: Alan Stern; +Cc: Greg Kroah-Hartman, Mathias Nyman, linux-kernel, linux-usb

On Fri, Oct 28, 2022 at 09:13:14PM -0400, Alan Stern wrote:
> However, I'm curious to know why this patch makes ehci-pci use 
> PROBE_PREFER_ASYNCHRONOUS even when CONFIG_PM isn't set, whereas the 2/2 
> patch makes xhci-pci use PROBE_PREFER_ASYNCHRONOUS only when CONFIG_PM 
> is set.

That's definitely a bug in patch 2. This has nothing (or, little; probe
order can technically affect the PM suspend/resume order) to do with
CONFIG_PM, except that the .pm hooks tend to sit nearby, and repeated
driver patching makes the author's eyes glaze over sometimes...

Thanks. v2 coming.

Brian

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

end of thread, other threads:[~2022-10-29  1:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-28 21:19 [PATCH 1/2] usb: ehci-pci: Set PROBE_PREFER_ASYNCHRONOUS Brian Norris
2022-10-28 21:19 ` [PATCH 2/2] usb: xhci-pci: " Brian Norris
2022-10-29  1:13 ` [PATCH 1/2] usb: ehci-pci: " Alan Stern
2022-10-29  1:44   ` Brian Norris

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).