Received: by 2002:a05:7412:d024:b0:f9:90c9:de9f with SMTP id bd36csp125908rdb; Wed, 20 Dec 2023 07:57:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IGDmCGVlzBjUNyvRued695/JhuRKC2+q/+uxkP+rI/W/TO9b5lJSaRCfo3Y5FjACKhHZWc4 X-Received: by 2002:a17:902:c950:b0:1d0:6ffe:a09 with SMTP id i16-20020a170902c95000b001d06ffe0a09mr26129302pla.103.1703087847924; Wed, 20 Dec 2023 07:57:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703087847; cv=none; d=google.com; s=arc-20160816; b=YKkbh4Ydwz8lBe0g8hwnWOi/3yLJHubKWb+/ZtT+nDiWZNcYZulKegfzkvMl4TKFOZ uzhWOYM3iVn8ciGruD37mYy9aW1lLKELwrFYcCmeOuPSiTQfzL+r+fsneIvrr+ya0cQx 6r4zX0CfMvyMerN80GpZAOJZ4SRn96IwMs4JpIBY/1mhRVhmlWA3zn0p6DuOMEacGWyi whmPZMn2A8ZSZpnjY7CCku50hYsWs0mBdM1plGrIkXClmOpcp/KjgbrHCOsE5DkTshx7 8MvYIryxUNp/7x3tb1gomi608UmdcWDFpCxlfOaw816Kbrw51cWtLtjAmotbcBFmL6L9 bSeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=zTSfotMf3/dg0RIWN1mu4f5UTX2o0e+19TQ8MFfnUDU=; fh=CIhjk7Kden0/2jjkHMjx41rzeKQqpwFmEVfS8ybKOpU=; b=BqO0orGuMVvoebc/D7Ej6f2Eoa2jnteAbT+ITauHS4TQM1tHRBtHPNQMVyZXeA9Yyo dhj4kLLRvAaSMT863MceDvo1A0Uw0t8EHrq9kplsZjdirnsJPwbt0XaMFypUdWUXe5Mi /YY1pTnoGToXafsnHk1miChNy7bH7/d3H3LJIU7BZkcrADFjyCiUeXackE9VM7C4hYMu EI8Noj9g+5qo/89rE9dhK1psl/aqSe+n9WPc2EMGHoWPj65DqovnM8DLC7CYNHOh02Qq xZYlLS4dmpTCB2p62NK2YbNKhMIRedO3u3dcu6lGgRVEF9iOJoFloiBkC3xSF8BB6ljo merg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-7209-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-7209-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id jj6-20020a170903048600b001d3ecc09ce0si1607761plb.384.2023.12.20.07.57.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 07:57:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-7209-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-7209-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-7209-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id D7044B23210 for ; Wed, 20 Dec 2023 15:54:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D6C0F4185D; Wed, 20 Dec 2023 15:54:12 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8EB8041862; Wed, 20 Dec 2023 15:54:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id BA68A1FB; Wed, 20 Dec 2023 07:54:53 -0800 (PST) Received: from [192.168.1.3] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 61DEF3F64C; Wed, 20 Dec 2023 07:54:06 -0800 (PST) Message-ID: <0bbbcdb5-41eb-dd07-660a-2e5e4a0d59f0@arm.com> Date: Wed, 20 Dec 2023 15:54:05 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [PATCH RFC V2 1/4] perf/core: Add aux_pause, aux_resume, aux_start_paused Content-Language: en-US To: Adrian Hunter , Peter Zijlstra Cc: Ingo Molnar , Mark Rutland , Alexander Shishkin , Heiko Carstens , Thomas Richter , Hendrik Brueckner , Suzuki K Poulose , Mike Leach , 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 , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org References: <20231208172449.35444-1-adrian.hunter@intel.com> <20231208172449.35444-2-adrian.hunter@intel.com> From: James Clark In-Reply-To: <20231208172449.35444-2-adrian.hunter@intel.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 08/12/2023 17:24, Adrian Hunter wrote: > Hardware traces, such as instruction traces, can produce a vast amount of > trace data, so being able to reduce tracing to more specific circumstances > can be useful. > > The ability to pause or resume tracing when another event happens, can do > that. > > Add ability for an event to "pause" or "resume" AUX area tracing. > > Add aux_pause bit to perf_event_attr to indicate that, if the event > happens, the associated AUX area tracing should be paused. Ditto > aux_resume. Do not allow aux_pause and aux_resume to be set together. > > Add aux_start_paused bit to perf_event_attr to indicate to an AUX area > event that it should start in a "paused" state. > > 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. > > Add PERF_EF_PAUSE and PERF_EF_RESUME modes for ->stop() and ->start() > callbacks. Call as needed, during __perf_event_output(). Add > aux_in_pause_resume to struct perf_buffer to prevent races with the NMI > handler. Pause/resume in NMI context will miss out if it coincides with > another pause/resume. > > To use aux_pause or aux_resume, an event must be in a group with the AUX > area event as the group leader. > > Example (requires Intel PT and tools patches also): > > $ perf record --kcore -e '{intel_pt/aux-start-paused/k,syscalls:sys_enter_newuname/aux-resume/,syscalls:sys_exit_newuname/aux-pause/}' uname I think it might be useful to have an aux-toggle option as well, and then you could do sampling if you put it on a PMU counter with an interval. Unless you can make two events for the same counter with different intervals, and one does resume and the other does pause? I'm not sure if that would work? Other than that it looks ok. I got Coresight working with a couple of changes to what you posted on here, but that can always be done more thoroughly later if we leave PERF_PMU_CAP_AUX_PAUSE off Coresight for now. Thanks James