From: Borislav Petkov <bp@alien8.de>
To: Juergen Gross <jgross@suse.com>
Cc: "VMware, Inc." <pv-drivers@vmware.com>,
x86@kernel.org, linux-kernel@vger.kernel.org,
virtualization@lists.linux-foundation.org,
Ingo Molnar <mingo@redhat.com>, Andy Lutomirski <luto@kernel.org>,
"H. Peter Anvin" <hpa@zytor.com>,
xen-devel@lists.xenproject.org,
Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH v5 11/12] x86/paravirt: switch functions with custom code to ALTERNATIVE
Date: Mon, 8 Mar 2021 19:30:58 +0100 [thread overview]
Message-ID: <20210308183058.GC12548@zn.tnic> (raw)
In-Reply-To: <20210308122844.30488-12-jgross@suse.com>
On Mon, Mar 08, 2021 at 01:28:43PM +0100, Juergen Gross wrote:
> diff --git a/arch/x86/include/asm/paravirt.h b/arch/x86/include/asm/paravirt.h
> index 36cd71fa097f..04b3067f31b5 100644
> --- a/arch/x86/include/asm/paravirt.h
> +++ b/arch/x86/include/asm/paravirt.h
> @@ -137,7 +137,8 @@ static inline void write_cr0(unsigned long x)
>
> static inline unsigned long read_cr2(void)
> {
> - return PVOP_CALLEE0(unsigned long, mmu.read_cr2);
> + return PVOP_ALT_CALLEE0(unsigned long, mmu.read_cr2,
> + "mov %%cr2, %%rax;", ~X86_FEATURE_XENPV);
Just some cursory poking first - indepth review later.
Do I see this correctly that the negated feature can be expressed with, to use
this example here:
ALTERNATIVE_TERNARY(mmu.read_cr2, X86_FEATURE_XENPV, "", "mov %%cr2, %%rax;");
?
And then you don't need to touch the patching code for ~feature handling
and the flags byte.
If you want it syntactically sugared, you can define a separate
ALTERNATIVE_NOT macro using ALTERNATIVE_TERNARY...
Hmmm.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
next prev parent reply other threads:[~2021-03-08 18:38 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-08 12:28 [PATCH v5 00/12] x86: major paravirt cleanup Juergen Gross via Virtualization
2021-03-08 12:28 ` [PATCH v5 02/12] x86/paravirt: switch time pvops functions to use static_call() Juergen Gross via Virtualization
2021-03-08 17:00 ` Boris Ostrovsky
2021-03-09 6:14 ` Jürgen Groß via Virtualization
2021-03-08 12:28 ` [PATCH v5 06/12] x86: add new features for paravirt patching Juergen Gross via Virtualization
2021-03-08 12:28 ` [PATCH v5 07/12] x86/paravirt: remove no longer needed 32-bit pvops cruft Juergen Gross via Virtualization
2021-03-08 12:28 ` [PATCH v5 08/12] x86/paravirt: simplify paravirt macros Juergen Gross via Virtualization
2021-03-08 12:28 ` [PATCH v5 09/12] x86/paravirt: switch iret pvops to ALTERNATIVE Juergen Gross via Virtualization
2021-03-08 12:28 ` [PATCH v5 10/12] x86/paravirt: add new macros PVOP_ALT* supporting pvops in ALTERNATIVEs Juergen Gross via Virtualization
2021-03-08 12:28 ` [PATCH v5 11/12] x86/paravirt: switch functions with custom code to ALTERNATIVE Juergen Gross via Virtualization
2021-03-08 18:30 ` Borislav Petkov [this message]
2021-03-09 6:21 ` Jürgen Groß via Virtualization
2021-03-08 12:28 ` [PATCH v5 12/12] x86/paravirt: have only one paravirt patch function Juergen Gross via Virtualization
2021-03-08 16:31 ` [PATCH v5 00/12] x86: major paravirt cleanup 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=20210308183058.GC12548@zn.tnic \
--to=bp@alien8.de \
--cc=hpa@zytor.com \
--cc=jgross@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@redhat.com \
--cc=pv-drivers@vmware.com \
--cc=tglx@linutronix.de \
--cc=virtualization@lists.linux-foundation.org \
--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