lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240614082758.6pSMV3aq@linutronix.de>
Date: Fri, 14 Jun 2024 10:27:58 +0200
From: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
	"David S. Miller" <davem@...emloft.net>,
	Daniel Bristot de Oliveira <bristot@...nel.org>,
	Boqun Feng <boqun.feng@...il.com>,
	Daniel Borkmann <daniel@...earbox.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Frederic Weisbecker <frederic@...nel.org>,
	Ingo Molnar <mingo@...hat.com>, Jakub Kicinski <kuba@...nel.org>,
	Paolo Abeni <pabeni@...hat.com>,
	Peter Zijlstra <peterz@...radead.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	Waiman Long <longman@...hat.com>, Will Deacon <will@...nel.org>,
	Ben Segall <bsegall@...gle.com>,
	Daniel Bristot de Oliveira <bristot@...hat.com>,
	Dietmar Eggemann <dietmar.eggemann@....com>,
	Juri Lelli <juri.lelli@...hat.com>, Mel Gorman <mgorman@...e.de>,
	Valentin Schneider <vschneid@...hat.com>,
	Vincent Guittot <vincent.guittot@...aro.org>
Subject: Re: [PATCH v6 net-next 08/15] net: softnet_data: Make xmit.recursion
 per task.

On 2024-06-12 13:18:29 [-0400], Steven Rostedt wrote:
> On Wed, 12 Jun 2024 18:44:34 +0200
> Sebastian Andrzej Siewior <bigeasy@...utronix.de> wrote:
> 
> > Softirq is preemptible on PREEMPT_RT. Without a per-CPU lock in
> > local_bh_disable() there is no guarantee that only one device is
> > transmitting at a time.
> > With preemption and multiple senders it is possible that the per-CPU
> > recursion counter gets incremented by different threads and exceeds
> > XMIT_RECURSION_LIMIT leading to a false positive recursion alert.
> > 
> > Instead of adding a lock to protect the per-CPU variable it is simpler
> > to make the counter per-task. Sending and receiving skbs happens always
> > in thread context anyway.
> > 
> > Having a lock to protected the per-CPU counter would block/ serialize two
> > sending threads needlessly. It would also require a recursive lock to
> > ensure that the owner can increment the counter further.
> > 
> > Make the recursion counter a task_struct member on PREEMPT_RT.
> 
> I'm curious to what would be the harm to using a per_task counter
> instead of per_cpu outside of PREEMPT_RT. That way, we wouldn't have to
> have the #ifdef.

There should be a hole on !RT, too so we shouldn't gain weight. The
limit is set to 8 so an u8 would be enough. The counter is only accessed
with BH-disabled so it will be used only in one context since it can't
schedule().

I think it should work fine. netdev folks, you want me to remove that
ifdef and use a per-Task counter unconditionally?

> -- Steve

Sebastian

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ