Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS, URIBL_BLOCKED,USER_AGENT_NEOMUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AF31BC4360F for ; Wed, 3 Apr 2019 03:11:16 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8081720652 for ; Wed, 3 Apr 2019 03:11:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="iGQ0iYFj" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8081720652 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=yLiyPsg9tIJwf1G06TwvEWHiwD8joZJZN6h2ULNAfJo=; b=iGQ0iYFjHxxjYQ KRKD3tRvUfAkDMcSopP6nXZL5AYX8S87qh6mDtw1Df1rJB67g7wzIut8Sd3ousOaye6SeRLhWUEGK eSwYNjWNTePVwp+pBPDE6ngf3iYhHIcLWV1YPWWuBT4EpJMy4pw0SagxMe5D2A0OFYgDTW8Ab1wXZ NogrW+IO72RhGGWaPyorSLBPrbfq6hGThHIiD0qGJ8ymsCCJwuljRdmbVzy1/fSjHGHr5cjsn7j8S /S1KtIIDNSv+6Xsrk9aS0uzoJLm0gH511Dp1iz5Y5nUtAsk8pDru9twtpO6wgIlSUzjGtKJm1AOlo e+zN88DOVyViylAU2DaA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hBWIz-0000ge-DU; Wed, 03 Apr 2019 03:11:13 +0000 Received: from foss.arm.com ([217.140.101.70]) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hBWIv-0000gL-Km for linux-arm-kernel@lists.infradead.org; Wed, 03 Apr 2019 03:11:10 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9A47E374; Tue, 2 Apr 2019 20:11:08 -0700 (PDT) Received: from blommer (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id ECD1C3F721; Tue, 2 Apr 2019 20:11:03 -0700 (PDT) Date: Wed, 3 Apr 2019 04:10:59 +0100 From: Mark Rutland To: Julien Thierry Subject: Re: [PATCH] arm64: perf: Do not write event type for cycle counter Message-ID: <20190403031058.ouek6ecs2xy4dyct@blommer> References: <1553766545-27692-1-git-send-email-julien.thierry@arm.com> <20190401080217.r27dgjc43xa5ruzr@blommer> <399b05e9-e309-d5c5-4d41-a672eb4c5d5c@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <399b05e9-e309-d5c5-4d41-a672eb4c5d5c@arm.com> User-Agent: NeoMutt/20170113 (1.7.2) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190402_201109_689132_05E207FC X-CRM114-Status: GOOD ( 20.84 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Zijlstra , Catalin Marinas , Jiri Olsa , Will Deacon , Arnaldo Carvalho de Melo , Alexander Shishkin , Ingo Molnar , huawei.libin@huawei.com, guohanjun@huawei.com, Namhyung Kim , liwei391@huawei.com, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Apr 02, 2019 at 04:42:58PM +0100, Julien Thierry wrote: > > > On 01/04/2019 09:02, Mark Rutland wrote: > > On Thu, Mar 28, 2019 at 09:49:05AM +0000, Julien Thierry wrote: > >> Perf events using the dedicated cycle counter do not need to program the > >> event type, the counter only ever counts that kind of events. > > > > Good catch! > > > >> Even worse, trying to program an event type without excluding the > >> cycle counter index might end up in the modification of the type of > >> event counted by another perf event. > > > > IIUC, we shouldn't affect an unrelated event. The ARM ARM says: > > > > When PMSELR_EL0.SEL == 31, this register accesses PMCCFILTR_EL0. > > > > Ah yes, I missed that fact. > > > ... and AFAICT we program PMSELR_EL0 appropriately to select the cycle counter. > > > > I think we're erroneously programming the RES0 bits of PMCCFILTR_EL0, but we're > > also relying on this write to clear all the filter controls in the high bits of > > PMCCFILTR_EL0, which otherwise reset to UNKNOWN values. > > > > Given that, I think we also need to explicitly reset PMCCFILTR_EL0 in > > armv8pmu_reset(). > > > > I just realized that for the PMCCFILTR_EL0 there is also the exclude > control bits for the event. Do those not need to be set when we enable > the event rather than on reset? Yes, you're right. We will need to configure thos, so just doing the reset isn't enough. > Now, I'm thinking what we need is to use a different mask than > EVTYPE_MASK (one that excludes the event bits) when setting > PMCCFILTR_EL0, but still do that when enabling an event using the cycle > counter. > > Does that approach sound correct? Or am I missing something that would > allow us to only set that upon reset? That sounds right to me! It would perhaps be nicer if we could configure event->hwc.config_base to be the raw register value in all cases, but it looks like that's going to be more painful than special-casing the cycle counter here. Thanks, Mark. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel