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


Groups > linux.kernel > #1470629 > unrolled thread

Re: [PATCH] arm/perf: Fix pmu percpu irq handling at hotplug.

Started byWill Deacon <will.deacon@arm.com>
First post2016-08-26 11:50 +0200
Last post2016-08-31 16:50 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH] arm/perf: Fix pmu percpu irq handling at hotplug. Will Deacon <will.deacon@arm.com> - 2016-08-26 11:50 +0200
    Re: [PATCH] arm/perf: Fix pmu percpu irq handling at hotplug. Mark Rutland <mark.rutland@arm.com> - 2016-08-30 19:40 +0200
      Re: [PATCH] arm/perf: Fix pmu percpu irq handling at hotplug. Will Deacon <will.deacon@arm.com> - 2016-08-31 16:50 +0200

#1470629 — Re: [PATCH] arm/perf: Fix pmu percpu irq handling at hotplug.

FromWill Deacon <will.deacon@arm.com>
Date2016-08-26 11:50 +0200
SubjectRe: [PATCH] arm/perf: Fix pmu percpu irq handling at hotplug.
Message-ID<salVT-5e5-1@gated-at.bofh.it>
Mark,

On Fri, Aug 19, 2016 at 03:25:14PM +0100, Mark Rutland wrote:
> On Thu, Aug 18, 2016 at 01:24:38PM -0700, Yabin Cui wrote:
> >    If the cpu pmu is using a percpu irq:                                    
> >          
> >    1. When a cpu is down, we should disable pmu irq on                      
> >    that cpu. Otherwise, if the cpu is still down when                        
> >    the last perf event is released, the pmu irq can't                        
> >    be freed. Because the irq is still enabled on the                        
> >    offlined cpu. And following perf_event_open()                            
> >    syscalls will fail.                                                      
> >
> >    2. When a cpu is up, we should enable pmu irq on                          
> >    that cpu. Otherwise, profiling tools can't sample                        
> >    events on the cpu before all perf events are                              
> >    released, because pmu irq is disabled on that cpu.                        
> 
> It also looks like if a CPU is taken down while events are active, a
> non-percpu interrupt will get migrated to another CPU, yet we don't
> retarget it if/when the CPU is brought back online. So we have at least
> three bugs with IRQ manipulation around hotplug.
> 
> Rather than adding more moving parts to the IRQ manipulation logic, I'd
> rather we rework the IRQ manipulation logic to:
> 
> * At probe time, request all the interrupts. If we can't, bail out and
>   fail the probe.
> 
> * Upon hotplug in (and at probe time), configure the affinity and
>   enable the relevant interrupt(s).
> 
> * Upon hotplug out, disable the relevant interrupt.
> 
> That way we have fewer moving parts that need to interact with each
> other (e.g. we don't need to inhibit hotplug in places), and we know
> early whether things will or will not work.
> 
> The {reserve,release}_hardware dance is largely a legacy thing that was
> there to cater for sharing the PMU with other subsystems, and we should
> be able to get rid of it.
> 
> I'm taking a look at doing the above, but I don't yet have a patch.

Any update on this? I'd quite like to do *something* to fix the issues
reported here.

Will

[toc] | [next] | [standalone]


#1472685

FromMark Rutland <mark.rutland@arm.com>
Date2016-08-30 19:40 +0200
Message-ID<sbVaW-7T7-27@gated-at.bofh.it>
In reply to#1470629
Hi,

On Fri, Aug 26, 2016 at 10:48:00AM +0100, Will Deacon wrote:
> On Fri, Aug 19, 2016 at 03:25:14PM +0100, Mark Rutland wrote:
> > On Thu, Aug 18, 2016 at 01:24:38PM -0700, Yabin Cui wrote:
> > >    If the cpu pmu is using a percpu irq:                                    
> > >          
> > >    1. When a cpu is down, we should disable pmu irq on                      
> > >    that cpu. Otherwise, if the cpu is still down when                        
> > >    the last perf event is released, the pmu irq can't                        
> > >    be freed. Because the irq is still enabled on the                        
> > >    offlined cpu. And following perf_event_open()                            
> > >    syscalls will fail.                                                      
> > >
> > >    2. When a cpu is up, we should enable pmu irq on                          
> > >    that cpu. Otherwise, profiling tools can't sample                        
> > >    events on the cpu before all perf events are                              
> > >    released, because pmu irq is disabled on that cpu.                        

[...]

> > Rather than adding more moving parts to the IRQ manipulation logic, I'd
> > rather we rework the IRQ manipulation logic to:
> > 
> > * At probe time, request all the interrupts. If we can't, bail out and
> >   fail the probe.
> > 
> > * Upon hotplug in (and at probe time), configure the affinity and
> >   enable the relevant interrupt(s).
> > 
> > * Upon hotplug out, disable the relevant interrupt.

> > I'm taking a look at doing the above, but I don't yet have a patch.
> 
> Any update on this? I'd quite like to do *something* to fix the issues
> reported here.

Apologies for the delay.

I've been away from my development hardware for the last week, so I
ahven't fought with this for a few days.

Given it's requiring that I practically rewrite of_pmu_irq_cfg and
friends, it may be better to take Yabin's patch for the timebeing if you
want a quick fix for this particular issue.

Thanks,
Mark.

[toc] | [prev] | [next] | [standalone]


#1473558

FromWill Deacon <will.deacon@arm.com>
Date2016-08-31 16:50 +0200
Message-ID<sceZX-3Ew-5@gated-at.bofh.it>
In reply to#1472685
On Tue, Aug 30, 2016 at 06:32:25PM +0100, Mark Rutland wrote:
> On Fri, Aug 26, 2016 at 10:48:00AM +0100, Will Deacon wrote:
> > On Fri, Aug 19, 2016 at 03:25:14PM +0100, Mark Rutland wrote:
> > > On Thu, Aug 18, 2016 at 01:24:38PM -0700, Yabin Cui wrote:
> > > >    If the cpu pmu is using a percpu irq:                                    
> > > >          
> > > >    1. When a cpu is down, we should disable pmu irq on                      
> > > >    that cpu. Otherwise, if the cpu is still down when                        
> > > >    the last perf event is released, the pmu irq can't                        
> > > >    be freed. Because the irq is still enabled on the                        
> > > >    offlined cpu. And following perf_event_open()                            
> > > >    syscalls will fail.                                                      
> > > >
> > > >    2. When a cpu is up, we should enable pmu irq on                          
> > > >    that cpu. Otherwise, profiling tools can't sample                        
> > > >    events on the cpu before all perf events are                              
> > > >    released, because pmu irq is disabled on that cpu.                        
> 
> [...]
> 
> > > Rather than adding more moving parts to the IRQ manipulation logic, I'd
> > > rather we rework the IRQ manipulation logic to:
> > > 
> > > * At probe time, request all the interrupts. If we can't, bail out and
> > >   fail the probe.
> > > 
> > > * Upon hotplug in (and at probe time), configure the affinity and
> > >   enable the relevant interrupt(s).
> > > 
> > > * Upon hotplug out, disable the relevant interrupt.
> 
> > > I'm taking a look at doing the above, but I don't yet have a patch.
> > 
> > Any update on this? I'd quite like to do *something* to fix the issues
> > reported here.
> 
> Apologies for the delay.
> 
> I've been away from my development hardware for the last week, so I
> ahven't fought with this for a few days.
> 
> Given it's requiring that I practically rewrite of_pmu_irq_cfg and
> friends, it may be better to take Yabin's patch for the timebeing if you
> want a quick fix for this particular issue.

Right, but that patch is totally mangled :/

I guess this will have to wait until somebody has time to rework the IRQ
code.

Will

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web