Re: [PATCH 3/3] KVM: s390: Increase size of union sca_utility to four bytes

From: Claudio Imbrenda
Date: Mon Nov 25 2024 - 11:17:22 EST


On Mon, 25 Nov 2024 14:40:22 +0100
Heiko Carstens <hca@xxxxxxxxxxxxx> wrote:

> On Mon, Nov 25, 2024 at 01:20:42PM +0100, Claudio Imbrenda wrote:
> > On Mon, 25 Nov 2024 12:50:39 +0100
> > Heiko Carstens <hca@xxxxxxxxxxxxx> wrote:
> >
> > > 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.
> >
> > wouldn't an atomic bit_op be better in that case?
>
> I had that, but decided against it, since the generated code isn't shorter.
> And it would require and unsigned long type within the union, or a cast,
> which I also both disliked.

fair enough

Acked-by: Claudio Imbrenda <imbrenda@xxxxxxxxxxxxx>