From: Andy Lutomirski <luto@kernel.org>
To: x86@kernel.org
Cc: One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk>,
Borislav Petkov <bp@alien8.de>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Brian Gerst <brgerst@gmail.com>,
Matthew Whitehead <tedheadster@gmail.com>,
Henrique de Moraes Holschuh <hmh@hmh.eng.br>,
Peter Zijlstra <peterz@infradead.org>,
Andy Lutomirski <luto@kernel.org>
Subject: [PATCH v2 4/6] x86/paravirt: Make sync_core() be a paravirt op
Date: Thu, 1 Dec 2016 16:35:00 -0800 [thread overview]
Message-ID: <e5e86fddcafbe4daedf58cf43e954cd6c70a836e.1480638597.git.luto@kernel.org> (raw)
In-Reply-To: <cover.1480536936.git.luto@kernel.org>
In-Reply-To: <cover.1480638597.git.luto@kernel.org>
I want to change sync_core() to use MOV to CR2, but that won't work
the way we want on Xen PV, and the easiest fix is to make
sync_core() be a paravirt op. Make it so.
A real paravirt guru could probably microoptimize this. I doubt it
matters much, though, as sync_core() is mostly used during boot.
Signed-off-by: Andy Lutomirski <luto@kernel.org>
---
arch/x86/include/asm/paravirt.h | 5 +++++
arch/x86/include/asm/paravirt_types.h | 2 ++
arch/x86/include/asm/processor.h | 3 ++-
arch/x86/kernel/paravirt.c | 2 ++
4 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/arch/x86/include/asm/paravirt.h b/arch/x86/include/asm/paravirt.h
index ce932812f142..7e76b72aa698 100644
--- a/arch/x86/include/asm/paravirt.h
+++ b/arch/x86/include/asm/paravirt.h
@@ -28,6 +28,11 @@ static inline void __cpuid(unsigned int *eax, unsigned int *ebx,
PVOP_VCALL4(pv_cpu_ops.cpuid, eax, ebx, ecx, edx);
}
+static inline void sync_core(void)
+{
+ PVOP_VCALL0(pv_cpu_ops.sync_core);
+}
+
/*
* These special macros can be used to get or set a debugging register
*/
diff --git a/arch/x86/include/asm/paravirt_types.h b/arch/x86/include/asm/paravirt_types.h
index 0f400c0e4979..e4d2cb2c0165 100644
--- a/arch/x86/include/asm/paravirt_types.h
+++ b/arch/x86/include/asm/paravirt_types.h
@@ -177,6 +177,8 @@ struct pv_cpu_ops {
void (*start_context_switch)(struct task_struct *prev);
void (*end_context_switch)(struct task_struct *next);
+
+ void (*sync_core)(void);
};
struct pv_irq_ops {
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
index 64fbc937d586..c4402053c663 100644
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -507,6 +507,7 @@ static inline void load_sp0(struct tss_struct *tss,
}
#define set_iopl_mask native_set_iopl_mask
+#define sync_core native_sync_core
#endif /* CONFIG_PARAVIRT */
/* Free all resources held by a thread. */
@@ -591,7 +592,7 @@ static __always_inline void cpu_relax(void)
#define cpu_relax_lowlatency() cpu_relax()
/* Stop speculative execution and prefetching of modified code. */
-static inline void sync_core(void)
+static inline void native_sync_core(void)
{
int tmp;
diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c
index bbf3d5933eaa..4d6a20ecbc78 100644
--- a/arch/x86/kernel/paravirt.c
+++ b/arch/x86/kernel/paravirt.c
@@ -373,6 +373,8 @@ __visible struct pv_cpu_ops pv_cpu_ops = {
.start_context_switch = paravirt_nop,
.end_context_switch = paravirt_nop,
+
+ .sync_core = native_sync_core,
};
/* At this point, native_get/set_debugreg has real function entries */
--
2.9.3
next prev parent reply other threads:[~2016-12-02 0:35 UTC|newest]
Thread overview: 57+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-30 20:34 [PATCH 0/4] CPUID-less CPU fixes and improvements Andy Lutomirski
2016-11-30 20:34 ` [PATCH 1/4] x86/asm/32: Make sync_core() handle missing CPUID on all 32-bit kernels Andy Lutomirski
2016-11-30 20:34 ` [PATCH 2/4] Revert "x86/boot: Fail the boot if !M486 and CPUID is missing" Andy Lutomirski
2016-12-01 5:53 ` Peter Zijlstra
2016-12-01 9:02 ` Borislav Petkov
2016-12-01 10:07 ` Thomas Gleixner
2016-12-01 11:15 ` [PATCH] x86/CPU: Add X86_FEATURE_CPUID Borislav Petkov
2016-12-01 17:00 ` Andy Lutomirski
2016-12-02 0:33 ` [PATCH 2/4] Revert "x86/boot: Fail the boot if !M486 and CPUID is missing" Andy Lutomirski
2016-12-01 17:00 ` Andy Lutomirski
2016-11-30 20:34 ` [PATCH 3/4] x86/microcode/intel: Replace sync_core() with cpuid_eax(1) Andy Lutomirski
2016-12-01 9:11 ` Borislav Petkov
2016-11-30 20:34 ` [PATCH 4/4] x86/asm: Change sync_core() to use MOV to CR2 to serialize Andy Lutomirski
2016-12-01 9:22 ` Borislav Petkov
2016-12-01 17:08 ` Andy Lutomirski
2016-12-01 17:46 ` Andrew Cooper
2016-12-02 7:34 ` Ingo Molnar
2016-12-02 0:34 ` [PATCH v2 0/6] CPUID-less CPU/sync_core fixes and improvements Andy Lutomirski
2016-12-02 0:34 ` [PATCH v2 1/6] x86/asm/32: Make sync_core() handle missing CPUID on all 32-bit kernels Andy Lutomirski
2016-12-02 0:34 ` [PATCH v2 2/6] Revert "x86/boot: Fail the boot if !M486 and CPUID is missing" Andy Lutomirski
2016-12-02 0:34 ` [PATCH v2 3/6] x86/microcode/intel: Replace sync_core() with cpuid_eax(1) Andy Lutomirski
2016-12-02 0:35 ` Andy Lutomirski [this message]
2016-12-02 0:35 ` [PATCH v2 5/6] x86/xen: Add a Xen-specific sync_core() implementation Andy Lutomirski
2016-12-02 11:44 ` Andrew Cooper
2016-12-02 17:07 ` Andy Lutomirski
2016-12-02 17:16 ` Andrew Cooper
2016-12-02 17:23 ` Andy Lutomirski
2016-12-02 17:26 ` Andrew Cooper
2016-12-02 18:50 ` Boris Ostrovsky
2016-12-02 19:34 ` Andy Lutomirski
2016-12-02 20:09 ` Boris Ostrovsky
2016-12-02 17:32 ` Linus Torvalds
2016-12-02 17:38 ` Andy Lutomirski
2016-12-02 17:53 ` Linus Torvalds
2016-12-02 18:03 ` Borislav Petkov
2016-12-02 18:27 ` Linus Torvalds
2016-12-02 18:50 ` Borislav Petkov
2016-12-02 19:03 ` Linus Torvalds
2016-12-02 19:20 ` Borislav Petkov
2016-12-02 19:24 ` Linus Torvalds
2016-12-02 19:28 ` Borislav Petkov
2016-12-03 15:02 ` [PATCH] x86/alternatives: Do not use sync_core() to serialize I$ Borislav Petkov
2016-12-03 17:05 ` Andy Lutomirski
2016-12-20 7:58 ` [tip:x86/urgent] " tip-bot for Borislav Petkov
2016-12-20 9:35 ` tip-bot for Borislav Petkov
2016-12-02 19:30 ` [PATCH v2 5/6] x86/xen: Add a Xen-specific sync_core() implementation Andy Lutomirski
2016-12-02 19:35 ` Linus Torvalds
2016-12-02 20:41 ` Andy Lutomirski
2016-12-02 21:10 ` Linus Torvalds
2016-12-02 22:55 ` Andy Lutomirski
2016-12-02 23:09 ` Linus Torvalds
2016-12-02 19:23 ` Andy Lutomirski
2016-12-02 19:30 ` Borislav Petkov
2016-12-03 12:44 ` Borislav Petkov
2016-12-02 0:35 ` [PATCH v2 6/6] x86/asm: Change sync_core() to use MOV to CR2 to serialize Andy Lutomirski
2016-12-02 0:36 ` [PATCH 0/4] CPUID-less CPU fixes and improvements Andy Lutomirski
2016-12-02 10:17 ` Ingo Molnar
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=e5e86fddcafbe4daedf58cf43e954cd6c70a836e.1480638597.git.luto@kernel.org \
--to=luto@kernel.org \
--cc=bp@alien8.de \
--cc=brgerst@gmail.com \
--cc=gnomes@lxorguk.ukuu.org.uk \
--cc=hmh@hmh.eng.br \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=tedheadster@gmail.com \
--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
Powered by JetHome