mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Juergen Gross <jgross@suse.com>
To: Borislav Petkov <bp@alien8.de>
Cc: linux-kernel@vger.kernel.org, x86@kernel.org,
	virtualization@lists.linux-foundation.org,
	"Srivatsa S. Bhat (VMware)" <srivatsa@csail.mit.edu>,
	Alexey Makhalov <amakhalov@vmware.com>,
	VMware PV-Drivers Reviewers <pv-drivers@vmware.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	"H. Peter Anvin" <hpa@zytor.com>
Subject: Re: [PATCH] x86/paravirt: convert simple paravirt functions to asm
Date: Fri, 10 Mar 2023 07:24:17 +0100	[thread overview]
Message-ID: <e7e42a4b-cf0d-d6ad-2f66-0f52898e818a@suse.com> (raw)
In-Reply-To: <20230309133950.GDZAnhpnon5fk4Fg/X@fat_crate.local>


[-- Attachment #1.1.1: Type: text/plain, Size: 1603 bytes --]

On 09.03.23 14:39, Borislav Petkov wrote:
> On Wed, Mar 08, 2023 at 04:42:10PM +0100, Juergen Gross wrote:
>> All functions referenced via __PV_IS_CALLEE_SAVE() need to be assembler
>> functions, as those functions calls are hidden from gcc. In case the
>> kernel is compiled with "-fzero-call-used-regs" the compiler will
>> clobber caller-saved registers at the end of C functions, which will
>> result in unexpectedly zeroed registers at the call site of the
>> related paravirt functions.
>>
>> Replace the C functions with DEFINE_PARAVIRT_ASM() constructs using
>> the same instructions as the related paravirt calls in the
>> PVOP_ALT_[V]CALLEE*() macros.
>>
>> Signed-off-by: Juergen Gross <jgross@suse.com>
>> ---
>>   arch/x86/include/asm/paravirt_types.h |  8 +++++++-
>>   arch/x86/kernel/paravirt.c            | 27 ++++++---------------------
>>   2 files changed, 13 insertions(+), 22 deletions(-)
> 
> Right, works with my particular reproducer.
> 
> Turning them into asm prevents the compiler from doing the
> callee-clobbered zeroing and that's fine as this whole paravirt gunk is
> hiding the "CALL" insn from it and you putting them in asm is in line
> with this.
> 
> And a negative diffstat..
> 
> So yeah, I'll queue it soon unless someone objects.

Thanks.

> Long term, I think we should continue switching all that pv stuff to
> using the alternatives.

The "normal" cases not using alternatives should rather be switched to
static calls.

Whether it is possible to mix a static call with alternatives needs to
be evaluated.


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

  reply	other threads:[~2023-03-10  6:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-08 15:42 Juergen Gross
2023-03-09 13:39 ` Borislav Petkov
2023-03-10  6:24   ` Juergen Gross [this message]
2023-03-12 20:47     ` Borislav Petkov
2023-03-16 16:50 ` Borislav Petkov
2023-03-16 20:14 ` Peter Zijlstra
2023-03-17  5:28   ` 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=e7e42a4b-cf0d-d6ad-2f66-0f52898e818a@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=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

all inboxes | Powered by JetHome®