Return-Path: Received: from mail.linutronix.de (146.0.238.70:993) by crypto-ml.lab.linutronix.de with IMAP4-SSL for ; 05 Feb 2019 16:52:13 -0000 Received: from mga12.intel.com ([192.55.52.136]) by Galois.linutronix.de with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1gr3xE-0002Jo-Gk for speck@linutronix.de; Tue, 05 Feb 2019 17:52:12 +0100 Date: Tue, 5 Feb 2019 08:52:09 -0800 From: Andi Kleen Subject: [MODERATED] Re: [PATCH v1 4/9] PERFv1 2 Message-ID: <20190205165209.GJ31598@tassilo.jf.intel.com> References: <20190205151657.GW17528@hirez.programming.kicks-ass.net> MIME-Version: 1.0 In-Reply-To: <20190205151657.GW17528@hirez.programming.kicks-ass.net> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit To: speck@linutronix.de List-ID: On Tue, Feb 05, 2019 at 04:16:57PM +0100, speck for Peter Zijlstra wrote: > On Mon, Feb 04, 2019 at 05:14:05PM -0800, speck for Andi Kleen wrote: > > +static bool __use_counter3(struct perf_event *event) > > +{ > > + return event->hw.flags & PERF_X86_EVENT_ABORT_TSX; > > +} > > + > > +static bool use_counter3(struct perf_event *event) > > +{ > > + return __use_counter3(event) || > > + (event->group_leader && __use_counter3(event->group_leader)); > > +} > > See; I _really_ hate this per-event noodling. > > Why not just have the sysctl tell us if PMC3 is available or not and set > FRA when PMC3 gets selected, teh end. I was really trying to allow non root users to control this. The experience with sysctls in perf in the past was usually that non root users need to use them frequently, and "sudo" is not a solution for everyone. It would be needed for the proper KVM support at least, unless you want KVM to toggle the sysctl. -Andi