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: <20230502200307.11bbe4ef@kernel.org>
Date: Tue, 2 May 2023 20:03:07 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Manish Chopra <manishc@...vell.com>
Cc: Stephen Hemminger <stephen@...workplumber.org>,
 <netdev@...r.kernel.org>, <aelior@...vell.com>, <palok@...vell.com>,
 Sudarsana Kalluru <skalluru@...vell.com>, "David S . Miller"
 <davem@...emloft.net>
Subject: Re: [PATCH v3 net] qed/qede: Fix scheduling while atomic

On Fri, 28 Apr 2023 10:26:51 -0700 Stephen Hemminger wrote:
> On Fri, 28 Apr 2023 09:13:37 -0700
> Manish Chopra <manishc@...vell.com> wrote:
> 
> > -		usleep_range(1000, 2000);
> > +
> > +		if (is_atomic)
> > +			udelay(QED_BAR_ACQUIRE_TIMEOUT_UDELAY);
> > +		else
> > +			usleep_range(QED_BAR_ACQUIRE_TIMEOUT_USLEEP,
> > +				     QED_BAR_ACQUIRE_TIMEOUT_USLEEP * 2);
> >  	}  
> 
> This is a variant of the conditional locking which is an ugly design pattern.
> It makes static checking tools break and
> a source of more bugs.
> 
> Better to fix the infrastructure or caller to not spin, or have two different
> functions.

FWIW the most common way to solve this issue is using a delayed work
which reads out the stats periodically from a non-atomic context, and
return a stashed copy from get_stat64.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ