All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Julien Grall <julien@xen.org>
Cc: "Jürgen Groß" <jgross@suse.com>,
	"Stefano Stabellini" <sstabellini@kernel.org>,
	"Wei Liu" <wl@xen.org>,
	"Konrad Rzeszutek Wilk" <konrad.wilk@oracle.com>,
	"George Dunlap" <George.Dunlap@eu.citrix.com>,
	"Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Ian Jackson" <ian.jackson@eu.citrix.com>,
	"Jan Beulich" <jbeulich@suse.com>,
	xen-devel@lists.xenproject.org
Subject: Re: [Xen-devel] [PATCH v2] rwlock: allow recursive read locking when already locked in write mode
Date: Fri, 21 Feb 2020 15:59:12 +0100	[thread overview]
Message-ID: <20200221145912.GE4679@Air-de-Roger> (raw)
In-Reply-To: <270e3f03-a1e8-1cf8-af82-e7fed515985a@xen.org>

On Fri, Feb 21, 2020 at 02:56:20PM +0000, Julien Grall wrote:
> 
> 
> On 21/02/2020 14:49, Roger Pau Monné wrote:
> > On Fri, Feb 21, 2020 at 03:41:59PM +0100, Jan Beulich wrote:
> > > Because you need to invoke smp_processor_id() to calculate the value
> > > to use in the subtraction. I'm not meaning to say I'm entirely
> > > opposed (seeing how much of a discussion we're having), but the
> > > "simple write of zero" approach is certainly appealing.
> > 
> > Well, we could avoid the smp_processor_id() call and instead use:
> > 
> > atomic_sub(atomic_read(&lock->cnts) & 0xffff, &lock->cnts);
> 
> AFAICT, this would not be safe because the top 16-bit may change behind your
> back (via a read_lock).

Why not? We don't touch the top 16bits in any way, the subtraction
only affects the low 16bits and is done in an atomic manner.

Thanks, Roger.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2020-02-21 14:59 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-20 17:31 [Xen-devel] [PATCH v2] rwlock: allow recursive read locking when already locked in write mode Roger Pau Monne
2020-02-20 19:20 ` Julien Grall
2020-02-21  9:10   ` Roger Pau Monné
2020-02-21 12:42     ` Julien Grall
2020-02-21 13:36     ` Jan Beulich
2020-02-21 13:46       ` Jürgen Groß
2020-02-21 13:49         ` Julien Grall
2020-02-21 14:06           ` Jürgen Groß
2020-02-21 14:11             ` Julien Grall
2020-02-21 14:16               ` Jürgen Groß
2020-02-21 14:17                 ` Jan Beulich
2020-02-21 14:24                   ` Jürgen Groß
2020-02-21 14:37                     ` Jan Beulich
2020-02-21 14:32                 ` Julien Grall
2020-02-21 14:35                   ` Jürgen Groß
2020-02-21 14:51                     ` Julien Grall
2020-02-21 15:13                       ` Jürgen Groß
2020-02-21 15:17                         ` Jan Beulich
2020-02-21 15:23                           ` Jürgen Groß
2020-02-21 15:27                             ` Jan Beulich
2020-02-21 15:33                               ` Jürgen Groß
2020-02-21 14:16             ` Jan Beulich
2020-02-21 14:19               ` Jürgen Groß
2020-02-21 14:50                 ` Jan Beulich
2020-02-21 14:06         ` Jan Beulich
2020-02-21 14:26       ` Roger Pau Monné
2020-02-21 14:32         ` Roger Pau Monné
2020-02-21 14:41         ` Jan Beulich
2020-02-21 14:49           ` Roger Pau Monné
2020-02-21 14:52             ` Jan Beulich
2020-02-21 14:58               ` Roger Pau Monné
2020-02-21 15:15                 ` Jan Beulich
2020-02-21 16:22                   ` Roger Pau Monné
2020-02-21 14:56             ` Julien Grall
2020-02-21 14:59               ` Roger Pau Monné [this message]
2020-02-21 15:02                 ` Julien Grall
2020-02-21 15:11               ` Jan Beulich

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=20200221145912.GE4679@Air-de-Roger \
    --to=roger.pau@citrix.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jbeulich@suse.com \
    --cc=jgross@suse.com \
    --cc=julien@xen.org \
    --cc=konrad.wilk@oracle.com \
    --cc=sstabellini@kernel.org \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.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.