virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86/paravirt: use %rip-relative addressing in hook calls
@ 2021-09-30 12:40 Jan Beulich via Virtualization
  2021-10-05  7:43 ` Juergen Gross via Virtualization
  0 siblings, 1 reply; 6+ messages in thread
From: Jan Beulich via Virtualization @ 2021-09-30 12:40 UTC (permalink / raw)
  To: Juergen Gross, Deep Shah, VMware, Inc.; +Cc: Linux Virtualization

While using a plain (constant) address works, its use needlessly invokes
a SIB addressing mode, making every call site one byte larger than
necessary. Instead of using an "i" constraint with address-of operator
and a 'c' operand modifier, simply use an ordinary "m" constraint, which
the 64-bit compiler will translate to %rip-relative addressing. This way
we also tell the compiler the truth about operand usage - the memory
location gets actually read, after all.

32-bit code generation is unaffected by the change.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/arch/x86/include/asm/paravirt_types.h
+++ b/arch/x86/include/asm/paravirt_types.h
@@ -278,7 +278,7 @@ extern void (*paravirt_iret)(void);
 
 #define paravirt_type(op)				\
 	[paravirt_typenum] "i" (PARAVIRT_PATCH(op)),	\
-	[paravirt_opptr] "i" (&(pv_ops.op))
+	[paravirt_opptr] "m" (pv_ops.op)
 #define paravirt_clobber(clobber)		\
 	[paravirt_clobber] "i" (clobber)
 
@@ -315,7 +315,7 @@ int paravirt_disable_iospace(void);
  */
 #define PARAVIRT_CALL					\
 	ANNOTATE_RETPOLINE_SAFE				\
-	"call *%c[paravirt_opptr];"
+	"call *%[paravirt_opptr];"
 
 /*
  * These macros are intended to wrap calls through one of the paravirt

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] x86/paravirt: use %rip-relative addressing in hook calls
  2021-09-30 12:40 [PATCH] x86/paravirt: use %rip-relative addressing in hook calls Jan Beulich via Virtualization
@ 2021-10-05  7:43 ` Juergen Gross via Virtualization
  2021-11-23  9:29   ` Jan Beulich via Virtualization
  0 siblings, 1 reply; 6+ messages in thread
From: Juergen Gross via Virtualization @ 2021-10-05  7:43 UTC (permalink / raw)
  To: Jan Beulich, Deep Shah, VMware, Inc.; +Cc: Linux Virtualization


[-- Attachment #1.1.1.1: Type: text/plain, Size: 719 bytes --]

On 30.09.21 14:40, Jan Beulich via Virtualization wrote:
> While using a plain (constant) address works, its use needlessly invokes
> a SIB addressing mode, making every call site one byte larger than
> necessary. Instead of using an "i" constraint with address-of operator
> and a 'c' operand modifier, simply use an ordinary "m" constraint, which
> the 64-bit compiler will translate to %rip-relative addressing. This way
> we also tell the compiler the truth about operand usage - the memory
> location gets actually read, after all.
> 
> 32-bit code generation is unaffected by the change.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Juergen Gross <jgross@suse.com>


Juergen

[-- Attachment #1.1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3135 bytes --]

[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]

[-- Attachment #2: Type: text/plain, Size: 183 bytes --]

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] x86/paravirt: use %rip-relative addressing in hook calls
  2021-10-05  7:43 ` Juergen Gross via Virtualization
@ 2021-11-23  9:29   ` Jan Beulich via Virtualization
  2021-11-23  9:52     ` Juergen Gross via Virtualization
  0 siblings, 1 reply; 6+ messages in thread
From: Jan Beulich via Virtualization @ 2021-11-23  9:29 UTC (permalink / raw)
  To: Juergen Gross; +Cc: VMware, Inc., Linux Virtualization

On 05.10.2021 09:43, Juergen Gross wrote:
> On 30.09.21 14:40, Jan Beulich via Virtualization wrote:
>> While using a plain (constant) address works, its use needlessly invokes
>> a SIB addressing mode, making every call site one byte larger than
>> necessary. Instead of using an "i" constraint with address-of operator
>> and a 'c' operand modifier, simply use an ordinary "m" constraint, which
>> the 64-bit compiler will translate to %rip-relative addressing. This way
>> we also tell the compiler the truth about operand usage - the memory
>> location gets actually read, after all.
>>
>> 32-bit code generation is unaffected by the change.
>>
>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> 
> Reviewed-by: Juergen Gross <jgross@suse.com>

Thanks. I notice this wasn't part of your 5.16-rc1 pull request, nor
did it make it into Linus'es tree via any other route. May I ask what
the plans here are?

Jan

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] x86/paravirt: use %rip-relative addressing in hook calls
  2021-11-23  9:29   ` Jan Beulich via Virtualization
@ 2021-11-23  9:52     ` Juergen Gross via Virtualization
  2022-01-10 13:26       ` Juergen Gross via Virtualization
  0 siblings, 1 reply; 6+ messages in thread
From: Juergen Gross via Virtualization @ 2021-11-23  9:52 UTC (permalink / raw)
  To: Jan Beulich, Thomas Gleixner; +Cc: VMware, Inc., Linux Virtualization


[-- Attachment #1.1.1.1: Type: text/plain, Size: 1243 bytes --]

On 23.11.21 10:29, Jan Beulich wrote:
> On 05.10.2021 09:43, Juergen Gross wrote:
>> On 30.09.21 14:40, Jan Beulich via Virtualization wrote:
>>> While using a plain (constant) address works, its use needlessly invokes
>>> a SIB addressing mode, making every call site one byte larger than
>>> necessary. Instead of using an "i" constraint with address-of operator
>>> and a 'c' operand modifier, simply use an ordinary "m" constraint, which
>>> the 64-bit compiler will translate to %rip-relative addressing. This way
>>> we also tell the compiler the truth about operand usage - the memory
>>> location gets actually read, after all.
>>>
>>> 32-bit code generation is unaffected by the change.
>>>
>>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>>
>> Reviewed-by: Juergen Gross <jgross@suse.com>
> 
> Thanks. I notice this wasn't part of your 5.16-rc1 pull request, nor
> did it make it into Linus'es tree via any other route. May I ask what
> the plans here are?

I CC-ed you on the related mail I sent to the x86 maintainers:

"Re: Which tree for paravirt related patches?" on Nov 4th, and Thomas
Gleixner promised to look at your patch. Adding him to this response
again in order to remind him.


Juergen

[-- Attachment #1.1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3135 bytes --]

[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]

[-- Attachment #2: Type: text/plain, Size: 183 bytes --]

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] x86/paravirt: use %rip-relative addressing in hook calls
  2021-11-23  9:52     ` Juergen Gross via Virtualization
@ 2022-01-10 13:26       ` Juergen Gross via Virtualization
  2022-01-10 19:31         ` Borislav Petkov
  0 siblings, 1 reply; 6+ messages in thread
From: Juergen Gross via Virtualization @ 2022-01-10 13:26 UTC (permalink / raw)
  To: Jan Beulich, Thomas Gleixner; +Cc: VMware, Inc., X86 ML, Linux Virtualization


[-- Attachment #1.1.1.1: Type: text/plain, Size: 1479 bytes --]

On 23.11.21 10:52, Juergen Gross via Virtualization wrote:
> On 23.11.21 10:29, Jan Beulich wrote:
>> On 05.10.2021 09:43, Juergen Gross wrote:
>>> On 30.09.21 14:40, Jan Beulich via Virtualization wrote:
>>>> While using a plain (constant) address works, its use needlessly 
>>>> invokes
>>>> a SIB addressing mode, making every call site one byte larger than
>>>> necessary. Instead of using an "i" constraint with address-of operator
>>>> and a 'c' operand modifier, simply use an ordinary "m" constraint, 
>>>> which
>>>> the 64-bit compiler will translate to %rip-relative addressing. This 
>>>> way
>>>> we also tell the compiler the truth about operand usage - the memory
>>>> location gets actually read, after all.
>>>>
>>>> 32-bit code generation is unaffected by the change.
>>>>
>>>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>>>
>>> Reviewed-by: Juergen Gross <jgross@suse.com>
>>
>> Thanks. I notice this wasn't part of your 5.16-rc1 pull request, nor
>> did it make it into Linus'es tree via any other route. May I ask what
>> the plans here are?
> 
> I CC-ed you on the related mail I sent to the x86 maintainers:
> 
> "Re: Which tree for paravirt related patches?" on Nov 4th, and Thomas
> Gleixner promised to look at your patch. Adding him to this response
> again in order to remind him.

Thomas, another ping. Didn't you want to take this patch more than a
month ago? Cc-ing the other x86 maintainers, too.


Juergen

[-- Attachment #1.1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3135 bytes --]

[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]

[-- Attachment #2: Type: text/plain, Size: 183 bytes --]

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] x86/paravirt: use %rip-relative addressing in hook calls
  2022-01-10 13:26       ` Juergen Gross via Virtualization
@ 2022-01-10 19:31         ` Borislav Petkov
  0 siblings, 0 replies; 6+ messages in thread
From: Borislav Petkov @ 2022-01-10 19:31 UTC (permalink / raw)
  To: Juergen Gross
  Cc: VMware, Inc., Thomas Gleixner, X86 ML, Jan Beulich,
	Linux Virtualization

On Mon, Jan 10, 2022 at 02:26:18PM +0100, Juergen Gross wrote:
> Thomas, another ping. Didn't you want to take this patch more than a
> month ago? Cc-ing the other x86 maintainers, too.

I'll have a look after the merge window is over.

Thx.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-01-10 19:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-09-30 12:40 [PATCH] x86/paravirt: use %rip-relative addressing in hook calls Jan Beulich via Virtualization
2021-10-05  7:43 ` Juergen Gross via Virtualization
2021-11-23  9:29   ` Jan Beulich via Virtualization
2021-11-23  9:52     ` Juergen Gross via Virtualization
2022-01-10 13:26       ` Juergen Gross via Virtualization
2022-01-10 19:31         ` Borislav Petkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).