From: Juergen Gross <jgross@suse.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: linux-kernel@vger.kernel.org, x86@kernel.org,
virtualization@lists.linux-foundation.org,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
"H. Peter Anvin" <hpa@zytor.com>,
"Srivatsa S. Bhat (VMware)" <srivatsa@csail.mit.edu>,
Alexey Makhalov <amakhalov@vmware.com>,
VMware PV-Drivers Reviewers <pv-drivers@vmware.com>
Subject: Re: [RFC PATCH 3/3] x86/paravirt: switch mixed paravirt/alternative calls to alternative_2
Date: Wed, 20 Sep 2023 17:49:02 +0200 [thread overview]
Message-ID: <e2d1157e-47cc-467d-a319-12bb07ef960c@suse.com> (raw)
In-Reply-To: <20230920145222.GB6687@noisy.programming.kicks-ass.net>
[-- Attachment #1.1.1: Type: text/plain, Size: 1944 bytes --]
On 20.09.23 16:52, Peter Zijlstra wrote:
> On Thu, Jun 08, 2023 at 04:03:33PM +0200, Juergen Gross wrote:
>> Instead of stacking alternative and paravirt patching, use the new
>> ALT_FLAG_CALL flag to switch those mixed calls to pure alternative
>> handling.
>>
>> This eliminates the need to be careful regarding the sequence of
>> alternative and paravirt patching.
>>
>> For call depth tracking callthunks_setup() needs to be adapted to patch
>> calls at alternative patching sites instead of paravirt calls.
>>
>> Remove the no longer needed paravirt patching and related code.
>
> I think this becomes easier if you first convert the paravirt sites to
> alternatives, such that .parainstructions is empty, and then in a
> subsequent patch remove all the paravirt infrastructure that is unused.
Fine with me.
Speaking of additional patches: any idea how the related objtool change(s)
should look like? I suspect they are needed ...
>
>
>> +#define SAVE_FLAGS ALTERNATIVE_2 "PARA_IRQ_save_fl;", ALT_CALL_INSTR, \
>> + ALT_CALL_ALWAYS, "pushf; pop %rax;", \
>> + ALT_NOT(X86_FEATURE_XENPV)
>
> I find this more readable when written as:
>
> #define SAVE_FLAGS ALTERNATIVE_2 "PARA_IRQ_save_fl;", \
> ALT_CALL_INSTR, ALT_CALL_ALWAYS, \
> "pushf; pop %rax;", ALT_NOT(X86_FEATURE_XENPV)
>
> (and perhaps ALT_NOT_XEN is in order, there's a ton of those)
I like both suggestions.
>
> If you base this on top of the nested alternative patches, another
> helper might be:
>
> #define __PV_ALTERNATIVE(old) __ALTERNATIVE(old, ALT_CALL_INSTR, ALT_CALL_ALWAYS)
>
> So that you can then write:
>
> #define SAVE_FLAGS __ALTERNATIVE(__PV_ALTERNATIVE("PARA_IRQ_save_fl;"),
> "pushf; pop %rax;", ALT_NOT_XEN)
>
> But perhaps I'm over-cooking things now..
I don't think this is needed for the single instance it is useful for.
Juergen
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3149 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]
next prev parent reply other threads:[~2023-09-20 15:49 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-08 14:03 [RFC PATCH 0/3] x86/paravirt: Get rid of paravirt patching Juergen Gross
2023-06-08 14:03 ` [RFC PATCH 1/3] x86/paravirt: move some functions and defines to alternative Juergen Gross
2023-09-20 14:52 ` Peter Zijlstra
2023-06-08 14:03 ` [RFC PATCH 2/3] x86/alternative: add indirect call patching Juergen Gross
2023-09-20 14:44 ` Peter Zijlstra
2023-06-08 14:03 ` [RFC PATCH 3/3] x86/paravirt: switch mixed paravirt/alternative calls to alternative_2 Juergen Gross
2023-09-20 14:52 ` Peter Zijlstra
2023-09-20 15:49 ` Juergen Gross [this message]
2023-07-10 12:29 ` [RFC PATCH 0/3] x86/paravirt: Get rid of paravirt patching Juergen Gross
2023-08-24 9:01 ` Juergen Gross
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=e2d1157e-47cc-467d-a319-12bb07ef960c@suse.com \
--to=jgross@suse.com \
--cc=amakhalov@vmware.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=pv-drivers@vmware.com \
--cc=srivatsa@csail.mit.edu \
--cc=tglx@linutronix.de \
--cc=virtualization@lists.linux-foundation.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
Powered by JetHome