From mboxrd@z Thu Jan 1 00:00:00 1970 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=-7.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 884F8C388F9 for ; Thu, 19 Nov 2020 19:15:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0D5B2238E6 for ; Thu, 19 Nov 2020 19:15:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="JZ5/cADu" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727983AbgKSTPX (ORCPT ); Thu, 19 Nov 2020 14:15:23 -0500 Received: from mail.kernel.org ([198.145.29.99]:35988 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727658AbgKSTPW (ORCPT ); Thu, 19 Nov 2020 14:15:22 -0500 Received: from willie-the-truck (236.31.169.217.in-addr.arpa [217.169.31.236]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 57A9822267; Thu, 19 Nov 2020 19:15:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605813322; bh=xBOcBxca72bKqLRS+dLuVtZoFEY5roI4F6617wVfhho=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=JZ5/cADunQa/pilv7aE73K7zgv2+enzkoL08MCGDGb6j5swSxLGdq08YG06KdJuPK F/Ikk9M3BO+W6pQYpeE/JmygTm0RN0pRAPnoMK2QjUNJnJpeHu0ssTTO+1HQ/VdAOR 2ESa5UIG1hRMaNHOu8Ry2U3PUEMpev0OY6/lEXqU= Date: Thu, 19 Nov 2020 19:15:15 +0000 From: Will Deacon To: Mark Rutland Cc: Rob Herring , Catalin Marinas , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Jiri Olsa , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Alexander Shishkin , Namhyung Kim , Raphael Gault , Jonathan Cameron , Ian Rogers , honnappa.nagarahalli@arm.com, Itaru Kitayama Subject: Re: [PATCH v4 2/9] arm64: perf: Enable pmu counter direct access for perf event on armv8 Message-ID: <20201119191515.GA4906@willie-the-truck> References: <20201001140116.651970-1-robh@kernel.org> <20201001140116.651970-3-robh@kernel.org> <20201113180633.GE44988@C02TD0UTHF1T.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201113180633.GE44988@C02TD0UTHF1T.local> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 13, 2020 at 06:06:33PM +0000, Mark Rutland wrote: > On Thu, Oct 01, 2020 at 09:01:09AM -0500, Rob Herring wrote: > > +static void armv8pmu_event_unmapped(struct perf_event *event, struct mm_struct *mm) > > +{ > > + if (!(event->hw.flags & ARMPMU_EL0_RD_CNTR)) > > + return; > > + > > + if (atomic_dec_and_test(&mm->context.pmu_direct_access)) > > + on_each_cpu_mask(mm_cpumask(mm), refresh_pmuserenr, NULL, 1); > > +} > > I didn't think we kept our mm_cpumask() up-to-date in all cases on > arm64, so I'm not sure we can use it like this. > > Will, can you confirm either way? We don't update mm_cpumask() as the cost of the atomic showed up in some benchmarks I did years ago and we've never had any need for the thing anyway because out TLB invalidation is one or all. Will From mboxrd@z Thu Jan 1 00:00:00 1970 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=-5.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no 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 CEC8CC388F9 for ; Thu, 19 Nov 2020 19:15:54 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 3C80122267 for ; Thu, 19 Nov 2020 19:15:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="NMi8NOk6"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="JZ5/cADu" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3C80122267 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+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=merlin.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=t6Qz8vsI6lpEJz0VBanEY66tfDFdIGfRLF3jCoxHRq4=; b=NMi8NOk6BCmZbNUqosHV4Kn9f +Tnr+S9vb8Uw54uq61MIlqNO2kbfs8M/GKaopAZzxfErLFIumgjtGpl6sl39UKp/WYV0tPyEUziEw g0JKBtSG6zj9jKycIn56/CD+xKjGHRcEqIB48/o7dhQkTOz/RIXtLKeOfnFaV1t2fM8XJaLf3ORuj P4+fMDm4Y8ZEEhh8Pqf2Z1GCX/Bp1BJKLOtF1+2oNNuCXNo847nRhWGCVRb0ZshUnTDp1sT6sXooc HlV5aU3j+XO7BWYyMPg45+ccBSgjQEpngYAsgoajUwlnE8ppL/Vohdsak+fLIvaM/O5tMnEGNykaZ pUCa+71Fg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kfpOw-0005vD-GQ; Thu, 19 Nov 2020 19:15:26 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kfpOt-0005u0-Ho for linux-arm-kernel@lists.infradead.org; Thu, 19 Nov 2020 19:15:24 +0000 Received: from willie-the-truck (236.31.169.217.in-addr.arpa [217.169.31.236]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 57A9822267; Thu, 19 Nov 2020 19:15:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605813322; bh=xBOcBxca72bKqLRS+dLuVtZoFEY5roI4F6617wVfhho=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=JZ5/cADunQa/pilv7aE73K7zgv2+enzkoL08MCGDGb6j5swSxLGdq08YG06KdJuPK F/Ikk9M3BO+W6pQYpeE/JmygTm0RN0pRAPnoMK2QjUNJnJpeHu0ssTTO+1HQ/VdAOR 2ESa5UIG1hRMaNHOu8Ry2U3PUEMpev0OY6/lEXqU= Date: Thu, 19 Nov 2020 19:15:15 +0000 From: Will Deacon To: Mark Rutland Subject: Re: [PATCH v4 2/9] arm64: perf: Enable pmu counter direct access for perf event on armv8 Message-ID: <20201119191515.GA4906@willie-the-truck> References: <20201001140116.651970-1-robh@kernel.org> <20201001140116.651970-3-robh@kernel.org> <20201113180633.GE44988@C02TD0UTHF1T.local> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20201113180633.GE44988@C02TD0UTHF1T.local> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201119_141524_096160_C959BCA8 X-CRM114-Status: GOOD ( 16.71 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rob Herring , Ian Rogers , Peter Zijlstra , Catalin Marinas , linux-kernel@vger.kernel.org, Arnaldo Carvalho de Melo , Alexander Shishkin , Raphael Gault , Ingo Molnar , honnappa.nagarahalli@arm.com, Jonathan Cameron , Namhyung Kim , Itaru Kitayama , Jiri Olsa , 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+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Nov 13, 2020 at 06:06:33PM +0000, Mark Rutland wrote: > On Thu, Oct 01, 2020 at 09:01:09AM -0500, Rob Herring wrote: > > +static void armv8pmu_event_unmapped(struct perf_event *event, struct mm_struct *mm) > > +{ > > + if (!(event->hw.flags & ARMPMU_EL0_RD_CNTR)) > > + return; > > + > > + if (atomic_dec_and_test(&mm->context.pmu_direct_access)) > > + on_each_cpu_mask(mm_cpumask(mm), refresh_pmuserenr, NULL, 1); > > +} > > I didn't think we kept our mm_cpumask() up-to-date in all cases on > arm64, so I'm not sure we can use it like this. > > Will, can you confirm either way? We don't update mm_cpumask() as the cost of the atomic showed up in some benchmarks I did years ago and we've never had any need for the thing anyway because out TLB invalidation is one or all. Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel