Re: [PATCH V4 1/3] cpufreq: Make sure frequency transitions are serialized

2014-03-23 Thread Srivatsa S. Bhat
On 03/21/2014 11:37 PM, Catalin Marinas wrote: > On Fri, Mar 21, 2014 at 11:24:16AM +, Srivatsa S. Bhat wrote: >> On 03/21/2014 04:35 PM, Catalin Marinas wrote: >>> On Fri, Mar 21, 2014 at 09:21:02AM +, Viresh Kumar wrote: @Catalin: We have a problem here and need your expert advice. A

Re: [PATCH V4 1/3] cpufreq: Make sure frequency transitions are serialized

2014-03-23 Thread Viresh Kumar
On 21 March 2014 16:35, Catalin Marinas wrote: > The above sequence doesn't say much. As rmk said, the compiler wouldn't > reorder the transition_ongoing write before the function call. I think > most architectures (not sure about Alpha) don't do speculative stores, > so hardware wouldn't reorder

Re: [PATCH V4 1/3] cpufreq: Make sure frequency transitions are serialized

2014-03-21 Thread Viresh Kumar
On 21 March 2014 23:37, Catalin Marinas wrote: > smp_mb() is all about relative ordering. So if you want memory accesses > in post_transition() to be visible to other observers before > transition_ongoing = false, you also need to make sure that the readers > of transition_ongoing have a barrier b

Re: [PATCH V4 1/3] cpufreq: Make sure frequency transitions are serialized

2014-03-21 Thread Catalin Marinas
On Fri, Mar 21, 2014 at 11:24:16AM +, Srivatsa S. Bhat wrote: > On 03/21/2014 04:35 PM, Catalin Marinas wrote: > > On Fri, Mar 21, 2014 at 09:21:02AM +, Viresh Kumar wrote: > >> @Catalin: We have a problem here and need your expert advice. After > >> changing > >> CPU frequency we need to

Re: [PATCH V4 1/3] cpufreq: Make sure frequency transitions are serialized

2014-03-21 Thread Srivatsa S. Bhat
On 03/21/2014 04:35 PM, Catalin Marinas wrote: > On Fri, Mar 21, 2014 at 09:21:02AM +, Viresh Kumar wrote: >> @Catalin: We have a problem here and need your expert advice. After changing >> CPU frequency we need to call this code: >> >> cpufreq_notify_post_transition(); >> policy->transition_on

Re: [PATCH V4 1/3] cpufreq: Make sure frequency transitions are serialized

2014-03-21 Thread Catalin Marinas
On Fri, Mar 21, 2014 at 09:21:02AM +, Viresh Kumar wrote: > @Catalin: We have a problem here and need your expert advice. After changing > CPU frequency we need to call this code: > > cpufreq_notify_post_transition(); > policy->transition_ongoing = false; > > And the sequence must be like thi

Re: [PATCH V4 1/3] cpufreq: Make sure frequency transitions are serialized

2014-03-21 Thread Viresh Kumar
On 21 March 2014 14:51, Viresh Kumar wrote: > @Catalin: We have a problem here and need your expert advice. After changing > CPU frequency we need to call this code: > > cpufreq_notify_post_transition(); > policy->transition_ongoing = false; > > And the sequence must be like this only. Is this gua

Re: [PATCH V4 1/3] cpufreq: Make sure frequency transitions are serialized

2014-03-21 Thread Viresh Kumar
On 21 March 2014 14:12, Srivatsa S. Bhat wrote: >> You can find some information on this in >> Documentation/memory-barriers.txt > > Yep, I know, I have read it several times, but I'm no expert ;-) Not me either :) .. That file has so complex stuff in there that its difficult to understand what's

Re: [PATCH V4 1/3] cpufreq: Make sure frequency transitions are serialized

2014-03-21 Thread Srivatsa S. Bhat
On 03/21/2014 01:28 PM, Viresh Kumar wrote: > On 21 March 2014 13:16, Srivatsa S. Bhat > wrote: >> We need this assignment to happen exactly at this point, that is, *after* >> the call to post_transition() completes and before calling wake_up(). >> >> If the compiler or the CPU reorders the instru

Re: [PATCH V4 1/3] cpufreq: Make sure frequency transitions are serialized

2014-03-21 Thread Viresh Kumar
On 21 March 2014 13:16, Srivatsa S. Bhat wrote: > Wonderful! I was going to do this today, but thanks a lot for taking > care of this for me! I just wanted to finish this long lasting thread as soon as possible. > We need this assignment to happen exactly at this point, that is, *after* > the ca

Re: [PATCH V4 1/3] cpufreq: Make sure frequency transitions are serialized

2014-03-21 Thread Srivatsa S. Bhat
On 03/21/2014 11:04 AM, Viresh Kumar wrote: > From: "Srivatsa S. Bhat" > > Whenever we change the frequency of a CPU, we call the PRECHANGE and > POSTCHANGE > notifiers. They must be serialized, i.e. PRECHANGE and POSTCHANGE notifiers > should strictly alternate, thereby preventing two different

[PATCH V4 1/3] cpufreq: Make sure frequency transitions are serialized

2014-03-20 Thread Viresh Kumar
From: "Srivatsa S. Bhat" Whenever we change the frequency of a CPU, we call the PRECHANGE and POSTCHANGE notifiers. They must be serialized, i.e. PRECHANGE and POSTCHANGE notifiers should strictly alternate, thereby preventing two different sets of PRECHANGE or POSTCHANGE notifiers from interleav