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

Ben Hutchings <[email protected]>
Newsgroups org.kernel.lore.historical-speck
Message-ID <[email protected]>
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.

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/I7JWGEQkFAl2jg6YACgkQ57/I7JWG
EQkyAQ//R4vC0vfaMnOrAa5cCju5rCv6rALuarbgIASooeNTTFIyrSC4eBLCg84T
D8g0JsD7wafSEs+K1aTrQq30ctTsu3dxqan0XO/SqeBkOW0853c/Un7XZvqAZBcp
JWM6c7GDQD9xtFfHTREZj1sPi7V/F2Rv3BcTjSoGutdeUWwvveNkEUX3scel7eLb
AUvjzP6Avsdhqc2MFhjwELm9vpI6QW4XgbLYgWwPMdA71m+xqJDBNl19K1v8PxKE
kfpkReomqkyNooD2Mt1OapA5uB6+PTYvoAkGgf88MLJOE8apa4XHWPo4E+8X387g
K33QnsuWO4yb+0L5LXiDonh0V4LXWWijrOFTp+iowA0xy5S0zdtwrJ7DK6uviwYX
b9TtgaRakoqtcBfLTsjgxfj41pv0jsiATXMNJNKeX2FQDHlo76GGk2QAAEF1hTsw
U8y6Mlbd8wAzVLmxMtNNjSEev0Ei+xm0iwhsLZAMDFqnnuO8Gm8q50Yv0QakDq2z
RQhQR9YOVxep8hr2cqEpv2NAcIXxzaqyvxYv8Act2Sb1Mo3bwmO4jFgcrKG1xjGQ
eR2QcgUtg3NknKPnJ0fAlSJYMdKvPSAZEtoDTzOb26xBMj5iS5JVLzRy5LIJkVZq
d4H9TYVyUC5HdWZBBMmb8g0BW7zeqDh/VLQxm1qaPCKjkI4OYo4=
=egyt
-----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.