All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Manish Chopra <manishc@marvell.com>
Cc: Stephen Hemminger <stephen@networkplumber.org>,
	<netdev@vger.kernel.org>, <aelior@marvell.com>,
	<palok@marvell.com>, Sudarsana Kalluru <skalluru@marvell.com>,
	"David S . Miller" <davem@davemloft.net>
Subject: Re: [PATCH v3 net] qed/qede: Fix scheduling while atomic
Date: Tue, 2 May 2023 20:03:07 -0700	[thread overview]
Message-ID: <20230502200307.11bbe4ef@kernel.org> (raw)
In-Reply-To: <20230428102651.01215795@hermes.local>

On Fri, 28 Apr 2023 10:26:51 -0700 Stephen Hemminger wrote:
> On Fri, 28 Apr 2023 09:13:37 -0700
> Manish Chopra <manishc@marvell.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.

  reply	other threads:[~2023-05-03  3:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-28 16:13 [PATCH v3 net] qed/qede: Fix scheduling while atomic Manish Chopra
2023-04-28 17:26 ` Stephen Hemminger
2023-05-03  3:03   ` Jakub Kicinski [this message]
2023-05-17 20:10     ` [EXT] " Manish Chopra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230502200307.11bbe4ef@kernel.org \
    --to=kuba@kernel.org \
    --cc=aelior@marvell.com \
    --cc=davem@davemloft.net \
    --cc=manishc@marvell.com \
    --cc=netdev@vger.kernel.org \
    --cc=palok@marvell.com \
    --cc=skalluru@marvell.com \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.