Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1314261

Re: [PATCH v2 5/5] perf/x86/amd/power: Add AMD accumulated power reporting mechanism

From Peter Zijlstra <peterz@infradead.org>
Newsgroups linux.kernel
Subject Re: [PATCH v2 5/5] perf/x86/amd/power: Add AMD accumulated power reporting mechanism
Date 2016-01-21 16:20 +0100
Message-ID <qTpbH-72a-5@gated-at.bofh.it> (permalink)
References (3 earlier) <qSXft-4qR-31@gated-at.bofh.it> <qSXft-4qR-29@gated-at.bofh.it> <qTjpE-39M-19@gated-at.bofh.it> <qTjpE-39M-17@gated-at.bofh.it> <qTpbH-72a-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, Jan 21, 2016 at 10:42:35PM +0800, Huang Rui wrote:
> > > @@ -164,14 +171,14 @@ static int pmu_event_add(struct perf_event *event, int mode)
> > >  	struct hw_perf_event *hwc = &event->hw;
> > >  	unsigned long flags;
> > >  
> > > -	spin_lock_irqsave(&pmu->lock, flags);
> > > +	raw_spin_lock_irqsave(&pmu->lock, flags);
> > >  
> > >  	hwc->state = PERF_HES_UPTODATE | PERF_HES_STOPPED;
> > >  
> > >  	if (mode & PERF_EF_START)
> > >  		__pmu_event_start(pmu, event);
> > >  
> > > -	spin_unlock_irqrestore(&pmu->lock, flags);
> > > +	raw_spin_unlock_irqrestore(&pmu->lock, flags);
> > >  
> > >  	return 0;
> > >  }
> > 
> > So for these 4 {start,stop,add,del} you can drop the irqsave/irqrestore
> > thing as its guaranteed that IRQs will be disabled.
> > 
> 
> OK, I will remove the lock.

No, the lock seems needed, as the list is global. Just the
irqsave/irqrestore part is superfluous.

> > > +	cpumask_clear(pmu->mask);
> > > +	cpumask_clear(pmu->tmp_mask);
> > >  
> > >  	for (i = 0; i < cores_per_cu; i++)
> > > +		cpumask_set_cpu(i, pmu->mask);
> > >  
> > > +	cpumask_shift_left(pmu->mask, pmu->mask, cu * cores_per_cu);
> > 
> > Couldn't you simply use topology_sibling_cpumask(cpu) instead?
> > 
> 
> Looks like we couldn't. That's because cores number per cu (compute
> unit) is got by CPUID 0x8000001e EBX. That relies on the CPU hardware.

Borislav? I thought the AMD compute unit stuff was modeled as the SMT
topology.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH v2 5/5] perf/x86/amd/power: Add AMD accumulated power  reporting mechanism Peter Zijlstra <peterz@infradead.org> - 2016-01-19 13:20 +0100
  Re: [PATCH v2 5/5] perf/x86/amd/power: Add AMD accumulated power  reporting mechanism Peter Zijlstra <peterz@infradead.org> - 2016-01-20 10:30 +0100
    Re: [PATCH v2 5/5] perf/x86/amd/power: Add AMD accumulated power  reporting mechanism Peter Zijlstra <peterz@infradead.org> - 2016-01-21 10:10 +0100
      Re: [PATCH v2 5/5] perf/x86/amd/power: Add AMD accumulated power  reporting mechanism Peter Zijlstra <peterz@infradead.org> - 2016-01-21 16:20 +0100
        Re: [PATCH v2 5/5] perf/x86/amd/power: Add AMD accumulated power  reporting mechanism Peter Zijlstra <peterz@infradead.org> - 2016-01-21 17:00 +0100
        Re: [PATCH v2 5/5] perf/x86/amd/power: Add AMD accumulated power  reporting mechanism Borislav Petkov <bp@alien8.de> - 2016-01-21 18:10 +0100
          Re: [PATCH v2 5/5] perf/x86/amd/power: Add AMD accumulated power  reporting mechanism Borislav Petkov <bp@alien8.de> - 2016-01-22 19:00 +0100

csiph-web