Skip to contentSkip to conversation

raw/ntb: add check for DB intr handler registering

PATCH In review Junfeng Guo 3 participants 8 messages Feb 10, 2022 – Mar 8, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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")
---
 drivers/raw/ntb/ntb.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/raw/ntb/ntb.c +6 -2
index cc611dfbb9..0801e6d1ae 100644
@@ -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;
+	}
 
 	ret = rte_intr_efd_enable(intr_handle, hw->db_cnt);
 	if (ret)
Signature · 1 line
2.25.1
#1 lore raw
Quoted 28 lines

-----Original Message-----
From: Guo, Junfeng <[email protected]>
Sent: Thursday, February 10, 2022 2:29 PM
To: Wu, Jingjing <[email protected]>
Cc: [email protected]; [email protected]; Guo, Junfeng <[email protected]>
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")
---
 drivers/raw/ntb/ntb.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/raw/ntb/ntb.c +0 -0
index cc611dfbb9..0801e6d1ae 100644
@@ -1403,8 +1403,12 @@ ntb_init_hw(struct rte_rawdev *dev, struct rte_pci_device
 *pci_dev)
 

drivers/raw/ntb/ntb.c ntb_init_hw(struct rte_rawdev *dev, struct rte_pci_device · line 1412

Quoted 10 lines
drivers/raw/ntb/ntb.c +6 -2
 	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?

drivers/raw/ntb/ntb.c ntb_init_hw(struct rte_rawdev *dev, struct rte_pci_device *pci_dev) · line 1414

Quoted 3 lines
drivers/raw/ntb/ntb.c +0 -0
 	ret = rte_intr_efd_enable(intr_handle, hw->db_cnt);
 	if (ret)

Need roll back, such as rte_intr_callback_unregister is required when fail or driver remove?

Quoted 2 lines

--
2.25.1

#2 lore raw
Quoted 48 lines

-----Original Message-----
From: Wu, Jingjing <[email protected]>
Sent: Thursday, February 10, 2022 15:05
To: Guo, Junfeng <[email protected]>
Cc: [email protected]; [email protected]
Subject: RE: [PATCH] raw/ntb: add check for DB intr handler registering

Quoted 5 lines

-----Original Message-----
From: Guo, Junfeng <[email protected]>
Sent: Thursday, February 10, 2022 2:29 PM
To: Wu, Jingjing <[email protected]>
Cc: [email protected]; [email protected]; Guo, Junfeng

<[email protected]>

drivers/raw/ntb/ntb.c ntb_init_hw(struct rte_rawdev *dev, struct

Quoted 19 lines

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")
---
 drivers/raw/ntb/ntb.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/raw/ntb/ntb.c +0 -0
index cc611dfbb9..0801e6d1ae 100644
@@ -1403,8 +1403,12 @@ ntb_init_hw(struct rte_rawdev *dev, struct

rte_pci_device

drivers/raw/ntb/ntb.c ntb_init_hw(struct rte_rawdev *dev, struct rte_pci_device *pci_dev)

Quoted 10 lines
drivers/raw/ntb/ntb.c +4 -2
 *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.");

Quoted 4 lines

drivers/raw/ntb/ntb.c ntb_init_hw(struct rte_rawdev *dev, struct rte_pci_device *pci_dev) · line 1411

Quoted 2 lines
drivers/raw/ntb/ntb.c +2 -0
+		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.

Quoted 8 lines

drivers/raw/ntb/ntb.c ntb_init_hw(struct rte_rawdev *dev, struct rte_pci_device *pci_dev) · line 1414

Quoted 4 lines
drivers/raw/ntb/ntb.c +0 -0
 	ret = rte_intr_efd_enable(intr_handle, hw->db_cnt);
 	if (ret)

Need roll back, such as rte_intr_callback_unregister is required when fail or driver remove?

Quoted 2 lines

--
2.25.1

#3 lore raw
Quoted 62 lines

-----Original Message-----
From: Guo, Junfeng
Sent: Thursday, February 10, 2022 15:18
To: Wu, Jingjing <[email protected]>
Cc: [email protected]; [email protected]
Subject: RE: [PATCH] raw/ntb: add check for DB intr handler registering

Quoted 29 lines

-----Original Message-----
From: Wu, Jingjing <[email protected]>
Sent: Thursday, February 10, 2022 15:05
To: Guo, Junfeng <[email protected]>
Cc: [email protected]; [email protected]
Subject: RE: [PATCH] raw/ntb: add check for DB intr handler registering

Quoted 5 lines

-----Original Message-----
From: Guo, Junfeng <[email protected]>
Sent: Thursday, February 10, 2022 2:29 PM
To: Wu, Jingjing <[email protected]>
Cc: [email protected]; [email protected]; Guo, Junfeng

<[email protected]>

Quoted 14 lines

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")
---
 drivers/raw/ntb/ntb.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
Quoted 5 lines

drivers/raw/ntb/ntb.c ntb_init_hw(struct rte_rawdev *dev,

Quoted 5 lines
drivers/raw/ntb/ntb.c +0 -0
index cc611dfbb9..0801e6d1ae 100644
@@ -1403,8 +1403,12 @@ ntb_init_hw(struct rte_rawdev *dev,

struct

Quoted 12 lines

rte_pci_device

drivers/raw/ntb/ntb.c ntb_init_hw(struct rte_rawdev *dev, struct rte_pci_device *pci_dev)

Quoted 10 lines
drivers/raw/ntb/ntb.c +4 -2
 *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.");

Quoted 3 lines

drivers/raw/ntb/ntb.c ntb_init_hw(struct rte_rawdev *dev, struct rte_pci_device *pci_dev) · line 1411

Quoted 2 lines
drivers/raw/ntb/ntb.c +2 -0
+		return ret;
+	}

When will this register failure happen? Have you checked what is the

root

Quoted 8 lines
Quoted 1 line

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

Quoted 10 lines
Quoted 6 lines

drivers/raw/ntb/ntb.c ntb_init_hw(struct rte_rawdev *dev, struct rte_pci_device *pci_dev) · line 1414

Quoted 5 lines
drivers/raw/ntb/ntb.c +0 -0
 	ret = rte_intr_efd_enable(intr_handle, hw->db_cnt);
 	if (ret)

Need roll back, such as rte_intr_callback_unregister is required when

fail

Quoted 3 lines

or driver remove?

Quoted 2 lines

--
2.25.1

#4 lore raw

10/02/2022 11:43, Guo, Junfeng:

Quoted 70 lines
Quoted 61 lines

-----Original Message-----
From: Guo, Junfeng
Sent: Thursday, February 10, 2022 15:18
To: Wu, Jingjing <[email protected]>
Cc: [email protected]; [email protected]
Subject: RE: [PATCH] raw/ntb: add check for DB intr handler registering

Quoted 29 lines

-----Original Message-----
From: Wu, Jingjing <[email protected]>
Sent: Thursday, February 10, 2022 15:05
To: Guo, Junfeng <[email protected]>
Cc: [email protected]; [email protected]
Subject: RE: [PATCH] raw/ntb: add check for DB intr handler registering

Quoted 5 lines

-----Original Message-----
From: Guo, Junfeng <[email protected]>
Sent: Thursday, February 10, 2022 2:29 PM
To: Wu, Jingjing <[email protected]>
Cc: [email protected]; [email protected]; Guo, Junfeng

<[email protected]>

Quoted 14 lines

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")
---
 drivers/raw/ntb/ntb.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
Quoted 5 lines

drivers/raw/ntb/ntb.c ntb_init_hw(struct rte_rawdev *dev,

Quoted 5 lines
drivers/raw/ntb/ntb.c +0 -0
index cc611dfbb9..0801e6d1ae 100644
@@ -1403,8 +1403,12 @@ ntb_init_hw(struct rte_rawdev *dev,

struct

Quoted 12 lines

rte_pci_device

drivers/raw/ntb/ntb.c ntb_init_hw(struct rte_rawdev *dev, struct rte_pci_device *pci_dev)

Quoted 10 lines
drivers/raw/ntb/ntb.c +4 -2
 *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.");

Quoted 3 lines

drivers/raw/ntb/ntb.c ntb_init_hw(struct rte_rawdev *dev, struct rte_pci_device *pci_dev) · line 1411

Quoted 2 lines
drivers/raw/ntb/ntb.c +2 -0
+		return ret;
+	}

When will this register failure happen? Have you checked what is the

root

Quoted 8 lines
Quoted 1 line

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.

Quoted 2 lines

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?

#5 lore raw
Quoted 83 lines

-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Tuesday, March 8, 2022 01:07
To: Wu, Jingjing <[email protected]>; Guo, Junfeng <[email protected]>
Cc: [email protected]; [email protected]
Subject: Re: [PATCH] raw/ntb: add check for DB intr handler registering

10/02/2022 11:43, Guo, Junfeng:

Quoted 7 lines
Quoted 7 lines

-----Original Message-----
From: Guo, Junfeng
Sent: Thursday, February 10, 2022 15:18
To: Wu, Jingjing <[email protected]>
Cc: [email protected]; [email protected]
Subject: RE: [PATCH] raw/ntb: add check for DB intr handler

registering

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

-----Original Message-----
From: Wu, Jingjing <[email protected]>
Sent: Thursday, February 10, 2022 15:05
To: Guo, Junfeng <[email protected]>
Cc: [email protected]; [email protected]
Subject: RE: [PATCH] raw/ntb: add check for DB intr handler

registering

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 8 lines

-----Original Message-----
From: Guo, Junfeng <[email protected]>
Sent: Thursday, February 10, 2022 2:29 PM
To: Wu, Jingjing <[email protected]>
Cc: [email protected]; [email protected]; Guo, Junfeng

<[email protected]>

Quoted 1 line

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

registering

Quoted 20 lines
Quoted 20 lines
Quoted 13 lines
Quoted 13 lines

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")
---
 drivers/raw/ntb/ntb.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
Quoted 5 lines

drivers/raw/ntb/ntb.c ntb_init_hw(struct rte_rawdev *dev,

Quoted 5 lines
drivers/raw/ntb/ntb.c +0 -0
index cc611dfbb9..0801e6d1ae 100644
@@ -1403,8 +1403,12 @@ ntb_init_hw(struct rte_rawdev *dev,

struct

Quoted 1 line

rte_pci_device

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

drivers/raw/ntb/ntb.c ntb_init_hw(struct rte_rawdev *dev, struct rte_pci_device *pci_dev)

Quoted 8 lines
drivers/raw/ntb/ntb.c +2 -2
 *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);

Quoted 10 lines
Quoted 10 lines
Quoted 6 lines

drivers/raw/ntb/ntb.c ntb_init_hw(struct rte_rawdev *dev, · line 1410

Quoted 2 lines
drivers/raw/ntb/ntb.c +2 -0
+	if (ret) {
+		NTB_LOG(ERR, "Unable to register doorbell intr

handler.");

drivers/raw/ntb/ntb.c ntb_init_hw(struct rte_rawdev *dev, struct rte_pci_device *pci_dev) · line 1411

Quoted 2 lines
drivers/raw/ntb/ntb.c +2 -0
+		return ret;
+	}

When will this register failure happen? Have you checked what is the

root

Quoted 1 line

cause?

When bind with vfio-pci, the DB interrupt callback function often

cannot

Quoted 2 lines
Quoted 2 lines

work as expected.
I think this is due to that, the intr callback registering not finished

before

Quoted 9 lines
Quoted 6 lines
Quoted 3 lines

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?

Thanks for the reminding!
Currently, we agreed that this fix is not for the root cause of no response of doorbell interrupt when building the connection between two NTB ports. So we decided to change the status to be superseded and do further investigation for NTB. Thanks for the reviewing!

Quoted 2 lines
#6 lore raw

08/03/2022 09:08, Guo, Junfeng:

Quoted 9 lines

From: Thomas Monjalon <[email protected]>

Quoted 2 lines

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

Thanks for the reminding!
Currently, we agreed that this fix is not for the root cause of no response of doorbell interrupt when building the connection between two NTB ports. So we decided to change the status to be superseded and do further investigation for NTB. Thanks for the reviewing!

In this case, it should not be superseded but rejected.

#7 lore raw
Quoted 17 lines

-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Tuesday, March 8, 2022 16:10
To: Wu, Jingjing <[email protected]>; Guo, Junfeng <[email protected]>
Cc: [email protected]; [email protected]
Subject: Re: [PATCH] raw/ntb: add check for DB intr handler registering

08/03/2022 09:08, Guo, Junfeng:

Quoted 6 lines

From: Thomas Monjalon <[email protected]>

Quoted 2 lines

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

Thanks for the reminding!
Currently, we agreed that this fix is not for the root cause of no

Quoted 8 lines

response of doorbell

Quoted 1 line

interrupt when building the connection between two NTB ports. So we

decided to

Quoted 2 lines

change the status to be superseded and do further investigation for NTB. Thanks for the reviewing!

In this case, it should not be superseded but rejected.

Sure, thanks for your comment!

Quoted 1 line