[PATCH] examples/ntb: remove redundant logic for dev close

Guo, Junfeng junfeng.guo at intel.com
Wed Jun 28 10:08:32 CEST 2023



> -----Original Message-----
> From: Thomas Monjalon <thomas at monjalon.net>
> Sent: Wednesday, June 28, 2023 15:53
> To: Wu, Jingjing <jingjing.wu at intel.com>; Guo, Junfeng
> <junfeng.guo at intel.com>
> Cc: dev at dpdk.org; stable at dpdk.org; He, Xingguang
> <xingguang.he at intel.com>; Laatz, Kevin <kevin.laatz at intel.com>;
> Richardson, Bruce <bruce.richardson at intel.com>
> Subject: Re: [PATCH] examples/ntb: remove redundant logic for dev close
> 
> 28/06/2023 04:37, Guo, Junfeng:
> > From: Guo, Junfeng
> > > From: Thomas Monjalon <thomas at monjalon.net>
> > > > 14/06/2023 07:14, Junfeng Guo:
> > > > > During EAL cleanup stage, all bus devices are cleaned up properly.
> > > > > Based on this, there is no need to do extra device close process,
> > > > > which may call the dev ops '*dev->dev_ops->dev_close' twice.
> > > > >
> > > > > If this dev ops for ntb was called twice, the interrupt handle for
> > > > > EAL will be disabled twice and will lead to error for the seconde
> > > > > time. Like this: "EAL: Error disabling MSI-X interrupts for fd xx"
> > > >
> > > > You should fix ntb to not disable interrupt twice.
> > >
> > > Thanks for the comment!
> > >
> > > Yes, it is exactly what this patch did.
> >
> > Another solution is to add extra logic in dev_close, i.e., to do the
> > interrupt disabling process only when the interrupt handler is valid.
> > That is, to disable interrupt only when 'intr_handle->max_intr' or
> > 'intr_handle->nb_efd' is non-zero.
> >
> > But I'm not sure if this method is a better solution.
> > Please help give some advice, thanks!
> 
> Yes this is what I suggest.
> You cannot fix all applications in the world,
> but you can fix the driver, so it is a better way :)

Sure! Thanks for the advice!

Will update with this solution, thanks!

> 
> > > The interrupt disabling process is part of 'dev_close' ops, and will be
> > > called twice (one in EAL cleanup, another in ntb example cleanup).
> > >
> > > Now that fixed & covered by the EAL cleanup, there is no need to
> > > run dev_close at ntb example. Just remove that redundant logic.
> 
> 



More information about the dev mailing list