All of lore.kernel.org
 help / color / mirror / Atom feed
From: Keith Busch <kbusch@kernel.org>
To: Sean Christopherson <seanjc@google.com>
Cc: Lei Yang <leiyang@redhat.com>, Keith Busch <kbusch@meta.com>,
	pbonzini@redhat.com, kvm@vger.kernel.org,
	virtualization@lists.linux.dev, x86@kernel.org,
	netdev@vger.kernel.org
Subject: Re: [PATCHv3 0/2]
Date: Fri, 28 Feb 2025 08:36:34 -0700	[thread overview]
Message-ID: <Z8HYAtCxKD8-tfAP@kbusch-mbp> (raw)
In-Reply-To: <Z8HWab5J5O29xsJj@google.com>

On Fri, Feb 28, 2025 at 07:29:45AM -0800, Sean Christopherson wrote:
> On Fri, Feb 28, 2025, Keith Busch wrote:
> > On Fri, Feb 28, 2025 at 06:32:47AM -0800, Sean Christopherson wrote:
> > > > @@ -35,10 +35,12 @@ static inline int call_once(struct once *once, int (*cb)(struct once *))
> > > >                 return 0;
> > > >  
> > > >          guard(mutex)(&once->lock);
> > > > -        WARN_ON(atomic_read(&once->state) == ONCE_RUNNING);
> > > > -        if (atomic_read(&once->state) != ONCE_NOT_STARTED)
> > > > +        if (WARN_ON(atomic_read(&once->state) == ONCE_RUNNING))
> > > >                  return -EINVAL;
> > > >  
> > > > +        if (atomic_read(&once->state) == ONCE_COMPLETED)
> > > > +                return 0;
> > > > +
> > > >          atomic_set(&once->state, ONCE_RUNNING);
> > > >         r = cb(once);
> > > >         if (r)
> > 
> > Possible suggestion since it seems odd to do an atomic_read twice on the
> > same value.
> 
> Yeah, good call.  At the risk of getting too cute, how about this?

Sure, that also looks good to me.

  reply	other threads:[~2025-02-28 15:36 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-27 23:06 [PATCHv3 0/2] Keith Busch
2025-02-27 23:06 ` [PATCHv3 1/2] vhost: return task creation error instead of NULL Keith Busch
2025-02-28 18:34   ` Mike Christie
2025-02-27 23:06 ` [PATCHv3 2/2] kvm: retry nx_huge_page_recovery_thread creation Keith Busch
2025-03-04 15:59   ` Simon Horman
2025-03-04 16:07     ` Keith Busch
2025-05-01 15:12       ` Frederick Lawler
2025-02-28  8:07 ` [PATCHv3 0/2] Lei Yang
2025-02-28 14:15   ` Sean Christopherson
2025-02-28 14:32     ` Sean Christopherson
2025-02-28 14:58       ` Keith Busch
2025-02-28 15:29         ` Sean Christopherson
2025-02-28 15:36           ` Keith Busch [this message]
2025-02-28 16:43             ` Paolo Bonzini
2025-02-28 17:03               ` Sean Christopherson
2025-07-08 22:17               ` Keith Busch

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=Z8HYAtCxKD8-tfAP@kbusch-mbp \
    --to=kbusch@kernel.org \
    --cc=kbusch@meta.com \
    --cc=kvm@vger.kernel.org \
    --cc=leiyang@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=seanjc@google.com \
    --cc=virtualization@lists.linux.dev \
    --cc=x86@kernel.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.