From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.linutronix.de (146.0.238.70:993) by crypto-ml.lab.linutronix.de with IMAP4-SSL for ; 08 Feb 2019 08:50:56 -0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by Galois.linutronix.de with esmtps (TLS1.2:RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1gs1s6-0004vI-7H for speck@linutronix.de; Fri, 08 Feb 2019 09:50:55 +0100 Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1gs1s5-0002CF-2I for speck@linutronix.de; Fri, 08 Feb 2019 08:50:53 +0000 Date: Fri, 8 Feb 2019 09:50:50 +0100 From: Peter Zijlstra Subject: [MODERATED] Re: [PATCH v3 2/6] PERFv3 Message-ID: <20190208085050.GJ32477@hirez.programming.kicks-ass.net> References: <3dd5d6e2bc9ac53f826c251c68ce84fcc79a6872.1549582769.git.ak@linux.intel.com> MIME-Version: 1.0 In-Reply-To: <3dd5d6e2bc9ac53f826c251c68ce84fcc79a6872.1549582769.git.ak@linux.intel.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit To: speck@linutronix.de List-ID: On Thu, Feb 07, 2019 at 03:41:04PM -0800, speck for Andi Kleen wrote: > +static struct event_constraint * > +skl_get_event_constraints(struct cpu_hw_events *cpuc, int idx, > + struct perf_event *event) > +{ > + struct event_constraint *c; > + > + c = hsw_get_event_constraints(cpuc, idx, event); > + > + if (!perf_enable_all_counters) { > + cpuc->counter3_constraint = *c; > + c = &cpuc->counter3_constraint; > + > + /* > + * Without TFA we must not use PMC3. > + */ > + __clear_bit(3, c->idxmsk); > + } > + > + return c; > +} This is obviously broken... what if all 6 events are in use and have different constraints?