Return-Path: Received: from mail.linutronix.de (146.0.238.70:993) by crypto-ml.lab.linutronix.de with IMAP4-SSL for ; 07 Feb 2019 13:48:40 -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 1grk2g-0002Km-KL for speck@linutronix.de; Thu, 07 Feb 2019 14:48:38 +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 1grk2f-0004va-8I for speck@linutronix.de; Thu, 07 Feb 2019 13:48:37 +0000 Date: Thu, 7 Feb 2019 14:48:35 +0100 From: Peter Zijlstra Subject: [MODERATED] Re: [PATCH v2 0/8] PERFv2 Message-ID: <20190207134835.GB32534@hirez.programming.kicks-ass.net> References: <20190207132709.GA32477@hirez.programming.kicks-ass.net> <20190207133348.GA32534@hirez.programming.kicks-ass.net> MIME-Version: 1.0 In-Reply-To: <20190207133348.GA32534@hirez.programming.kicks-ass.net> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit To: speck@linutronix.de List-ID: On Thu, Feb 07, 2019 at 02:33:48PM +0100, Peter Zijlstra 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 (!force_rtm_abort) { > + /* > + * Without TFA we must not use PMC3. > + */ > + c->idxmsk64 &= ~(1ULL << 3); > + } else { > + /* > + * Restore PMC3 to match PMC2; there is no SKL constraint that > + * has PMC2 but not PMC3. > + */ > + c->idxmsk64 |= (c->idxmsk64 & (1ULL << 2)) << 1; > + } c->weight = hweight64(c->idxmsk64); > + > + return c; > +} which we can of course optimize by adding a u64 mask variable and testing if we actually changed anything.