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