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 78032C3DA4A for ; Thu, 11 Jul 2024 11:51:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=cxjY6RuKkVBvnWP6/j3ZkXH4A7CjxPaXbnE4ia7U018=; b=mZRhoM/o9/R9GJyxGRyr0I7Kr2 eMqXyD8Ma/HqJ9YEq2gF/QO/jW5M2CR9TYo/IqDBE6rMZjiBGRsZ+rIO9EU0lljLxFXs+El19Ep+Q 9SjfrltQ0R4HsAJR7LBks9pNXKej9J/i0z8C4FaXMx9/WzBX8fq3gLJDeq25Yi7MMlcCZxAvVUWaB IgqSrj3Zim14wWX3qm3nKlxOTTYjvBVMtJ3VHdZLPHGcJUzRh4g/UQpc5LM1FPDQ7NO88rhW6fYUe CaT06YL1BQxOb+LSvoJ7E51G4ritGkLKSVEgHIqO4NzJxH5xw07+L0JMF+GaxP22BhZo1e3rnFZ1C /+c5uEfQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRsKv-0000000DqFW-4AWc; Thu, 11 Jul 2024 11:51:46 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRsKf-0000000DqDG-4Arf for linux-arm-kernel@bombadil.infradead.org; Thu, 11 Jul 2024 11:51:29 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=cxjY6RuKkVBvnWP6/j3ZkXH4A7CjxPaXbnE4ia7U018=; b=CjuOTmGcSItVqRAm5Q500eJiDo 7I9fjGSWOsyEowDdifFzf+CO5UjT93aUWgVDTwOEQaSyC/9eaenJsncnKZafukUaSeaWD+jDqarxq GAjq8UoW2sTnxYSqRTjgjmcU/yapxdJ37vjJeWytSZ2b1F+kTq+VL8G2KT7gwz57KJL9M8A/nmCJ3 Kj5qZTVoHIAITPl7Z8rypdEYOLA52VOig+NLekxf+Q0V9GBg3GcQy0uzsUHADc6ha2oK0RW1uq1eN 4sa/fItDw2nTD8wJKKLzSLPwOjlC7KEg8M+AxyWOqiw4MNDueUEA5sFExX3j5Obx1qwrurtwuBqUZ cvrkhDTg==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRsKZ-000000015sZ-3OMo; Thu, 11 Jul 2024 11:51:24 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 6BB7D30050D; Thu, 11 Jul 2024 13:51:23 +0200 (CEST) Date: Thu, 11 Jul 2024 13:51:23 +0200 From: Peter Zijlstra To: Adrian Hunter Cc: Ingo Molnar , Mark Rutland , Alexander Shishkin , Heiko Carstens , Thomas Richter , Hendrik Brueckner , Suzuki K Poulose , Mike Leach , James Clark , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, Yicong Yang , Jonathan Cameron , Will Deacon , Arnaldo Carvalho de Melo , Jiri Olsa , Namhyung Kim , Ian Rogers , Andi Kleen , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Subject: Re: [PATCH V8 01/12] perf/core: Add aux_pause, aux_resume, aux_start_paused Message-ID: <20240711115123.GK4587@noisy.programming.kicks-ass.net> References: <20240628065111.59718-1-adrian.hunter@intel.com> <20240628065111.59718-2-adrian.hunter@intel.com> <20240701102644.GA20127@noisy.programming.kicks-ass.net> <68796741-f49f-447f-b707-fe4f8391fc17@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <68796741-f49f-447f-b707-fe4f8391fc17@intel.com> 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Jul 11, 2024 at 01:42:33PM +0300, Adrian Hunter wrote: > On 1/07/24 13:26, Peter Zijlstra wrote: > > On Fri, Jun 28, 2024 at 09:51:00AM +0300, Adrian Hunter wrote: > > > >> Add aux_paused to struct perf_event for AUX area events to keep track of > >> the "paused" state. aux_paused is initialized to aux_start_paused. > > > >> @@ -798,6 +810,9 @@ struct perf_event { > >> /* for aux_output events */ > >> struct perf_event *aux_event; > >> > >> + /* for AUX area events */ > >> + unsigned int aux_paused; > >> + > >> void (*destroy)(struct perf_event *); > >> struct rcu_head rcu_head; > >> > > > > Should this not be part of struct hw_perf_event for whatever hw event > > implements this AUX stuff? > > > > In fact, I would expect PERF_HES_PAUSED or something to go in > > perf_event::hw::state. > > Sorry for the slow reply due to vacation. > > There doesn't seem to be anything preventing pause/resume from > "racing" (PMI vs task context) with changes in the aux event state, > so aux_paused must be separate from perf_event::hw::state. So normally, context switching perf would be under pmu_disable(), which should ensure no PMI happens while we're reprogramming the PMU. That said, I think for the aux case we have perf_event_stop() that can race vs PMI, so yeah, bummer. Sticking it in hw_perf_event would be good though. Also perhaps add a comment about exactly why this cannot be in ::state.