From: Keir Fraser <keir.xen@gmail.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
xen-devel <xen-devel@lists.xen.org>
Subject: Re: [PATCH v2] add locking around certain calls to map_pages_to_xen()
Date: Mon, 15 Jul 2013 09:36:11 +0100 [thread overview]
Message-ID: <CE09730B.2D676%keir.xen@gmail.com> (raw)
In-Reply-To: <51E3CDD902000078000E4D78@nat28.tlf.novell.com>
On 15/07/2013 09:24, "Jan Beulich" <JBeulich@suse.com> wrote:
>>>> On 12.07.13 at 16:30, "Jan Beulich" <JBeulich@suse.com> wrote:
>>>>> On 12.07.13 at 16:01, Keir Fraser <keir.xen@gmail.com> wrote:
>>> On 12/07/2013 14:41, "Jan Beulich" <JBeulich@suse.com> wrote:
>>>
>>>>> Is it unsafe to just stick a lock around the guts of map_pages_to_xen(),
>>>>> or
>>>>> at least the parts that add new page tables?
>>>>
>>>> I'm not certain about the safety of this, but clearly two CPUs
>>>> changing entirely different parts of the address space don't need
>>>> to lock out one another, so I rather view adding a global lock here
>>>> as being (potentially) harmful in terms of performance (and hence
>>>> the thought of locking at page table entry granularity instead).
>>>
>>> Ah, I see. Well, locking only on changes to page-directory entries wouldn't
>>> be too bad, even if it were a single global lock? That would be a rare
>>> occurrence. It's reasonable to assume that callers will not conflict on the
>>> page-aligned regions they modify, so this would suffice?
>>
>> Well, okay, I'll do it that way then. Are you okay with skipping the
>> locking during boot, just as done in __set_fixmap() in the current
>> version of the patch?
Yes.
> Further to this, there's a worrying comment prior to
> map_pages_to_xen(): "map_pages_to_xen() can be called with
> interrupts disabled:
> * During early bootstrap; or
> * alloc_xenheap_pages() via memguard_guard_range"
>
> The former would be taken care of by only doing any locking
> post-boot, but the latter would also require to skip the locking
> when interrupts are disabled. Yet I wonder whether that part
> of the comment isn't stale - alloc_xenheap_pages() surely
> shouldn't be called with interrupts disabled? (I didn't get to
> try yet whether check_lock() would trigger on any such path.)
Agreed it must be stale!
-- Keir
> Jan
>
prev parent reply other threads:[~2013-07-15 8:36 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-11 11:30 [PATCH] add locking around certain calls to map_pages_to_xen() Jan Beulich
2013-07-11 11:37 ` Andrew Cooper
2013-07-11 11:56 ` Jan Beulich
2013-07-12 8:17 ` [PATCH v2] " Jan Beulich
2013-07-12 9:48 ` Andrew Cooper
2013-07-12 12:15 ` Keir Fraser
2013-07-12 12:44 ` Jan Beulich
2013-07-12 13:37 ` Keir Fraser
2013-07-12 13:41 ` Jan Beulich
2013-07-12 14:01 ` Keir Fraser
2013-07-12 14:30 ` Jan Beulich
2013-07-15 8:24 ` Jan Beulich
2013-07-15 8:36 ` Keir Fraser [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=CE09730B.2D676%keir.xen@gmail.com \
--to=keir.xen@gmail.com \
--cc=JBeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=xen-devel@lists.xen.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).