[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [V6] x86/cpuidle: get accurate C0 value with xenpm tool



On Thu, 2015-05-21 at 07:50 +0100, Jan Beulich wrote:
> >>> On 21.05.15 at 08:40, <huaitong.han@xxxxxxxxx> wrote:
> > @@ -329,7 +340,7 @@ static uint64_t acpi_pm_ticks_elapsed(uint64_t t1, 
> > uint64_t t2)
> >  }
> >  
> >  uint64_t (*__read_mostly cpuidle_get_tick)(void) = get_acpi_pm_tick;
> > -static uint64_t (*__read_mostly ticks_elapsed)(uint64_t, uint64_t)
> > +uint64_t (*__read_mostly ticks_elapsed)(uint64_t, uint64_t)
> >      = acpi_pm_ticks_elapsed;
> 
> Why? (And if a change like this was needed, you'd have to rename
> the symbol to become identifiable as cpuidle specific, just like its
> neighbor is).
For code compilation, because the ticks_elapsed in the middle of the
cpu_idle.c will be used by print_acpi_power in the beginning of the
cpu_idle.c, other solution is moving hunk not just the functions to
right place.
Accepted, the second solution will be used.

> 
> > @@ -1203,13 +1235,24 @@ int pmstat_get_cx_stat(uint32_t cpuid, struct 
> > pm_cx_stat *stat)
> >  
> >          stat->nr = power->count;
> >  
> > +        spin_lock_irq(&power->stat_lock);
> > +        current_tick = cpuidle_get_tick();
> > +        current_stime = 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);
> > +            res[i] = power->states[i].time;
> > +        }
> > +        last_state_update_tick = power->last_state_update_tick;
> > +        stat->last = power->last_state ? power->last_state->idx : 0;
> > +        spin_unlock_irq(&power->stat_lock);
> >  
> > +        usage[stat->last]++;
> > +        res[stat->last] += ticks_elapsed(last_state_update_tick, 
> > current_tick);
> > +
> > +        for ( i = 1; i < nr; i++ )
> > +        {
> > +            res[i] = tick_to_ns((uint64_t)res[i]);
> 
> Completely pointless cast.
Accepted, delete uint64_t.
> 
> Jan
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.