From: Peter Zijlstra <peterz@infradead.org>
To: x86@kernel.org, Joan Bruguera <joanbrugueram@gmail.com>
Cc: linux-kernel@vger.kernel.org, peterz@infradead.org,
Juergen Gross <jgross@suse.com>,
"Rafael J. Wysocki" <rafael@kernel.org>,
xen-devel <xen-devel@lists.xenproject.org>,
Jan Beulich <jbeulich@suse.com>,
Roger Pau Monne <roger.pau@citrix.com>,
Kees Cook <keescook@chromium.org>,
mark.rutland@arm.com
Subject: [RFC][PATCH 1/6] x86/power: De-paravirt restore_processor_state()
Date: Thu, 12 Jan 2023 15:31:42 +0100 [thread overview]
Message-ID: <20230112143825.584639584@infradead.org> (raw)
In-Reply-To: <20230112143141.645645775@infradead.org>
Since Xen PV doesn't use restore_processor_state(), and we're going to
have to avoid CALL/RET until at least GS is restored, de-paravirt the
easy bits.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
arch/x86/power/cpu.c | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
--- a/arch/x86/power/cpu.c
+++ b/arch/x86/power/cpu.c
@@ -197,25 +197,25 @@ static void notrace __restore_processor_
struct cpuinfo_x86 *c;
if (ctxt->misc_enable_saved)
- wrmsrl(MSR_IA32_MISC_ENABLE, ctxt->misc_enable);
+ native_wrmsrl(MSR_IA32_MISC_ENABLE, ctxt->misc_enable);
/*
* control registers
*/
/* cr4 was introduced in the Pentium CPU */
#ifdef CONFIG_X86_32
if (ctxt->cr4)
- __write_cr4(ctxt->cr4);
+ native_write_cr4(ctxt->cr4);
#else
/* CONFIG X86_64 */
- wrmsrl(MSR_EFER, ctxt->efer);
- __write_cr4(ctxt->cr4);
+ native_wrmsrl(MSR_EFER, ctxt->efer);
+ native_write_cr4(ctxt->cr4);
#endif
- write_cr3(ctxt->cr3);
- write_cr2(ctxt->cr2);
- write_cr0(ctxt->cr0);
+ native_write_cr3(ctxt->cr3);
+ native_write_cr2(ctxt->cr2);
+ native_write_cr0(ctxt->cr0);
/* Restore the IDT. */
- load_idt(&ctxt->idt);
+ native_load_idt(&ctxt->idt);
/*
* Just in case the asm code got us here with the SS, DS, or ES
@@ -230,7 +230,7 @@ static void notrace __restore_processor_
* handlers or in complicated helpers like load_gs_index().
*/
#ifdef CONFIG_X86_64
- wrmsrl(MSR_GS_BASE, ctxt->kernelmode_gs_base);
+ native_wrmsrl(MSR_GS_BASE, ctxt->kernelmode_gs_base);
#else
loadsegment(fs, __KERNEL_PERCPU);
#endif
@@ -246,15 +246,15 @@ static void notrace __restore_processor_
loadsegment(ds, ctxt->es);
loadsegment(es, ctxt->es);
loadsegment(fs, ctxt->fs);
- load_gs_index(ctxt->gs);
+ native_load_gs_index(ctxt->gs);
/*
* Restore FSBASE and GSBASE after restoring the selectors, since
* restoring the selectors clobbers the bases. Keep in mind
* that MSR_KERNEL_GS_BASE is horribly misnamed.
*/
- wrmsrl(MSR_FS_BASE, ctxt->fs_base);
- wrmsrl(MSR_KERNEL_GS_BASE, ctxt->usermode_gs_base);
+ native_wrmsrl(MSR_FS_BASE, ctxt->fs_base);
+ native_wrmsrl(MSR_KERNEL_GS_BASE, ctxt->usermode_gs_base);
#else
loadsegment(gs, ctxt->gs);
#endif
next prev parent reply other threads:[~2023-01-12 14:53 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-12 14:31 [RFC][PATCH 0/6] x86: Fix suspend vs retbleed=stuff Peter Zijlstra
2023-01-12 14:31 ` Peter Zijlstra [this message]
2023-01-13 8:14 ` [RFC][PATCH 1/6] x86/power: De-paravirt restore_processor_state() Juergen Gross
2023-01-12 14:31 ` [RFC][PATCH 2/6] x86/power: Inline write_cr[04]() Peter Zijlstra
2023-01-12 21:51 ` Kees Cook
2023-01-13 13:16 ` Ingo Molnar
2023-01-13 17:17 ` Peter Zijlstra
2023-01-12 14:31 ` [RFC][PATCH 3/6] x86/callthunk: No callthunk for restore_processor_state() Peter Zijlstra
2023-01-12 14:31 ` [RFC][PATCH 4/6] x86/power: Sprinkle some noinstr Peter Zijlstra
2023-01-12 14:31 ` [RFC][PATCH 5/6] PM / hibernate: Add minimal noinstr annotations Peter Zijlstra
2023-01-12 14:31 ` [RFC][PATCH 6/6] x86/power: Seal restore_processor_state() Peter Zijlstra
2023-01-13 7:39 ` [RFC][PATCH 0/6] x86: Fix suspend vs retbleed=stuff Joan Bruguera
2023-01-13 9:17 ` Peter Zijlstra
2023-01-13 12:59 ` Peter Zijlstra
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=20230112143825.584639584@infradead.org \
--to=peterz@infradead.org \
--cc=jbeulich@suse.com \
--cc=jgross@suse.com \
--cc=joanbrugueram@gmail.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=rafael@kernel.org \
--cc=roger.pau@citrix.com \
--cc=x86@kernel.org \
--cc=xen-devel@lists.xenproject.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®