[1/1] thunderbolt: add trivial .shutdown
diff mbox series

Message ID 20200520185221.122283-2-mlevitsk@redhat.com
State Accepted
Commit 4caf2511ec498277333d229f8a7ad1fa9331df65
Headers show
Series
  • RFC: Make thunderbolt NHI driver work with kexec [RESEND]
Related show

Commit Message

Maxim Levitsky May 20, 2020, 6:52 p.m. UTC
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(+)

Comments

Mika Westerberg May 25, 2020, 8:53 a.m. UTC | #1
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!

Patch
diff mbox series

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,
 };