From patchwork Fri Dec 8 17:24:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Hunter X-Patchwork-Id: 17773 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp5603666vqy; Fri, 8 Dec 2023 09:26:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IHUETgl9Pa8mriCX5JtyPG7uuDn9djOCyrdxxUh/WUki0vERCrPyyPCTXC+0EA/1f1zFfWD X-Received: by 2002:a05:6a20:d405:b0:18f:97c:9297 with SMTP id il5-20020a056a20d40500b0018f097c9297mr291561pzb.124.1702056386968; Fri, 08 Dec 2023 09:26:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702056386; cv=none; d=google.com; s=arc-20160816; b=rMqMmgb0UNDjbuwny9PPOOLE8r4XIHuLXBeWGop0SuIqANXLyW9UF95kMFO/tMT9fA KaOhlk7j9L+keze/RC7di3NLrUDNBl5IHegKOPp2SDRGsJ7Q4u3fU1Hn4l2h14O9Y9sh iOlNKzRVyQce6gvsiELjI8f2xZ0JBPuMrPcpBbVzDmAaMT2+sxhnlOcLGrCotHUjm2w6 0+DDgrSUpBb7u8f5jEosK/qx1PgvVXfZCW1kxuRLCw5YN/FcqmK/FCQ1TG1FEHZ/Eb2m /II5Ilfuf1OuapBkktGm3DG4D0IHCASUTJvMW8eggjPn7bUDqeBmfD/RJCQDlyvwhVjV A7vg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:organization :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=Jf7+7tFzSD8qqtogMd1f4MDWwJNPOY49ljcon1DGW4c=; fh=cd6f3jNh3j7Qvd5mXmd/oCoIQnwAYeKd0j29JiSirLE=; b=qEWTEdxehb3QkgK3+UxqSVoOKxQJ0od0dMIXR4AwZPv25MoHb7QKducTiOCwl51tgj aWUq4+dyKSinKRnCssXByuTDFOjkvI2fDrIvw/svImaEC0dxk/fAWN7S6BOg1OTdZoe+ 7iXRXaHuLddS3UPsp86yKLRJ3YMzQF8i0QFftg7G+8PTqR7vQXs/bsAe7JGrEneAJx73 //ZSbqSoeSqQm36viDaFbFwIWL+txU42F9kaBZjnDFs6VtHJwRrNee6sVYtKiipc/h1v HrM4GcjPQa50FBcig+/ZqeKTvypOCt6PDMsB+I6jvr/NNOF1EWzebuCvR6Mfd6goX5Ki QPSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Yb5s4ke7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id m5-20020a63ed45000000b00578ea9a0b93si1857650pgk.890.2023.12.08.09.26.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 09:26:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Yb5s4ke7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id DAC588075B1D; Fri, 8 Dec 2023 09:25:33 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1574250AbjLHRZJ (ORCPT + 99 others); Fri, 8 Dec 2023 12:25:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233780AbjLHRZG (ORCPT ); Fri, 8 Dec 2023 12:25:06 -0500 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57B1C137; Fri, 8 Dec 2023 09:25:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1702056313; x=1733592313; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=HS9B5laS4FVE8LbmCpzPPPQI/CT1mCILRKewwhWMU8E=; b=Yb5s4ke7Myoo3PJ9FcgyFccWloEr1oshSFKaFolYD4SqSyLzh9s8NCvf OAoqYkrwKoncrE8ZESmfWn2dUm24Qcj1yxWie5DIGKMklZltyTaBiEKkX fgurYVS703WfoUzQ1mb8tjb/wjdvyesfkbLfZDVak7pIjAAX9JLeBfGaL pbfxA+TNWP5QzFpSndMVlFXMrW63QMb977GsoWaAblp3vQpWzmocl5gIx nUc+O5ThtzzzlVSj3gtOCEicO6Xi+Wr7igmpcmc2W8KlmEeEw0YwHvIBo 1K46d1wklkWImIKJPBGxYchrDq/oesFT7cwkpdtJep3RXllgKPhN4G99y A==; X-IronPort-AV: E=McAfee;i="6600,9927,10918"; a="379432363" X-IronPort-AV: E=Sophos;i="6.04,261,1695711600"; d="scan'208";a="379432363" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Dec 2023 09:25:07 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10918"; a="772201553" X-IronPort-AV: E=Sophos;i="6.04,261,1695711600"; d="scan'208";a="772201553" Received: from ahunter6-mobl1.ger.corp.intel.com (HELO ahunter-VirtualBox.home\044ger.corp.intel.com) ([10.249.34.218]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Dec 2023 09:25:01 -0800 From: Adrian Hunter To: Peter Zijlstra 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 , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Subject: [PATCH RFC V2 0/4] perf/core: Add ability for an event to "pause" or "resume" AUX area tracing Date: Fri, 8 Dec 2023 19:24:45 +0200 Message-Id: <20231208172449.35444-1-adrian.hunter@intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Fri, 08 Dec 2023 09:25:34 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784735477955372393 X-GMAIL-MSGID: 1784735477955372393 Hi 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. These patches add such a facilty and show how it would work for Intel Processor Trace. Maintainers of other AUX area tracing implementations are requested to consider if this is something they might employ and then whether or not the ABI would work for them. Changes to perf tools are not fleshed out yet. Changes in RFC V2: Use ->stop() / ->start() instead of ->pause_resume() Move aux_start_paused bit into aux_output_cfg Tighten up when Intel PT pause / resume is allowed Add an example of how it might work for CoreSight Adrian Hunter (4): perf/core: Add aux_pause, aux_resume, aux_start_paused perf/x86/intel/pt: Add support for pause / resume perf tools: Add support for AUX area pause / resume coresight: Have a stab at support for pause / resume arch/x86/events/intel/pt.c | 63 ++++++++++++++++++++- arch/x86/events/intel/pt.h | 4 ++ drivers/hwtracing/coresight/coresight-etm-perf.c | 29 ++++++++-- include/linux/perf_event.h | 15 +++++ include/uapi/linux/perf_event.h | 11 +++- kernel/events/core.c | 72 +++++++++++++++++++++++- kernel/events/internal.h | 1 + tools/include/uapi/linux/perf_event.h | 11 +++- tools/perf/util/auxtrace.c | 4 ++ tools/perf/util/evsel.c | 9 +++ tools/perf/util/evsel_config.h | 6 ++ tools/perf/util/parse-events.c | 33 +++++++++++ tools/perf/util/parse-events.h | 3 + tools/perf/util/parse-events.l | 3 + tools/perf/util/perf_event_attr_fprintf.c | 3 + 15 files changed, 255 insertions(+), 12 deletions(-) Regards Adrian