From: David Vrabel <david.vrabel@citrix.com>
To: Jan Beulich <JBeulich@suse.com>,
xen-devel <xen-devel@lists.xenproject.org>
Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>,
Keir Fraser <keir@xen.org>, Tim Deegan <tim@xen.org>
Subject: Re: [PATCH] spinlock: improve spin_is_locked() for recursive locks
Date: Thu, 24 Mar 2016 15:55:09 +0000 [thread overview]
Message-ID: <56F40DDD.9020303@citrix.com> (raw)
In-Reply-To: <56F3DDF402000078000E008B@prv-mh.provo.novell.com>
On 24/03/16 11:30, Jan Beulich wrote:
> Recursive locks know their current owner, and since we use the function
> solely to determine whether a particular lock is being held by the
> current CPU (which so far has been an imprecise check), make actually
> check the owner for recusrively acquired locks.
What's the expected behaviour of _spin_is_locked() if the lock is held
by another CPU?
Before it may return true if it is held by another CPU, now it will
always return false in this case.
David
> --- a/xen/common/spinlock.c
> +++ b/xen/common/spinlock.c
> @@ -188,7 +188,9 @@ void _spin_unlock_irqrestore(spinlock_t
> int _spin_is_locked(spinlock_t *lock)
> {
> check_lock(&lock->debug);
> - return lock->tickets.head != lock->tickets.tail;
> + return lock->recurse_cpu == SPINLOCK_NO_CPU
> + ? lock->tickets.head != lock->tickets.tail
> + : lock->recurse_cpu == smp_processor_id();
> }
>
> int _spin_trylock(spinlock_t *lock)
>
>
>
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-03-24 15:55 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-24 11:30 [PATCH] spinlock: improve spin_is_locked() for recursive locks Jan Beulich
2016-03-24 14:19 ` Dario Faggioli
2016-03-24 14:38 ` Andrew Cooper
2016-03-24 15:55 ` David Vrabel [this message]
2016-03-24 16:19 ` Jan Beulich
2016-03-29 10:36 ` George Dunlap
2016-03-29 10:45 ` Jan Beulich
2016-03-25 10:19 ` Xu, Quan
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=56F40DDD.9020303@citrix.com \
--to=david.vrabel@citrix.com \
--cc=Ian.Jackson@eu.citrix.com \
--cc=JBeulich@suse.com \
--cc=keir@xen.org \
--cc=tim@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).