public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Juergen Gross <jgross@suse.com>
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 16:52:22 +0200	[thread overview]
Message-ID: <20230920145222.GB6687@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <20230608140333.4083-4-jgross@suse.com>

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.


> +#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)

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..


  reply	other threads:[~2023-09-20 14:53 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 [this message]
2023-09-20 15:49     ` Juergen Gross
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=20230920145222.GB6687@noisy.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=amakhalov@vmware.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=jgross@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --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