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: Fri, 12 Jul 2013 14:37:49 +0100 [thread overview]
Message-ID: <CE05C53D.580A3%keir.xen@gmail.com> (raw)
In-Reply-To: <51E0163402000078000E4767@nat28.tlf.novell.com>
On 12/07/2013 13:44, "Jan Beulich" <JBeulich@suse.com> wrote:
>>>> On 12.07.13 at 14:15, Keir Fraser <keir.xen@gmail.com> wrote:
>> On 12/07/2013 09:17, "Jan Beulich" <JBeulich@suse.com> wrote:
>>
>>> While boot time calls don't need this, run time uses of the function
>>> which may result in L2 page tables getting populated need to be
>>> serialized to avoid two CPUs populating the same L2 (or L3) entry,
>>> overwriting each other's results.
>>>
>>> This fixes what would seem to be a regression from commit b0581b92
>>> ("x86: make map_domain_page_global() a simple wrapper around vmap()"),
>>> albeit that change only made more readily visible the already existing
>>> issue.
>>>
>>> The __init addition to memguard_init(), while seemingly unrelated,
>>> helps making obvious that this function's use of map_pages_to_xen() is
>>> a boot time only one.
>>
>> Why can't the locking be implemented inside map_pages_to_xen()? The
>> requirement is due to implementation details of that function after all.
>> Pushing the synchronisation out to the callers is uglier and more fragile.
>
> Not all use cases of the function require synchronization, so the
> only kind of synchronization I would see validly adding there
> instead of in the callers would be a mechanism marking a to-be-
> populated non-leaf page table entry as "being processed" first,
> and have racing invocations spin until that state clears. Afaict
> that wouldn't cope with eventual (future) races through
> destroy_xen_mappings() though, and hence I think the proposed
> patch is the better alternative. But if you're fine with ignoring
> that last aspect, I'm okay with going the alternative route.
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?
> Jan
>
next prev parent reply other threads:[~2013-07-12 13:37 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 [this message]
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
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=CE05C53D.580A3%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).