[PATCH 5/6] NTB: epf: vntb: Stop cmd_andler work in epf_ntb_epc_cleanup

Koichiro Den posted 6 patches 3 months, 2 weeks ago
There is a newer version of this series
[PATCH 5/6] NTB: epf: vntb: Stop cmd_andler work in epf_ntb_epc_cleanup
Posted by Koichiro Den 3 months, 2 weeks ago
Disable the delayed work before clearing BAR mappings and doorbells to
avoid running the handler after resources have been torn down.

  Unable to handle kernel paging request at virtual address ffff800083f46004
  [...]
  Internal error: Oops: 0000000096000007 [#1]  SMP
  [...]
  Call trace:
   epf_ntb_cmd_handler+0x54/0x200 [pci_epf_vntb] (P)
   process_one_work+0x154/0x3b0
   worker_thread+0x2c8/0x400
   kthread+0x148/0x210
   ret_from_fork+0x10/0x20

Cc: <stable@vger.kernel.org>
Fixes: e35f56bb0330 ("PCI: endpoint: Support NTB transfer between RC and EP")
Signed-off-by: Koichiro Den <den@valinux.co.jp>
---
 drivers/pci/endpoint/functions/pci-epf-vntb.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/pci/endpoint/functions/pci-epf-vntb.c b/drivers/pci/endpoint/functions/pci-epf-vntb.c
index 49ce5d4b0ee5..750a246f79c9 100644
--- a/drivers/pci/endpoint/functions/pci-epf-vntb.c
+++ b/drivers/pci/endpoint/functions/pci-epf-vntb.c
@@ -823,6 +823,7 @@ static int epf_ntb_epc_init(struct epf_ntb *ntb)
  */
 static void epf_ntb_epc_cleanup(struct epf_ntb *ntb)
 {
+	disable_delayed_work_sync(&ntb->cmd_handler);
 	epf_ntb_mw_bar_clear(ntb, ntb->num_mws);
 	epf_ntb_db_bar_clear(ntb);
 	epf_ntb_config_sspad_bar_clear(ntb);
-- 
2.48.1
Re: [PATCH 5/6] NTB: epf: vntb: Stop cmd_andler work in epf_ntb_epc_cleanup
Posted by Frank Li 3 months, 2 weeks ago
On Thu, Oct 23, 2025 at 04:17:56PM +0900, Koichiro Den wrote:
> Disable the delayed work before clearing BAR mappings and doorbells to
> avoid running the handler after resources have been torn down.
>
>   Unable to handle kernel paging request at virtual address ffff800083f46004
>   [...]
>   Internal error: Oops: 0000000096000007 [#1]  SMP
>   [...]
>   Call trace:
>    epf_ntb_cmd_handler+0x54/0x200 [pci_epf_vntb] (P)
>    process_one_work+0x154/0x3b0
>    worker_thread+0x2c8/0x400
>    kthread+0x148/0x210
>    ret_from_fork+0x10/0x20
>
> Cc: <stable@vger.kernel.org>
> Fixes: e35f56bb0330 ("PCI: endpoint: Support NTB transfer between RC and EP")
> Signed-off-by: Koichiro Den <den@valinux.co.jp>

Reviewed-by: Frank Li <Frank.Li@nxp.com>

> ---
>  drivers/pci/endpoint/functions/pci-epf-vntb.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/pci/endpoint/functions/pci-epf-vntb.c b/drivers/pci/endpoint/functions/pci-epf-vntb.c
> index 49ce5d4b0ee5..750a246f79c9 100644
> --- a/drivers/pci/endpoint/functions/pci-epf-vntb.c
> +++ b/drivers/pci/endpoint/functions/pci-epf-vntb.c
> @@ -823,6 +823,7 @@ static int epf_ntb_epc_init(struct epf_ntb *ntb)
>   */
>  static void epf_ntb_epc_cleanup(struct epf_ntb *ntb)
>  {
> +	disable_delayed_work_sync(&ntb->cmd_handler);
>  	epf_ntb_mw_bar_clear(ntb, ntb->num_mws);
>  	epf_ntb_db_bar_clear(ntb);
>  	epf_ntb_config_sspad_bar_clear(ntb);
> --
> 2.48.1
>
Re: [PATCH 5/6] NTB: epf: vntb: Stop cmd_andler work in epf_ntb_epc_cleanup
Posted by Koichiro Den 3 months, 2 weeks ago
On Fri, Oct 24, 2025 at 02:44:13PM -0400, Frank Li wrote:
> On Thu, Oct 23, 2025 at 04:17:56PM +0900, Koichiro Den wrote:
> > Disable the delayed work before clearing BAR mappings and doorbells to
> > avoid running the handler after resources have been torn down.
> >
> >   Unable to handle kernel paging request at virtual address ffff800083f46004
> >   [...]
> >   Internal error: Oops: 0000000096000007 [#1]  SMP
> >   [...]
> >   Call trace:
> >    epf_ntb_cmd_handler+0x54/0x200 [pci_epf_vntb] (P)
> >    process_one_work+0x154/0x3b0
> >    worker_thread+0x2c8/0x400
> >    kthread+0x148/0x210
> >    ret_from_fork+0x10/0x20
> >
> > Cc: <stable@vger.kernel.org>
> > Fixes: e35f56bb0330 ("PCI: endpoint: Support NTB transfer between RC and EP")
> > Signed-off-by: Koichiro Den <den@valinux.co.jp>
> 
> Reviewed-by: Frank Li <Frank.Li@nxp.com>

Thanks for the review.

I noticed a typo in the title: s/cmd_andler/cmd_handler/
I'll fix this in v2.

-Koichiro

> 
> > ---
> >  drivers/pci/endpoint/functions/pci-epf-vntb.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/pci/endpoint/functions/pci-epf-vntb.c b/drivers/pci/endpoint/functions/pci-epf-vntb.c
> > index 49ce5d4b0ee5..750a246f79c9 100644
> > --- a/drivers/pci/endpoint/functions/pci-epf-vntb.c
> > +++ b/drivers/pci/endpoint/functions/pci-epf-vntb.c
> > @@ -823,6 +823,7 @@ static int epf_ntb_epc_init(struct epf_ntb *ntb)
> >   */
> >  static void epf_ntb_epc_cleanup(struct epf_ntb *ntb)
> >  {
> > +	disable_delayed_work_sync(&ntb->cmd_handler);
> >  	epf_ntb_mw_bar_clear(ntb, ntb->num_mws);
> >  	epf_ntb_db_bar_clear(ntb);
> >  	epf_ntb_config_sspad_bar_clear(ntb);
> > --
> > 2.48.1
> >