From: "Jan Beulich" Subject: Re: [V4] x86/cpuidle: get accurate C0 value with xenpm tool Date: Tue, 12 May 2015 12:43:50 +0100 Message-ID: <5552039602000078000796C2@mail.emea.novell.com> References: <1431336895-4987-1-git-send-email-huaitong.han@intel.com> <5550AA460200007800078E5B@mail.emea.novell.com> <1431353567.4542.25.camel@huaitong-MOBL.ccr.corp.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1431353567.4542.25.camel@huaitong-MOBL.ccr.corp.intel.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Huaitong Han Cc: "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org >>> On 11.05.15 at 16:12, wrote: > On Mon, 2015-05-11 at 12:10 +0100, Jan Beulich wrote: >> >>> On 11.05.15 at 11:34, wrote: >> > @@ -1203,16 +1226,18 @@ int pmstat_get_cx_stat(uint32_t cpuid, struct pm_cx_stat *stat) >> > >> > stat->nr = power->count; >> > >> > + spin_lock_irq(&power->stat_lock); >> > + now = NOW(); >> > for ( i = 1; i < nr; i++ ) >> > { >> > - spin_lock_irq(&power->stat_lock); >> > usage[i] = power->states[i].usage; >> > res[i] = tick_to_ns(power->states[i].time); >> > - spin_unlock_irq(&power->stat_lock); >> > - >> > idle_usage += usage[i]; >> > idle_res += res[i]; >> > } >> > + last_state_update_time = tick_to_ns(power->last_state_update_tick); > This "tick_to_ns" still sits in a locked region. for moving out locked > region, a temp variable named "last_state_update_tick" need be defined, > the coding style may be not look nice as there is a variable named > "last_state_update_time". I don't see the need for yet another variable. If need be, just rename the existing one to ..._tick. Jan