public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* i40e: Fix preempt count leak in napi poll tracepoint
@ 2026-02-07 10:50 Thomas Gleixner
  2026-02-09 22:07 ` Joe Damato
  2026-02-10  7:17 ` [Intel-wired-lan] " Loktionov, Aleksandr
  0 siblings, 2 replies; 6+ messages in thread
From: Thomas Gleixner @ 2026-02-07 10:50 UTC (permalink / raw)
  To: intel-wired-lan; +Cc: Tony Nguyen, Przemek Kitszel, netdev

Using get_cpu() in the tracepoint assignment causes an obvious preempt
count leak because nothing invokes put_cpu() to undo it:

  softirq: huh, entered softirq 3 NET_RX with preempt_count 00000100, exited with 00000101?

This clearly has seen a lot of testing in the last 3+ years...

Use smp_processor_id() instead.

Fixes: 6d4d584a7ea8 ("i40e: Add i40e_napi_poll tracepoint")
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Cc: Tony Nguyen <anthony.l.nguyen@intel.com>
Cc: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Cc: intel-wired-lan@lists.osuosl.org
Cc: netdev@vger.kernel.org
---
 drivers/net/ethernet/intel/i40e/i40e_trace.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/net/ethernet/intel/i40e/i40e_trace.h
+++ b/drivers/net/ethernet/intel/i40e/i40e_trace.h
@@ -88,7 +88,7 @@ TRACE_EVENT(i40e_napi_poll,
 		__entry->rx_clean_complete = rx_clean_complete;
 		__entry->tx_clean_complete = tx_clean_complete;
 		__entry->irq_num = q->irq_num;
-		__entry->curr_cpu = get_cpu();
+		__entry->curr_cpu = smp_processor_id();
 		__assign_str(qname);
 		__assign_str(dev_name);
 		__assign_bitmask(irq_affinity, cpumask_bits(&q->affinity_mask),

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: i40e: Fix preempt count leak in napi poll tracepoint
  2026-02-07 10:50 i40e: Fix preempt count leak in napi poll tracepoint Thomas Gleixner
@ 2026-02-09 22:07 ` Joe Damato
  2026-02-09 22:56   ` Thomas Gleixner
  2026-02-10  7:17 ` [Intel-wired-lan] " Loktionov, Aleksandr
  1 sibling, 1 reply; 6+ messages in thread
From: Joe Damato @ 2026-02-09 22:07 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: intel-wired-lan, Tony Nguyen, Przemek Kitszel, netdev

On Sat, Feb 07, 2026 at 11:50:23AM +0100, Thomas Gleixner wrote:
> Using get_cpu() in the tracepoint assignment causes an obvious preempt
> count leak because nothing invokes put_cpu() to undo it:
> 
>   softirq: huh, entered softirq 3 NET_RX with preempt_count 00000100, exited with 00000101?
> 
> This clearly has seen a lot of testing in the last 3+ years...

I'm the author who introduced the bug. FWIW, I did use it quite a bit when I
had i40e devices.
 
> Use smp_processor_id() instead.

Thanks.
 
> Fixes: 6d4d584a7ea8 ("i40e: Add i40e_napi_poll tracepoint")
> Signed-off-by: Thomas Gleixner <tglx@kernel.org>
> Cc: Tony Nguyen <anthony.l.nguyen@intel.com>
> Cc: Przemek Kitszel <przemyslaw.kitszel@intel.com>
> Cc: intel-wired-lan@lists.osuosl.org
> Cc: netdev@vger.kernel.org
> ---
>  drivers/net/ethernet/intel/i40e/i40e_trace.h |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> --- a/drivers/net/ethernet/intel/i40e/i40e_trace.h
> +++ b/drivers/net/ethernet/intel/i40e/i40e_trace.h
> @@ -88,7 +88,7 @@ TRACE_EVENT(i40e_napi_poll,
>  		__entry->rx_clean_complete = rx_clean_complete;
>  		__entry->tx_clean_complete = tx_clean_complete;
>  		__entry->irq_num = q->irq_num;
> -		__entry->curr_cpu = get_cpu();
> +		__entry->curr_cpu = smp_processor_id();
>  		__assign_str(qname);
>  		__assign_str(dev_name);
>  		__assign_bitmask(irq_affinity, cpumask_bits(&q->affinity_mask),
> 

Reviewed-by: Joe Damato <joe@dama.to>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: i40e: Fix preempt count leak in napi poll tracepoint
  2026-02-09 22:07 ` Joe Damato
@ 2026-02-09 22:56   ` Thomas Gleixner
  2026-02-10  0:25     ` Thomas Gleixner
  0 siblings, 1 reply; 6+ messages in thread
From: Thomas Gleixner @ 2026-02-09 22:56 UTC (permalink / raw)
  To: Joe Damato; +Cc: intel-wired-lan, Tony Nguyen, Przemek Kitszel, netdev

On Mon, Feb 09 2026 at 14:07, Joe Damato wrote:

> On Sat, Feb 07, 2026 at 11:50:23AM +0100, Thomas Gleixner wrote:
>> Using get_cpu() in the tracepoint assignment causes an obvious preempt
>> count leak because nothing invokes put_cpu() to undo it:
>> 
>>   softirq: huh, entered softirq 3 NET_RX with preempt_count 00000100, exited with 00000101?
>> 
>> This clearly has seen a lot of testing in the last 3+ years...
>
> I'm the author who introduced the bug. FWIW, I did use it quite a bit when I
> had i40e devices.

Right, but always with PREEMPT_NONE and no debug option which would
enforce PREEMPT_COUNT ...
  

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: i40e: Fix preempt count leak in napi poll tracepoint
  2026-02-09 22:56   ` Thomas Gleixner
@ 2026-02-10  0:25     ` Thomas Gleixner
  2026-02-10  2:58       ` Joe Damato
  0 siblings, 1 reply; 6+ messages in thread
From: Thomas Gleixner @ 2026-02-10  0:25 UTC (permalink / raw)
  To: Joe Damato; +Cc: intel-wired-lan, Tony Nguyen, Przemek Kitszel, netdev

On Mon, Feb 09 2026 at 23:56, Thomas Gleixner wrote:
> On Mon, Feb 09 2026 at 14:07, Joe Damato wrote:
>
>> On Sat, Feb 07, 2026 at 11:50:23AM +0100, Thomas Gleixner wrote:
>>> Using get_cpu() in the tracepoint assignment causes an obvious preempt
>>> count leak because nothing invokes put_cpu() to undo it:
>>> 
>>>   softirq: huh, entered softirq 3 NET_RX with preempt_count 00000100, exited with 00000101?
>>> 
>>> This clearly has seen a lot of testing in the last 3+ years...
>>
>> I'm the author who introduced the bug. FWIW, I did use it quite a bit when I
>> had i40e devices.
>
> Right, but always with PREEMPT_NONE and no debug option which would
> enforce PREEMPT_COUNT ...

Forgot to mention that's what is required before submitting patches
according to Documentation/process/submit-checklist.rst

But who cares about documentation aside of the people who write it?

Thanks,

        tglx


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: i40e: Fix preempt count leak in napi poll tracepoint
  2026-02-10  0:25     ` Thomas Gleixner
@ 2026-02-10  2:58       ` Joe Damato
  0 siblings, 0 replies; 6+ messages in thread
From: Joe Damato @ 2026-02-10  2:58 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: intel-wired-lan, Tony Nguyen, Przemek Kitszel, netdev

On Tue, Feb 10, 2026 at 01:25:11AM +0100, Thomas Gleixner wrote:
> On Mon, Feb 09 2026 at 23:56, Thomas Gleixner wrote:
> > On Mon, Feb 09 2026 at 14:07, Joe Damato wrote:
> >
> >> On Sat, Feb 07, 2026 at 11:50:23AM +0100, Thomas Gleixner wrote:
> >>> Using get_cpu() in the tracepoint assignment causes an obvious preempt
> >>> count leak because nothing invokes put_cpu() to undo it:
> >>> 
> >>>   softirq: huh, entered softirq 3 NET_RX with preempt_count 00000100, exited with 00000101?
> >>> 
> >>> This clearly has seen a lot of testing in the last 3+ years...
> >>
> >> I'm the author who introduced the bug. FWIW, I did use it quite a bit when I
> >> had i40e devices.
> >
> > Right, but always with PREEMPT_NONE and no debug option which would
> > enforce PREEMPT_COUNT ...
> 
> Forgot to mention that's what is required before submitting patches
> according to Documentation/process/submit-checklist.rst

This is a very helpful reply, thanks!

> But who cares about documentation aside of the people who write it?

I've written a lot of documentation, too, but sometimes people just make
mistakes.

- Joe

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [Intel-wired-lan] i40e: Fix preempt count leak in napi poll tracepoint
  2026-02-07 10:50 i40e: Fix preempt count leak in napi poll tracepoint Thomas Gleixner
  2026-02-09 22:07 ` Joe Damato
@ 2026-02-10  7:17 ` Loktionov, Aleksandr
  1 sibling, 0 replies; 6+ messages in thread
From: Loktionov, Aleksandr @ 2026-02-10  7:17 UTC (permalink / raw)
  To: Thomas Gleixner, intel-wired-lan@lists.osuosl.org
  Cc: Nguyen, Anthony L, Kitszel, Przemyslaw, netdev@vger.kernel.org



> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf
> Of Thomas Gleixner
> Sent: Saturday, February 7, 2026 11:50 AM
> To: intel-wired-lan@lists.osuosl.org
> Cc: Nguyen, Anthony L <anthony.l.nguyen@intel.com>; Kitszel,
> Przemyslaw <przemyslaw.kitszel@intel.com>; netdev@vger.kernel.org
> Subject: [Intel-wired-lan] i40e: Fix preempt count leak in napi poll
> tracepoint
> 
> Using get_cpu() in the tracepoint assignment causes an obvious preempt
> count leak because nothing invokes put_cpu() to undo it:
> 
>   softirq: huh, entered softirq 3 NET_RX with preempt_count 00000100,
> exited with 00000101?
> 
> This clearly has seen a lot of testing in the last 3+ years...
> 
> Use smp_processor_id() instead.
> 
> Fixes: 6d4d584a7ea8 ("i40e: Add i40e_napi_poll tracepoint")
> Signed-off-by: Thomas Gleixner <tglx@kernel.org>
> Cc: Tony Nguyen <anthony.l.nguyen@intel.com>
> Cc: Przemek Kitszel <przemyslaw.kitszel@intel.com>
> Cc: intel-wired-lan@lists.osuosl.org
> Cc: netdev@vger.kernel.org
> ---
>  drivers/net/ethernet/intel/i40e/i40e_trace.h |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> --- a/drivers/net/ethernet/intel/i40e/i40e_trace.h
> +++ b/drivers/net/ethernet/intel/i40e/i40e_trace.h
> @@ -88,7 +88,7 @@ TRACE_EVENT(i40e_napi_poll,
>  		__entry->rx_clean_complete = rx_clean_complete;
>  		__entry->tx_clean_complete = tx_clean_complete;
>  		__entry->irq_num = q->irq_num;
> -		__entry->curr_cpu = get_cpu();
> +		__entry->curr_cpu = smp_processor_id();
>  		__assign_str(qname);
>  		__assign_str(dev_name);
>  		__assign_bitmask(irq_affinity, cpumask_bits(&q-
> >affinity_mask),

Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-02-10  7:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-07 10:50 i40e: Fix preempt count leak in napi poll tracepoint Thomas Gleixner
2026-02-09 22:07 ` Joe Damato
2026-02-09 22:56   ` Thomas Gleixner
2026-02-10  0:25     ` Thomas Gleixner
2026-02-10  2:58       ` Joe Damato
2026-02-10  7:17 ` [Intel-wired-lan] " Loktionov, Aleksandr

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox