From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Andy Lutomirski <luto@kernel.org>, Brian Gerst <brgerst@gmail.com>
Cc: X86 ML <x86@kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Ingo Molnar <mingo@kernel.org>, "H . Peter Anvin" <hpa@zytor.com>,
Juergen Gross <jgross@suse.com>,
Boris Ostrovsky <boris.ostrovsky@oracle.com>
Subject: Re: [PATCH 3/3] x86/xen: Move paravirt IOPL switching to slow the path
Date: Wed, 14 Jun 2017 19:02:21 +0100 [thread overview]
Message-ID: <8f1ceb4d-72ba-db57-c468-5059c0227b6b@citrix.com> (raw)
In-Reply-To: <CALCETrXa9vW6yr8tDYE4fR1V61xMOc0W=Zbi5h-2PW-Od61X8Q@mail.gmail.com>
On 14/06/17 18:40, Andy Lutomirski wrote:
> On Wed, Jun 14, 2017 at 5:40 AM, Brian Gerst <brgerst@gmail.com> wrote:
>> Since tasks using IOPL are very rare, move the switching code to the slow
>> path for lower impact on normal tasks.
> I think that Andrew Cooper added a vmassist that we could opt in to
> that makes Xen PV IOPL switching work more or less just like native.
> We could maybe opt in to that and avoid needing this stuff at all on
> newer hypervisors.
Indeed.
HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_architectural_iopl);
(if recognised) does two things.
1) virtual IOPL is picked up from EFLAGS in the iret frame, exactly like
native.
2) The guest kernel is assumed to have virtual CPL0 for the purpose of
privilege calculations.
Xen never runs with the real IOPL different to 0, or a PV guests could
disable interrupts with popf. As a result, all IO port access does trap
to Xen for auditing. What part 2) does is avoid having the awkward
double-step of Linux needing to set IOPL to 1 for kernel level IO access
to avoid faulting.
The assist should be available in Xen 4.7 and later (or wherever vendors
have backported it to).
~Andrew
next prev parent reply other threads:[~2017-06-14 18:05 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-14 12:40 [PATCH 0/3] x86: IOPL switching cleanups Brian Gerst
2017-06-14 12:40 ` [PATCH 1/3] x86: Remove native_set_iopl_mask() Brian Gerst
2017-06-14 12:40 ` [PATCH 2/3] x86-32: Simplify IOPL switch check Brian Gerst
2017-06-14 12:40 ` [PATCH 3/3] x86/xen: Move paravirt IOPL switching to slow the path Brian Gerst
2017-06-14 13:14 ` Juergen Gross
2017-06-14 17:29 ` Brian Gerst
2017-06-14 17:34 ` Juergen Gross
2017-06-14 17:40 ` Andy Lutomirski
2017-06-14 18:02 ` Andrew Cooper [this message]
2017-06-14 18:25 ` Brian Gerst
2017-06-15 1:34 ` Andy Lutomirski
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=8f1ceb4d-72ba-db57-c468-5059c0227b6b@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=boris.ostrovsky@oracle.com \
--cc=brgerst@gmail.com \
--cc=hpa@zytor.com \
--cc=jgross@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@kernel.org \
--cc=x86@kernel.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
all inboxes | Powered by JetHome®