Linux-USB Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH 0/1] RFC: Make thunderbolt NHI driver work with kexec [RESEND]
@ 2020-05-20 18:52 Maxim Levitsky
  2020-05-20 18:52 ` [PATCH 1/1] thunderbolt: add trivial .shutdown Maxim Levitsky
  0 siblings, 1 reply; 5+ messages in thread
From: Maxim Levitsky @ 2020-05-20 18:52 UTC (permalink / raw)
  To: linux-kernel
  Cc: Andreas Noever, Michael Jamet, Mika Westerberg, Jiri Kosina,
	open list:THUNDERBOLT DRIVER, Yehezkel Bernat, Maxim Levitsky

While trying to use kexec on my desktop,\r
which has Titan Ridge Thunderbolt add-on card,\r
I noticed that after a kexec, system hangs\r
for about a minute in the 'wating for udev devices\r
to settle' phase of the boot.\r
\r
I found out that if I unload the thunderbolt driver\r
prior to the kexec, then it works just fine.\r
\r
Looking at the code I see that the driver doeesn't\r
implement .shutdown method, so this on-liner patch\r
points it to the same method that is used on device removal.\r
\r
I don't know if this is the right solution,\r
but it does appear to work just fine with this patch.\r
\r
What do you think?\r
\r
Best regards,\r
	Maxim Levitsky\r
\r
Maxim Levitsky (1):\r
  thunderbolt: add trivial .shutdown\r
\r
 drivers/thunderbolt/nhi.c | 1 +\r
 1 file changed, 1 insertion(+)\r
\r
-- \r
2.25.4\r
\r


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

* [PATCH 1/1] thunderbolt: add trivial .shutdown
  2020-05-20 18:52 [PATCH 0/1] RFC: Make thunderbolt NHI driver work with kexec [RESEND] Maxim Levitsky
@ 2020-05-20 18:52 ` Maxim Levitsky
  2020-05-25  8:53   ` Mika Westerberg
  0 siblings, 1 reply; 5+ messages in thread
From: Maxim Levitsky @ 2020-05-20 18:52 UTC (permalink / raw)
  To: linux-kernel
  Cc: Andreas Noever, Michael Jamet, Mika Westerberg, Jiri Kosina,
	open list:THUNDERBOLT DRIVER, Yehezkel Bernat, Maxim Levitsky

On my machine, a kexec with this driver loaded in the old kernel
causes a very long delay on boot in the kexec'ed kernel,
most likely due to unclean shutdown prior to that.

Unloading thunderbolt driver prior to kexec allows kexec to work as fast
as regular kernel boot, as well as adding this .shutdown pointer.

Shutting a device prior to the shutdown completely is always
a good idea IMHO to help with kexec,
and this one-liner patch implements it.

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
---
 drivers/thunderbolt/nhi.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/thunderbolt/nhi.c b/drivers/thunderbolt/nhi.c
index 1be491ecbb45..4046642e6aec 100644
--- a/drivers/thunderbolt/nhi.c
+++ b/drivers/thunderbolt/nhi.c
@@ -1285,6 +1285,7 @@ static struct pci_driver nhi_driver = {
 	.id_table = nhi_ids,
 	.probe = nhi_probe,
 	.remove = nhi_remove,
+	.shutdown = nhi_remove,
 	.driver.pm = &nhi_pm_ops,
 };
 
-- 
2.25.4


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

* Re: [PATCH 1/1] thunderbolt: add trivial .shutdown
  2020-05-20 18:52 ` [PATCH 1/1] thunderbolt: add trivial .shutdown Maxim Levitsky
@ 2020-05-25  8:53   ` Mika Westerberg
  0 siblings, 0 replies; 5+ messages in thread
From: Mika Westerberg @ 2020-05-25  8:53 UTC (permalink / raw)
  To: Maxim Levitsky
  Cc: linux-kernel, Andreas Noever, Michael Jamet, Jiri Kosina,
	open list:THUNDERBOLT DRIVER, Yehezkel Bernat

On Wed, May 20, 2020 at 09:52:21PM +0300, Maxim Levitsky wrote:
> On my machine, a kexec with this driver loaded in the old kernel
> causes a very long delay on boot in the kexec'ed kernel,
> most likely due to unclean shutdown prior to that.
> 
> Unloading thunderbolt driver prior to kexec allows kexec to work as fast
> as regular kernel boot, as well as adding this .shutdown pointer.
> 
> Shutting a device prior to the shutdown completely is always
> a good idea IMHO to help with kexec,
> and this one-liner patch implements it.
> 
> Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
> ---
>  drivers/thunderbolt/nhi.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/thunderbolt/nhi.c b/drivers/thunderbolt/nhi.c
> index 1be491ecbb45..4046642e6aec 100644
> --- a/drivers/thunderbolt/nhi.c
> +++ b/drivers/thunderbolt/nhi.c
> @@ -1285,6 +1285,7 @@ static struct pci_driver nhi_driver = {
>  	.id_table = nhi_ids,
>  	.probe = nhi_probe,
>  	.remove = nhi_remove,
> +	.shutdown = nhi_remove,

I guess nhi_remove() does a bit more work than strictly required for
.shutdown but we can deal with that later if needed.

Applied to thunderbolt.git/next, thanks!

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

* Re: [PATCH 1/1] thunderbolt: add trivial .shutdown
  2020-05-20 18:12 ` [PATCH 1/1] thunderbolt: add trivial .shutdown Maxim Levitsky
@ 2020-05-20 18:45   ` Maxim Levitsky
  0 siblings, 0 replies; 5+ messages in thread
From: Maxim Levitsky @ 2020-05-20 18:45 UTC (permalink / raw)
  To: kvm
  Cc: Michael Jamet, Mika Westerberg, Andreas Noever,
	open list:THUNDERBOLT DRIVER, Yehezkel Bernat, open list,
	Jiri Kosina

On Wed, 2020-05-20 at 21:12 +0300, Maxim Levitsky wrote:
> On my machine, a kexec with this driver loaded in the old kernel
> causes a very long delay on boot in the kexec'ed kernel,
> most likely due to unclean shutdown prior to that.
> 
> Unloading thunderbolt driver prior to kexec allows kexec to work as fast
> as regular kernel boot, as well as adding this .shutdown pointer.
> 
> Shutting a device prior to the shutdown completely is always
> a good idea IMHO to help with kexec,
> and this one-liner patch implements it.
> 
> Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
> ---
>  drivers/thunderbolt/nhi.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/thunderbolt/nhi.c b/drivers/thunderbolt/nhi.c
> index 1be491ecbb45..4046642e6aec 100644
> --- a/drivers/thunderbolt/nhi.c
> +++ b/drivers/thunderbolt/nhi.c
> @@ -1285,6 +1285,7 @@ static struct pci_driver nhi_driver = {
>  	.id_table = nhi_ids,
>  	.probe = nhi_probe,
>  	.remove = nhi_remove,
> +	.shutdown = nhi_remove,
>  	.driver.pm = &nhi_pm_ops,
>  };
>  
Oops, I see that I posted this little fix on a wrong mailing list.
I didn't update the script correctly.
Sorry for the noise!

Best regards,
	Maxim Levitsky



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

* [PATCH 1/1] thunderbolt: add trivial .shutdown
  2020-05-20 18:12 [PATCH 0/1] RFC: Make thunderbolt NHI driver work with kexec Maxim Levitsky
@ 2020-05-20 18:12 ` Maxim Levitsky
  2020-05-20 18:45   ` Maxim Levitsky
  0 siblings, 1 reply; 5+ messages in thread
From: Maxim Levitsky @ 2020-05-20 18:12 UTC (permalink / raw)
  To: kvm
  Cc: Michael Jamet, Mika Westerberg, Andreas Noever,
	open list:THUNDERBOLT DRIVER, Yehezkel Bernat, open list,
	Jiri Kosina, Maxim Levitsky

On my machine, a kexec with this driver loaded in the old kernel
causes a very long delay on boot in the kexec'ed kernel,
most likely due to unclean shutdown prior to that.

Unloading thunderbolt driver prior to kexec allows kexec to work as fast
as regular kernel boot, as well as adding this .shutdown pointer.

Shutting a device prior to the shutdown completely is always
a good idea IMHO to help with kexec,
and this one-liner patch implements it.

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
---
 drivers/thunderbolt/nhi.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/thunderbolt/nhi.c b/drivers/thunderbolt/nhi.c
index 1be491ecbb45..4046642e6aec 100644
--- a/drivers/thunderbolt/nhi.c
+++ b/drivers/thunderbolt/nhi.c
@@ -1285,6 +1285,7 @@ static struct pci_driver nhi_driver = {
 	.id_table = nhi_ids,
 	.probe = nhi_probe,
 	.remove = nhi_remove,
+	.shutdown = nhi_remove,
 	.driver.pm = &nhi_pm_ops,
 };
 
-- 
2.25.4


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

end of thread, back to index

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-20 18:52 [PATCH 0/1] RFC: Make thunderbolt NHI driver work with kexec [RESEND] Maxim Levitsky
2020-05-20 18:52 ` [PATCH 1/1] thunderbolt: add trivial .shutdown Maxim Levitsky
2020-05-25  8:53   ` Mika Westerberg
  -- strict thread matches above, loose matches on Subject: below --
2020-05-20 18:12 [PATCH 0/1] RFC: Make thunderbolt NHI driver work with kexec Maxim Levitsky
2020-05-20 18:12 ` [PATCH 1/1] thunderbolt: add trivial .shutdown Maxim Levitsky
2020-05-20 18:45   ` Maxim Levitsky

Linux-USB Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-usb/0 linux-usb/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-usb linux-usb/ https://lore.kernel.org/linux-usb \
		linux-usb@vger.kernel.org
	public-inbox-index linux-usb

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-usb


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git