Messages in this thread | | | Subject | RE: [patch] x86, perf_counter, bts: add bts to perf_counter | From | Peter Zijlstra <> | Date | Fri, 07 Aug 2009 13:57:09 +0200 |
| |
On Fri, 2009-08-07 at 12:51 +0100, Metzger, Markus T wrote: > >-----Original Message----- > >From: Peter Zijlstra [mailto:a.p.zijlstra@chello.nl] > >Sent: Friday, August 07, 2009 1:45 PM > >To: Metzger, Markus T > >Cc: linux-kernel@vger.kernel.org; mingo@elte.hu; tglx@linutronix.de; hpa@zytor.com; > >markus.t.metzger@gmail.com; oleg@redhat.com > >Subject: Re: [patch] x86, perf_counter, bts: add bts to perf_counter > > > >On Fri, 2009-08-07 at 09:22 +0200, Markus Metzger wrote: > >> @@ -721,9 +903,13 @@ static int __hw_perf_counter_init(struct > >> err = 0; > >> if (!atomic_inc_not_zero(&active_counters)) { > >> mutex_lock(&pmc_reserve_mutex); > >> - if (atomic_read(&active_counters) == 0 && !reserve_pmc_hardware()) > >> - err = -EBUSY; > >> - else > >> + if (atomic_read(&active_counters) == 0) { > >> + if (!reserve_pmc_hardware()) > >> + err = -EBUSY; > >> + else > >> + reserve_bts_hardware(); > >> + } > >> + if (!err) > >> atomic_inc(&active_counters); > >> mutex_unlock(&pmc_reserve_mutex); > >> } > > > >You loose the reserve_bts_hardware() error case there. > > > That had been intentional since I consider BTS somewhat optional. In case it is not available or > fails to initialize, e.g. out of memory, we fall back to normal profiling. > > Now that I think about it again, I guess that's not what a (debugger) user would expect. > An error might be more appropriate in that case. > > I'll change it.
If there's hardware that supports intel perfmon v2+ but doesn't have BTS (I don't think so) then we shouldn't fail it hard on not present.
But if the BTS stuff should always be present on the hardware then we can indeed unconditionally fail.
| |