[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20231106134324.12197-B-hca@linux.ibm.com>
Date: Mon, 6 Nov 2023 14:43:24 +0100
From: Heiko Carstens <hca@...ux.ibm.com>
To: Nina Schoetterl-Glausch <nsg@...ux.ibm.com>
Cc: David Hildenbrand <david@...hat.com>,
Alexander Gordeev <agordeev@...ux.ibm.com>,
Claudio Imbrenda <imbrenda@...ux.ibm.com>,
Christian Borntraeger <borntraeger@...ux.ibm.com>,
Vasily Gorbik <gor@...ux.ibm.com>,
Janosch Frank <frankja@...ux.ibm.com>,
David Hildenbrand <dahi@...ux.vnet.ibm.com>,
Cornelia Huck <cornelia.huck@...ibm.com>,
linux-s390@...r.kernel.org, Sven Schnelle <svens@...ux.ibm.com>,
kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
Michael Mueller <mimu@...ux.vnet.ibm.com>
Subject: Re: [PATCH 2/4] KVM: s390: vsie: Fix length of facility list shadowed
On Mon, Nov 06, 2023 at 02:06:22PM +0100, Nina Schoetterl-Glausch wrote:
> > > +unsigned int stfle_size(void)
> > > +{
> > > + static unsigned int size = 0;
> > > + u64 dummy;
> > > +
> > > + if (!size) {
> > > + size = __stfle_asm(&dummy, 1) + 1;
> > > + }
Please get rid of the braces here. checkpatch.pl with "--strict" should
complain too, I guess.
> > Possible races? Should have to use an atomic?
>
> Good point. Calling __stfle_asm multiple times is fine
> and AFAIK torn reads/writes aren't possible. I don't see a way
> for the compiler to break things either.
> But it might indeed be nicer to use an atomic, without
> any downsides.
Please use WRITE_ONCE() and READ_ONCE(); that's more than sufficient here.
Powered by blists - more mailing lists