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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 62447C433F5 for ; Tue, 7 Dec 2021 11:49:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc: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=NkgyJwUAAEzo+ru9SBbw8Z9FzKYk88V1dyZZW5uaKEk=; b=0GNMQMA31iodOg fmBrunBytE7t9R7+A5MOd0Ku7E+HJrE2ekjDys3Wy6Ki05oYffZHcvjO0l3FzQ+LlqA7vGEAp55Y1 KR0NxkqMG/Wyt4wWDcaXlgO0FPX7dfIJFs7TiU71TKLB1dLPyoVeoDwnt4HEBEE7cd7BPgbIFiets 2T1eTJM8vEXCCdsU+3VomAryVKum2k88M89opMFuqFahdZlHNlnJsiClG1bg7ktm0yuumIrinXhTm c/pWhPnEq9SELWkA0dKTQhRYz9R65pe18ZeHF07gIRPv2+LJzRUsX6vfKPI8qLTqZEEJHL0JjgTsI oT3SUnG22BKvVnpDcHKQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1muYxB-008IH2-6h; Tue, 07 Dec 2021 11:48:13 +0000 Received: from sin.source.kernel.org ([2604:1380:40e1:4800::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1muYx7-008IFw-GQ for linux-arm-kernel@lists.infradead.org; Tue, 07 Dec 2021 11:48:11 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id C731BCE1A80; Tue, 7 Dec 2021 11:48:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 27B2CC341C3; Tue, 7 Dec 2021 11:48:03 +0000 (UTC) Date: Tue, 7 Dec 2021 11:48:00 +0000 From: Catalin Marinas To: Leo Yan Cc: Kees Cook , Will Deacon , Mark Rutland , Ard Biesheuvel , Sami Tolvanen , Nicholas Piggin , James Morse , Marc Zyngier , Joey Gouly , Peter Collingbourne , Vincenzo Frascino , "Peter Zijlstra (Intel)" , Stephane Eranian , James Clark , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [RFCv1 4/4] perf: arm_spe: Dynamically switch PID tracing to contextidr Message-ID: References: <20211021134530.206216-1-leo.yan@linaro.org> <20211021134530.206216-5-leo.yan@linaro.org> <202110210848.35971643C6@keescook> <20211101152835.GB375622@leoy-ThinkPad-X240s> <20211205135103.GA42658@leoy-ThinkPad-X240s> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20211205135103.GA42658@leoy-ThinkPad-X240s> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211207_034809_761116_4BAEE0B8 X-CRM114-Status: GOOD ( 20.30 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 Sun, Dec 05, 2021 at 09:51:03PM +0800, Leo Yan wrote: > On Fri, Dec 03, 2021 at 04:22:42PM +0000, Catalin Marinas wrote: > > What's the cost of always enabling CONFIG_PID_IN_CONTEXTIDR? If it's > > negligible, I'd not bother at all with any of the enabling/disabling. > > Yes, I compared performance for PID tracing with always enabling and > disabling CONFIG_PID_IN_CONTEXTIDR, and also compared with using > static key for enabling/disabling PID tracing. The result shows the > cost is negligible based on the benchmark 'perf bench sched'. > > Please see the detailed data in below link (note the testing results > came from my Juno board): > https://lore.kernel.org/lkml/20211021134530.206216-1-leo.yan@linaro.org/ The table wasn't entirely clear to me. So the dis/enb benchmarks are without this patchset applied. There seems to be a minor drop but it's probably noise. Anyway, do we need this patchset or we just make CONFIG_PID_IN_CONTEXTIDR default to y? > > Another question: can you run multiple instances of SPE for different > > threads on different CPUs? What happens to the global contextidr_in_use > > key when one of them stops? > > No, I only can launch one instance for Arm SPE event via perf tool; when > I tried to launch a second instance, perf tool reports failure: > > The sys_perf_event_open() syscall returned with 16 (Device or resource > busy) for event (arm_spe_0/load_filter=1,store_filter=1/u). [...] > Alternatively, I'd like give several examples for contextidr_in_use key > values when run different perf modes. [...] > Hope these three cases can demonstrate the usage for contextidr_in_use > static key. OK, so we can have multiple uses of PID in CONTEXTIDR. Since static_branch_inc() is refcounted, we get away with this but the downside is that a CPU won't notice until its next thread switch. -- Catalin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel