From: Jan Beulich <jbeulich@suse.com>
To: Juergen Gross <jgross@suse.com>
Cc: "Andrew Cooper" <andrew.cooper3@citrix.com>,
"George Dunlap" <george.dunlap@citrix.com>,
"Roger Pau Monné" <roger.pau@citrix.com>, "Wei Liu" <wl@xen.org>,
"Julien Grall" <julien@xen.org>,
"Stefano Stabellini" <sstabellini@kernel.org>,
xen-devel@lists.xenproject.org
Subject: Re: [PATCH 2/2] xen/spinlock: merge recurse_cpu and debug.cpu fields in struct spinlock
Date: Fri, 25 Feb 2022 10:13:51 +0100 [thread overview]
Message-ID: <9761efc1-15c9-0d5d-95c3-217bb5054853@suse.com> (raw)
In-Reply-To: <05a26a5d-8597-84c6-171c-2751987b7836@suse.com>
On 25.02.2022 09:36, Juergen Gross wrote:
> On 24.02.22 17:11, Jan Beulich wrote:
>> On 24.02.2022 11:54, Juergen Gross wrote:
>>> --- a/xen/arch/x86/mm/mm-locks.h
>>> +++ b/xen/arch/x86/mm/mm-locks.h
>>> @@ -42,7 +42,7 @@ static inline void mm_lock_init(mm_lock_t *l)
>>>
>>> static inline bool mm_locked_by_me(const mm_lock_t *l)
>>> {
>>> - return (l->lock.recurse_cpu == current->processor);
>>> + return (l->lock.data.cpu == current->processor);
>>> }
>>
>> I see a fair risk with this: Behavior will now differ between debug and
>> non-debug builds. E.g. a livelock because of trying to acquire the same
>> lock again would not be noticed in a debug build if the acquire is
>> conditional upon this function's return value. I think this is the main
>> reason behind having two separate field, despite the apparent redundancy.
>
> You are aware that mm_locked_by_me() is used for recursive spinlocks
> only?
I will admit that it occurred to me only a while after writing the earlier
reply that it's used only with recursive locking, due to _mm_lock() indeed
using spin_lock_recursive() unconditionally (i.e. independent of its "rec"
parameter). Nevertheless I continue to have the vague recollection that
the duplication of the two fields was intentional and deemed necessary.
Jan
prev parent reply other threads:[~2022-02-25 9:14 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-24 10:54 [PATCH 0/2] xen/spinlock: cleanup struct spinlock Juergen Gross
2022-02-24 10:54 ` [PATCH 1/2] xen/spinlock: use lock address for lock debug functions Juergen Gross
2022-02-24 16:12 ` Jan Beulich
2022-02-25 8:47 ` Juergen Gross
2022-02-24 10:54 ` [PATCH 2/2] xen/spinlock: merge recurse_cpu and debug.cpu fields in struct spinlock Juergen Gross
2022-02-24 16:11 ` Jan Beulich
2022-02-25 8:36 ` Juergen Gross
2022-02-25 8:55 ` Juergen Gross
2022-02-25 9:24 ` Jan Beulich
2022-02-25 9:38 ` Juergen Gross
2022-02-25 9:13 ` Jan Beulich [this message]
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=9761efc1-15c9-0d5d-95c3-217bb5054853@suse.com \
--to=jbeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=george.dunlap@citrix.com \
--cc=jgross@suse.com \
--cc=julien@xen.org \
--cc=roger.pau@citrix.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.