examples/l3fwd-power: fix RX interrupt disable

Message ID 1568131814-48424-1-git-send-email-xiao.zhang@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series examples/l3fwd-power: fix RX interrupt disable |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-dpdk_compile success Compile Testing PASS
ci/iol-dpdk_compile_ovs success Compile Testing PASS
ci/intel-Performance success Performance Testing PASS
ci/mellanox-Performance success Performance Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-dpdk_compile_spdk success Compile Testing PASS

Commit Message

Xiao Zhang Sept. 10, 2019, 4:10 p.m. UTC
  Interrupt will not be received when disabling RX interrupt without
synchronization mechanism sometimes which leads to wake up issue,
add spinlock to fix it.

Fixes: b736d64787fc ("mples/l3fwd-power: disable Rx interrupt when
waking up")
Cc: stable@dpdk.org

Signed-off-by: Xiao Zhang <xiao.zhang@intel.com>
---
 examples/l3fwd-power/main.c | 2 ++
 1 file changed, 2 insertions(+)
  

Comments

Marvin Liu Sept. 20, 2019, 5:22 a.m. UTC | #1
> -----Original Message-----
> From: Zhang, Xiao
> Sent: Wednesday, September 11, 2019 12:10 AM
> To: dev@dpdk.org
> Cc: Liu, Yong <yong.liu@intel.com>; Zhang, Xiao <xiao.zhang@intel.com>;
> stable@dpdk.org
> Subject: examples/l3fwd-power: fix RX interrupt disable
> 
> Interrupt will not be received when disabling RX interrupt without
> synchronization mechanism sometimes which leads to wake up issue,
> add spinlock to fix it.
> 
> Fixes: b736d64787fc ("mples/l3fwd-power: disable Rx interrupt when
> waking up")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Xiao Zhang <xiao.zhang@intel.com>
> ---
>  examples/l3fwd-power/main.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
> index fd8d952..ff1ad37 100644
> --- a/examples/l3fwd-power/main.c
> +++ b/examples/l3fwd-power/main.c
> @@ -880,7 +880,9 @@ sleep_until_rx_interrupt(int num)
>  		port_id = ((uintptr_t)data) >> CHAR_BIT;
>  		queue_id = ((uintptr_t)data) &
>  			RTE_LEN2MASK(CHAR_BIT, uint8_t);
> +		rte_spinlock_lock(&(locks[port_id]));
>  		rte_eth_dev_rx_intr_disable(port_id, queue_id);
> +		rte_spinlock_unlock(&(locks[port_id]));
>  		RTE_LOG(INFO, L3FWD_POWER,
>  			"lcore %u is waked up from rx interrupt on"
>  			" port %d queue %d\n",
> --
> 2.7.4

Reviewed-by: Marvin Liu
<yong.liu@intel.com>

Regards,
Marvin
  
Thomas Monjalon Oct. 23, 2019, 2:32 p.m. UTC | #2
+Cc Dave, the maintainer

> > Interrupt will not be received when disabling RX interrupt without
> > synchronization mechanism sometimes which leads to wake up issue,
> > add spinlock to fix it.
> > 
> > Fixes: b736d64787fc ("mples/l3fwd-power: disable Rx interrupt when
> > waking up")
> > Cc: stable@dpdk.org
> > 
> > Signed-off-by: Xiao Zhang <xiao.zhang@intel.com>
> > ---
> >  examples/l3fwd-power/main.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
> > index fd8d952..ff1ad37 100644
> > --- a/examples/l3fwd-power/main.c
> > +++ b/examples/l3fwd-power/main.c
> > @@ -880,7 +880,9 @@ sleep_until_rx_interrupt(int num)
> >  		port_id = ((uintptr_t)data) >> CHAR_BIT;
> >  		queue_id = ((uintptr_t)data) &
> >  			RTE_LEN2MASK(CHAR_BIT, uint8_t);
> > +		rte_spinlock_lock(&(locks[port_id]));
> >  		rte_eth_dev_rx_intr_disable(port_id, queue_id);
> > +		rte_spinlock_unlock(&(locks[port_id]));
> >  		RTE_LOG(INFO, L3FWD_POWER,
> >  			"lcore %u is waked up from rx interrupt on"
> >  			" port %d queue %d\n",
> > --
> > 2.7.4
> 
> Reviewed-by: Marvin Liu <yong.liu@intel.com>
  
Hunt, David Oct. 24, 2019, 8:07 a.m. UTC | #3
On 23/10/2019 15:32, Thomas Monjalon wrote:
> +Cc Dave, the maintainer
>
>>> Interrupt will not be received when disabling RX interrupt without
>>> synchronization mechanism sometimes which leads to wake up issue,
>>> add spinlock to fix it.
>>>
>>> Fixes: b736d64787fc ("mples/l3fwd-power: disable Rx interrupt when
>>> waking up")
>>> Cc: stable@dpdk.org
>>>
>>> Signed-off-by: Xiao Zhang <xiao.zhang@intel.com>
>>> ---
>>>   examples/l3fwd-power/main.c | 2 ++
>>>   1 file changed, 2 insertions(+)
>>>
>>> diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
>>> index fd8d952..ff1ad37 100644
>>> --- a/examples/l3fwd-power/main.c
>>> +++ b/examples/l3fwd-power/main.c
>>> @@ -880,7 +880,9 @@ sleep_until_rx_interrupt(int num)
>>>   		port_id = ((uintptr_t)data) >> CHAR_BIT;
>>>   		queue_id = ((uintptr_t)data) &
>>>   			RTE_LEN2MASK(CHAR_BIT, uint8_t);
>>> +		rte_spinlock_lock(&(locks[port_id]));
>>>   		rte_eth_dev_rx_intr_disable(port_id, queue_id);
>>> +		rte_spinlock_unlock(&(locks[port_id]));
>>>   		RTE_LOG(INFO, L3FWD_POWER,
>>>   			"lcore %u is waked up from rx interrupt on"
>>>   			" port %d queue %d\n",
>>> --
>>> 2.7.4
>> Reviewed-by: Marvin Liu <yong.liu@intel.com>


Hi Marvin,
This makes sense, as the corresponding rte_eth_dev_rx_intr_enable() 
already has a spinlock around it.

Acked-by: David Hunt <david.hunt@intel.com>
  
Thomas Monjalon Oct. 27, 2019, 5:39 p.m. UTC | #4
24/10/2019 10:07, Hunt, David:
> 
> On 23/10/2019 15:32, Thomas Monjalon wrote:
> > +Cc Dave, the maintainer
> >
> >>> Interrupt will not be received when disabling RX interrupt without
> >>> synchronization mechanism sometimes which leads to wake up issue,
> >>> add spinlock to fix it.
> >>>
> >>> Fixes: b736d64787fc ("mples/l3fwd-power: disable Rx interrupt when
> >>> waking up")
> >>> Cc: stable@dpdk.org
> >>>
> >>> Signed-off-by: Xiao Zhang <xiao.zhang@intel.com>
> >> Reviewed-by: Marvin Liu <yong.liu@intel.com>
> 
> This makes sense, as the corresponding rte_eth_dev_rx_intr_enable() 
> already has a spinlock around it.
> 
> Acked-by: David Hunt <david.hunt@intel.com>

Applied, thanks
  

Patch

diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
index fd8d952..ff1ad37 100644
--- a/examples/l3fwd-power/main.c
+++ b/examples/l3fwd-power/main.c
@@ -880,7 +880,9 @@  sleep_until_rx_interrupt(int num)
 		port_id = ((uintptr_t)data) >> CHAR_BIT;
 		queue_id = ((uintptr_t)data) &
 			RTE_LEN2MASK(CHAR_BIT, uint8_t);
+		rte_spinlock_lock(&(locks[port_id]));
 		rte_eth_dev_rx_intr_disable(port_id, queue_id);
+		rte_spinlock_unlock(&(locks[port_id]));
 		RTE_LOG(INFO, L3FWD_POWER,
 			"lcore %u is waked up from rx interrupt on"
 			" port %d queue %d\n",