]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
KVM: s390: Increase size of union sca_utility to four bytes
authorHeiko Carstens <hca@linux.ibm.com>
Tue, 26 Nov 2024 10:25:15 +0000 (11:25 +0100)
committerHeiko Carstens <hca@linux.ibm.com>
Wed, 27 Nov 2024 11:55:15 +0000 (12:55 +0100)
kvm_s390_update_topology_change_report() modifies a single bit within
sca_utility using cmpxchg(). Given that the size of the sca_utility union
is two bytes this generates very inefficient code. Change the size to four
bytes, so better code can be generated.

Even though the size of sca_utility doesn't reflect architecture anymore
this seems to be the easiest and most pragmatic approach to avoid
inefficient code.

Acked-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Acked-by: Janosch Frank <frankja@linux.ibm.com>
Link: https://lore.kernel.org/r/20241126102515.3178914-4-hca@linux.ibm.com
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
arch/s390/include/asm/kvm_host.h

index 51201b4ac93a5d1903c6b60d64326c5530147ea6..7ef37f746d47993e84e287e58334d4edf273d450 100644 (file)
@@ -94,11 +94,16 @@ union ipte_control {
        };
 };
 
+/*
+ * Utility is defined as two bytes but having it four bytes wide
+ * generates more efficient code. Since the following bytes are
+ * reserved this makes no functional difference.
+ */
 union sca_utility {
-       __u16 val;
+       __u32 val;
        struct {
-               __u16 mtcr : 1;
-               __u16 reserved : 15;
+               __u32 mtcr : 1;
+               __u32      : 31;
        };
 };
 
@@ -107,7 +112,7 @@ struct bsca_block {
        __u64   reserved[5];
        __u64   mcn;
        union sca_utility utility;
-       __u8    reserved2[6];
+       __u8    reserved2[4];
        struct bsca_entry cpu[KVM_S390_BSCA_CPU_SLOTS];
 };
 
@@ -115,7 +120,7 @@ struct esca_block {
        union ipte_control ipte_control;
        __u64   reserved1[6];
        union sca_utility utility;
-       __u8    reserved2[6];
+       __u8    reserved2[4];
        __u64   mcn[4];
        __u64   reserved3[20];
        struct esca_entry cpu[KVM_S390_ESCA_CPU_SLOTS];