From: Brian Gerst <brgerst@gmail.com>
To: x86@kernel.org, linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@kernel.org>, "H . Peter Anvin" <hpa@zytor.com>,
Andy Lutomirski <luto@amacapital.net>,
Juergen Gross <jgross@suse.com>,
Boris Ostrovsky <boris.ostrovsky@oracle.com>
Subject: [PATCH 2/3] x86-32: Simplify IOPL switch check
Date: Wed, 14 Jun 2017 08:40:31 -0400 [thread overview]
Message-ID: <20170614124032.4159-3-brgerst@gmail.com> (raw)
In-Reply-To: <20170614124032.4159-1-brgerst@gmail.com>
Remove the get_kernel_rpl() call from the test for switching IOPL. Instead
make set_iopl_mask() a no-op when Xen is running in supervisor mode.
Signed-off-by: Brian Gerst <brgerst@gmail.com>
---
arch/x86/kernel/process_32.c | 2 +-
arch/x86/xen/enlighten_pv.c | 4 +++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
index ffeae81..b2d1f7c 100644
--- a/arch/x86/kernel/process_32.c
+++ b/arch/x86/kernel/process_32.c
@@ -263,7 +263,7 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
* is running virtualized at a non-zero CPL, the popf will
* not restore flags, so it must be done in a separate step.
*/
- if (get_kernel_rpl() && unlikely(prev->iopl != next->iopl))
+ if (unlikely(prev->iopl != next->iopl))
set_iopl_mask(next->iopl);
/*
diff --git a/arch/x86/xen/enlighten_pv.c b/arch/x86/xen/enlighten_pv.c
index f33eef4..05257c0 100644
--- a/arch/x86/xen/enlighten_pv.c
+++ b/arch/x86/xen/enlighten_pv.c
@@ -1350,8 +1350,10 @@ asmlinkage __visible void __init xen_start_kernel(void)
#ifdef CONFIG_X86_32
pv_info.kernel_rpl = 1;
- if (xen_feature(XENFEAT_supervisor_mode_kernel))
+ if (xen_feature(XENFEAT_supervisor_mode_kernel)) {
pv_info.kernel_rpl = 0;
+ pv_cpu_ops.set_iopl_mask = paravirt_nop;
+ }
#else
pv_info.kernel_rpl = 0;
#endif
--
2.9.4
next prev parent reply other threads:[~2017-06-14 12:46 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 ` Brian Gerst [this message]
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
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=20170614124032.4159-3-brgerst@gmail.com \
--to=brgerst@gmail.com \
--cc=boris.ostrovsky@oracle.com \
--cc=hpa@zytor.com \
--cc=jgross@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@amacapital.net \
--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