[MODERATED] Re: [PATCH v6 9/9] TAAv6 9

Ben Hutchings <[email protected]>
Newsgroups org.kernel.lore.historical-speck
Message-ID <[email protected]>
On Sun, 2019-10-13 at 21:05 +0100, speck for Ben Hutchings wrote:
> On Fri, 2019-10-11 at 18:41 -0700, speck for Pawan Gupta wrote:
> > On Thu, Oct 10, 2019 at 08:54:12AM +0200, speck for Greg KH wrote:
> [...]
> > > > +/* Take tsx_mutex lock and update tsx_ctrl_state when calling this function */
> > > > +static void tsx_update_on_each_cpu(bool val)
> > > > +{
> > > > +	get_online_cpus();
> > > > +	on_each_cpu(tsx_update_this_cpu, (void *)val, 1);
> > > > +	put_online_cpus();
> > > > +}
> > > 
> > > Why take the lock?  This is only called in one place.
> > 
> > So that TSX_CTRL MSR state stays consistent across all CPUs between
> > multiple on_each_cpu() calls. Otherwise overlapping conflicting TSX_CTRL MSR
> > writes could end up in some CPUs with TSX enabled and others with TSX
> > disabled.
> [...]
> 
> get_online_cpus() is a read lock, so it doesn't prevent concurrent
> updates.

Sorry, now I realise "the lock" meant tsx_mutex as mentioned in the
comment.

Ben.

-- 
Ben Hutchings
The obvious mathematical breakthrough [to break modern encryption]
would be development of an easy way to factor large prime numbers.
                                                           - Bill Gates
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEErCspvTSmr92z9o8157/I7JWGEQkFAl2jkFwACgkQ57/I7JWG
EQlSURAAw8uIdPYscuSfDFr7rlp0es4ii4GUmWfb82qzho2SxzjqsReGbFJO3yrv
BOx7TbARZ8Oz5c5WFTOVSsk9Z8uk63QM2c9QM7daeHI5Ue+IWNpb0YAntuzMvFYX
NeBM9uLEqSBg3T7Ok4zrcRsbjEoNAUanzvu1J5cNeN+h3GgXMMe59/Ibu2bsYdRz
/01nU0uL8o9SWBGvf0c1nLAvitbEdKdERYcpljeacGTVp+w7GXfMbPTRRILRUtdR
ZXw/xDQ7EbIAvKik8WFqDzW8UMBJAJomiyTNWGBWwhfnZK4flcaaJu5LmJJhkaBs
20t6caX8N3V4eeBu6NeF8NnikbERGYLUBKQSFqZZSdEPWsZ2IcuMQabuFAAR8JY9
Z5GOmTgRMfSQakrQVaAfANkZUb0JcLDTq4EU5706CIr/PGVy4aB/977xmAuo/Dct
KqTshLqS7ZmkNdn5ME5W6XRUdEV9rYiCyrvaZnzKIdLpA6od8Uhi03P+pp+EdsoS
D7P5MBlCN9SHoNUjoYmVvrTKEVeAnGGutbUslsLAQBlWgWSUAH+039VkK35nY53K
P51TKH1EmC2TFugUlSq71HHzppBW84proQ/IW3Pczm3QZZhUosxpIJi+Zj8soCn5
4VsceM4LykaO8XEjGZwBhbe8S4lIJAWpbx1dV4XS+Q1BWJCOdSs=
=nADH
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.