Skip to content

Commit f93d6d6

Browse files
committed
KVM: s390: Increase size of union sca_utility to four bytes
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 <[email protected]> Acked-by: Janosch Frank <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Heiko Carstens <[email protected]>
1 parent 7061c63 commit f93d6d6

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

arch/s390/include/asm/kvm_host.h

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,16 @@ union ipte_control {
9494
};
9595
};
9696

97+
/*
98+
* Utility is defined as two bytes but having it four bytes wide
99+
* generates more efficient code. Since the following bytes are
100+
* reserved this makes no functional difference.
101+
*/
97102
union sca_utility {
98-
__u16 val;
103+
__u32 val;
99104
struct {
100-
__u16 mtcr : 1;
101-
__u16 reserved : 15;
105+
__u32 mtcr : 1;
106+
__u32 : 31;
102107
};
103108
};
104109

@@ -107,15 +112,15 @@ struct bsca_block {
107112
__u64 reserved[5];
108113
__u64 mcn;
109114
union sca_utility utility;
110-
__u8 reserved2[6];
115+
__u8 reserved2[4];
111116
struct bsca_entry cpu[KVM_S390_BSCA_CPU_SLOTS];
112117
};
113118

114119
struct esca_block {
115120
union ipte_control ipte_control;
116121
__u64 reserved1[6];
117122
union sca_utility utility;
118-
__u8 reserved2[6];
123+
__u8 reserved2[4];
119124
__u64 mcn[4];
120125
__u64 reserved3[20];
121126
struct esca_entry cpu[KVM_S390_ESCA_CPU_SLOTS];

0 commit comments

Comments
 (0)