Re: [PATCH V2 03/14] x86/set_memory: Add x86_set_memory_enc static call support

From
Peter Zijlstra <peterz@infradead.org>
Date
2021-08-05 14:23:52
Also in
linux-arch, linux-iommu, linux-scsi, lkml, netdev, xen-devel
Reply to
Tianyu Lan, 2021-08-05
On Thu, Aug 05, 2021 at 10:05:17PM +0800, Tianyu Lan wrote:
quoted hunk ↗ jump to hunk
 static int __set_memory_enc_dec(unsigned long addr, int numpages, bool enc)
 {
+	return static_call(x86_set_memory_enc)(addr, numpages, enc);
 }
Hurpmh... So with a bit of 'luck' you get code-gen like:

__set_memory_enc_dec:
	jmp __SCT_x86_set_memory_enc;

set_memory_encrypted:
	mov $1, %rdx
	jmp __set_memory_enc_dec

set_memory_decrypted:
	mov $0, %rdx
	jmp __set_memory_enc_dec


Which, to me, seems exceedingly daft. Best to make all 3 of those
inlines and use EXPORT_STATIC_CALL_TRAMP_GPL(x86_set_memory_enc) or
something.

This is assuming any of this is actually performance critical, based off
of this using static_call() to begin with.
Thread (23 messages) 23 messages, 3 authors, last reply 2021-08-05
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help