[PATCH] raw/ntb: add check for DB intr handler registering

Thomas Monjalon thomas at monjalon.net
Mon Mar 7 18:07:03 CET 2022


10/02/2022 11:43, Guo, Junfeng:
> 
> > -----Original Message-----
> > From: Guo, Junfeng
> > Sent: Thursday, February 10, 2022 15:18
> > To: Wu, Jingjing <jingjing.wu at intel.com>
> > Cc: dev at dpdk.org; stable at dpdk.org
> > Subject: RE: [PATCH] raw/ntb: add check for DB intr handler registering
> > 
> > 
> > 
> > > -----Original Message-----
> > > From: Wu, Jingjing <jingjing.wu at intel.com>
> > > Sent: Thursday, February 10, 2022 15:05
> > > To: Guo, Junfeng <junfeng.guo at intel.com>
> > > Cc: dev at dpdk.org; stable at dpdk.org
> > > Subject: RE: [PATCH] raw/ntb: add check for DB intr handler registering
> > >
> > >
> > >
> > > > -----Original Message-----
> > > > From: Guo, Junfeng <junfeng.guo at intel.com>
> > > > Sent: Thursday, February 10, 2022 2:29 PM
> > > > To: Wu, Jingjing <jingjing.wu at intel.com>
> > > > Cc: dev at dpdk.org; stable at dpdk.org; Guo, Junfeng
> > > <junfeng.guo at intel.com>
> > > > Subject: [PATCH] raw/ntb: add check for DB intr handler registering
> > > >
> > > > The callback registering of doorbell interrupt handler should be
> > > > finished before enabling the interrupt event fd. Thus add the return
> > > > value check for this callback registering.
> > > >
> > > > Fixes: 62012a76811e ("raw/ntb: add handshake process")
> > > > Cc: stable at dpdk.org
> > > >
> > > > Signed-off-by: Junfeng Guo <junfeng.guo at intel.com>
> > > > ---
> > > >  drivers/raw/ntb/ntb.c | 8 ++++++--
> > > >  1 file changed, 6 insertions(+), 2 deletions(-)
> > > >
> > > > diff --git a/drivers/raw/ntb/ntb.c b/drivers/raw/ntb/ntb.c
> > > > index cc611dfbb9..0801e6d1ae 100644
> > > > --- a/drivers/raw/ntb/ntb.c
> > > > +++ b/drivers/raw/ntb/ntb.c
> > > > @@ -1403,8 +1403,12 @@ ntb_init_hw(struct rte_rawdev *dev,
> > struct
> > > rte_pci_device
> > > > *pci_dev)
> > > >
> > > >  	intr_handle = pci_dev->intr_handle;
> > > >  	/* Register callback func to eal lib */
> > > > -	rte_intr_callback_register(intr_handle,
> > > > -				   ntb_dev_intr_handler, dev);
> > > > +	ret = rte_intr_callback_register(intr_handle,
> > > > +					 ntb_dev_intr_handler, dev);
> > > > +	if (ret) {
> > > > +		NTB_LOG(ERR, "Unable to register doorbell intr
> > > handler.");
> > > > +		return ret;
> > > > +	}
> > > When will this register failure happen? Have you checked what is the
> > root
> > > cause?
> > 
> > When bind with vfio-pci, the DB interrupt callback function often cannot
> > work as expected.
> > I think this is due to that, the intr callback registering not finished before
> > event fd enabled.
> > Add the check of the return value here can make sure about correct
> > processing sequence.
> 
> I think some compiler optimization would lead to this condition.
> So add return value check can prevent this (i.e., registering not finished).

There is no formal ack. What is the status of this patch?






More information about the stable mailing list