mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Juergen Gross <jgross@suse.com>
To: Hou Wenlong <houwenlong.hwl@antgroup.com>
Cc: linux-kernel@vger.kernel.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>, Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Josh Poimboeuf <jpoimboe@kernel.org>,
	Kees Cook <keescook@chromium.org>, Song Liu <song@kernel.org>,
	Nadav Amit <namit@vmware.com>,
	virtualization@lists.linux-foundation.org
Subject: Re: [PATCH] x86/paravirt: Use relative reference for original instruction
Date: Thu, 24 Nov 2022 12:18:29 +0100	[thread overview]
Message-ID: <f2b89349-b41a-ae3a-6974-9f74f6791822@suse.com> (raw)
In-Reply-To: <20221124110653.GA88913@k08j02272.eu95sqa>


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

On 24.11.22 12:06, Hou Wenlong wrote:
> On Thu, Nov 24, 2022 at 11:18:52AM +0100, Juergen Gross wrote:
>> On 24.11.22 09:51, Hou Wenlong wrote:
>>> Similar to the alternative patching, use relative reference for original
>>> instruction rather than absolute one, which saves 8 bytes for one entry
>>> on x86_64.  And it could generate R_X86_64_PC32 relocation instead of
>>
>> 8 bytes saved? I think those are 4 bytes only.
>>
> The corresponding C structure paravirt_patch_site is not packed, Before this,
> its size is 16 bytes in x86_64,due to the alignment of 8 bytes. Now the alignment
> is 4 bytes, so the size is 8 bytes.

Oh, I've looked at Linus' tree. You seem to have based your reasoning on
the tip/paravirt branch, which is fine.

> 
>>> R_X86_64_64 relocation, which also reduces relocation metadata on
>>> relocatable builds.
>>>
>>> Signed-off-by: Hou Wenlong <houwenlong.hwl@antgroup.com>
>>> ---
>>>   arch/x86/include/asm/paravirt.h       | 6 +++---
>>>   arch/x86/include/asm/paravirt_types.h | 4 ++--
>>>   arch/x86/kernel/alternative.c         | 8 +++++---
>>>   3 files changed, 10 insertions(+), 8 deletions(-)
>>>
>>> diff --git a/arch/x86/include/asm/paravirt.h b/arch/x86/include/asm/paravirt.h
>>> index 2851bc2339d5..2cbe9b64e103 100644
>>> --- a/arch/x86/include/asm/paravirt.h
>>> +++ b/arch/x86/include/asm/paravirt.h
>>> @@ -735,13 +735,13 @@ extern void default_banner(void);
>>>   #else  /* __ASSEMBLY__ */
>>> -#define _PVSITE(ptype, ops, word, algn)		\
>>> +#define _PVSITE(ptype, ops, algn)		\
>>
>> Would you please drop the algn parameter, too? It isn't needed anymore
>> as the alignment can be hard coded to be 4 now. This would need to be
>> adjusted in the _paravirt_alt() macro, too.
>>
> OK, since the aligment is 4 bytes now, it seems that _ASM_ALIGN could
> be dropped too?

That's what I meant with the adjustment of _paravirt_alt().

I wouldn't drop _ASM_ALIGN, but replace it with ".align 4".


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:[~2022-11-24 11:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-24  8:51 Hou Wenlong
2022-11-24 10:18 ` Juergen Gross
2022-11-24 11:06   ` Hou Wenlong
2022-11-24 11:18     ` Juergen Gross [this message]

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=f2b89349-b41a-ae3a-6974-9f74f6791822@suse.com \
    --to=jgross@suse.com \
    --cc=amakhalov@vmware.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=houwenlong.hwl@antgroup.com \
    --cc=hpa@zytor.com \
    --cc=jpoimboe@kernel.org \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=namit@vmware.com \
    --cc=peterz@infradead.org \
    --cc=pv-drivers@vmware.com \
    --cc=song@kernel.org \
    --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®