Re: [PATCH] x86/paravirt: Use relative reference for original instruction

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxx>
---
  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: OpenPGP_0xB0DE9DD628BF132F.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

_______________________________________________
Virtualization mailing list
Virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

[Index of Archives]     [KVM Development]     [Libvirt Development]     [Libvirt Users]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux