linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/1] RFC: Make thunderbolt NHI driver work with kexec
@ 2020-05-20 18:12 Maxim Levitsky
  2020-05-20 18:12 ` [PATCH 1/1] thunderbolt: add trivial .shutdown 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

While trying to use kexec on my desktop,
which has Titan Ridge Thunderbolt add-on card,
I noticed that after a kexec, system hangs
for about a minute in the 'wating for udev devices
to settle' phase of the boot.

I found out that if I unload the thunderbolt driver
prior to the kexec, then it works just fine.

Looking at the code I see that the driver doeesn't
implement .shutdown method, so this on-liner patch
points it to the same method that is used on device removal.

I don't know if this is the right solution,
but it does appear to work just fine with this patch.

What do you think?

Best regards,
	Maxim Levitsky

Maxim Levitsky (1):
  thunderbolt: add trivial .shutdown

 drivers/thunderbolt/nhi.c | 1 +
 1 file changed, 1 insertion(+)

-- 
2.25.4



^ 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 related	[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

* 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

* [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 related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-05-25  8:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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