From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: George Dunlap <george.dunlap@eu.citrix.com>,
Huaitong Han <huaitong.han@intel.com>, Tim Deegan <tim@xen.org>,
Xen-devel List <xen-devel@lists.xen.org>
Subject: Re: Xen PV PTE ABI (or lack thereof)
Date: Thu, 21 Jan 2016 11:16:02 +0000 [thread overview]
Message-ID: <56A0BDF2.8030308@citrix.com> (raw)
In-Reply-To: <56A0CA0902000078000C9899@prv-mh.provo.novell.com>
On 21/01/16 11:07, Jan Beulich wrote:
>>>> On 20.01.16 at 21:10, <andrew.cooper3@citrix.com> wrote:
>> First of all, SMEP and SMAP. 32bit PV guests are subject to Xen's
>> SMEP/SMAP choices, because of running in ring 1.
>>
>> SMAP in particular is problematic because older Linux guests do fall
>> foul of it; they don't understand what a SMAP pagefault is, and enter an
>> infinite loop of pagefaults. SMEP is also problematic because it breaks
>> any guest wishing to use a shared address space between kernel and
>> user. (I had some fun getting the test framework to function until I
>> twigged what was happening).
>>
>> Both of these are regressions; older guests relying on existing
>> behaviour cease to function on newer hardware/Xen despite identical
>> settings.
> And for both of them there simply should be a way for the guest to
> state whether it's compatible (which should be the case for anything
> we can't deal with completely transparently to guests).
>
>> For the PTE bits, _PAGE_GNTTAB (bit 62) is used exclusively in debug
>> build (so there is a guest observable difference between running on a
>> debug and a non-debug Xen), and the comment beside it even identifies
>> that it breaks BSD guests. PTE bits 62:59 used by hardware if CR4.PKE
>> is set. Currently this means that we are not able to support Protection
>> Key for PV guests (although this restriction technically only applies to
>> debug builds of the hypervisor).
>>
>> The other PTE bit used by Xen is _PAGE_GUEST_KERNEL (bit 52). This bit
>> is used to notice when a 64bit PV guest attempts to override the fixup
>> Xen applies to its PTEs. Xen unilaterally sets _PAGE_GLOBAL for user
>> pages, and clears _PAGE_GLOBAL for supervisor mappings, setting
>> _PAGE_USER in both cases as the PV kernel runs in ring3. The only thing
>> _PAGE_GUEST_KERNEL is used for is to notice when the kernel deliberately
>> tries to create a _PAGE_GUEST_KERNEL|_PAGE_GLOBAL, at which point a
>> warning is logged and the kernel overridden.
>>
>>
>> Neither of the used PTE bits exist in the Xen public ABI. Neither of
>> them serve a purpose other than a debugging aid.
>>
>> I propose hiding them behind CONFIG_PV_PTE_DEBUG and declaring an ABI of
>> "all bits available for guest use".
> And a kernel using any of the conflicting bits would then become
> unusable on a hypervisor with that debug option enabled? I'd
> rather see us document the state things are in...
_PAGE_GNTMAP is already states:
/*
* Debug option: Ensure that granted mappings are not implicitly unmapped.
* WARNING: This will need to be disabled to run OSes that use the spare PTE
* bits themselves (e.g., *BSD).
*/
I was intending to have CONFIG_PV_PTE_DEBUG as an EXPERT option,
disabled by default even in debug builds.
There should not be an ABI difference between release and "normal" debug
builds.
~Andrew
next prev parent reply other threads:[~2016-01-21 11:16 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-20 20:10 Xen PV PTE ABI (or lack thereof) Andrew Cooper
2016-01-21 11:07 ` Jan Beulich
2016-01-21 11:16 ` Andrew Cooper [this message]
2016-01-21 12:59 ` Jan Beulich
2016-01-21 13:17 ` Andrew Cooper
2016-01-21 13:55 ` Jan Beulich
2016-01-21 15:10 ` Andrew Cooper
2016-01-21 14:29 ` David Vrabel
2016-01-21 14:37 ` Andrew Cooper
2016-01-21 14:53 ` David Vrabel
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=56A0BDF2.8030308@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=JBeulich@suse.com \
--cc=george.dunlap@eu.citrix.com \
--cc=huaitong.han@intel.com \
--cc=tim@xen.org \
--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).