From patchwork Thu Jan 11 08:19:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Hunter X-Patchwork-Id: 18943 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2411:b0:101:2151:f287 with SMTP id m17csp1301205dyi; Thu, 11 Jan 2024 00:19:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IHWpLAxQh6WWxz+OUpmHrZPClMKA9ZHJv2q6gIGCSBKq1+yChdNzuZAdtlPUbCWbatW3o5/ X-Received: by 2002:a62:e216:0:b0:6ce:751b:81d9 with SMTP id a22-20020a62e216000000b006ce751b81d9mr949799pfi.9.1704961191319; Thu, 11 Jan 2024 00:19:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704961191; cv=none; d=google.com; s=arc-20160816; b=SdXh37lqCeaLV/GfIay6U1T0VjG3yzGsfW8qkTibSHxMWetC5pyQNQN6sEfzOvrtPG TBldWf4tRbkUXW+PCGPU0bm9sgPeTAwFnnIVXlqS9Qc7qrleKTBFK0ZSxAp8KmaLWXb/ /v3ebdFvxr/gZzn+k2ZGV7qdeX7TXkNUci1ITB4Dq5rLZLeriWs9AbUWKomQMP3eEfIF xoswKzRiMFLPz23eLrPCPmiP8l1IqXEw//SiN/uw9Rd70fjyJWo5NYr8Bn+ajHUidEoT HgHZMU1nsNr5DhbqnspRKzGt/uM182s6velrHdKU4SDe4dQOGvgSYRf0YLc84JGcb2f7 5QHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:organization:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:message-id:date :subject:cc:to:from:dkim-signature; bh=4o0FvOtA9apGcuAEQN/nJGqy0SH05r200V5UOX5FClY=; fh=cd6f3jNh3j7Qvd5mXmd/oCoIQnwAYeKd0j29JiSirLE=; b=p4d293/f7+JIm5hG6Yx8Ub7H6Vra1PjvInS+Y3wn36Ild9E+u71AWhB3P5Yfpz97fB Onf/Nng1s5KUkODC+OZHi9lzPAR0gxMPIRC2g6+Gv/IRz6/jWA0sBTl6WZ63JadpEB5d 3/KDOQTV2cKdM8X1M7MCqzl6c6nRveQfX6O1IGmKacD1lHS1zp3rLTZdefATh/1S4eND EInx8oUL3Rmzaq1rMlgxeZFS0ZWZw7ib6Y/rRAOnQFugUXYN6zToMpv8fxo5HIso8+vD EVG12snVGl5jE3baZbkh9paltnNrxgKzLpVkBSiJa62BCksIZ1tA+FPUxUJu8sHzxeZW eRZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Tq2IixP3; spf=pass (google.com: domain of linux-kernel+bounces-23199-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-23199-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id le17-20020a056a004fd100b006db19e5015fsi562932pfb.166.2024.01.11.00.19.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jan 2024 00:19:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-23199-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Tq2IixP3; spf=pass (google.com: domain of linux-kernel+bounces-23199-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-23199-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 1EF8C286FB7 for ; Thu, 11 Jan 2024 08:19:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 06FE1E554; Thu, 11 Jan 2024 08:19:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Tq2IixP3" Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 97FCCE544; Thu, 11 Jan 2024 08:19:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1704961171; x=1736497171; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=bbcFhRoQMghAzNGhNxuNhvBNhm3SUfDuTtzO00WTbgU=; b=Tq2IixP3OcO7L4odEv4CYm4mxiuPNP8f5HHucFoukRCTXr/IOdNu7sgf +VQOC+LBYcIsMB7jvte+7Wnyul2TkX5nIGfcGREKL+dFtHRR8NtIOrUX4 fNICFMRpE89xKLKDnBAke5hnaOeWzWc1RC4KLCfK7IEOFgt6hB3L4LK7r jhpNAFtf8k5gEooIMG4Jl2k5sG2zT/uhI3R3HspHNQI/GLT+AaVHTQvt+ e6Ecx3SPR1bx8dVYA+3apFhNdiDzFVFx9KSomBFoxcjg4UG4MXYg0C0RY RBDA4QTYTRCpRl25lPMBi4F8kZSyIIYzZFudEll+o5Ns/PUHbp8BJ8jZr A==; X-IronPort-AV: E=McAfee;i="6600,9927,10949"; a="465166282" X-IronPort-AV: E=Sophos;i="6.04,185,1695711600"; d="scan'208";a="465166282" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jan 2024 00:19:30 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10949"; a="925923001" X-IronPort-AV: E=Sophos;i="6.04,185,1695711600"; d="scan'208";a="925923001" Received: from ahunter6-mobl1.ger.corp.intel.com (HELO ahunter-VirtualBox.home\044ger.corp.intel.com) ([10.252.52.224]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jan 2024 00:19:25 -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 V4 00/11] perf/core: Add ability for an event to "pause" or "resume" AUX area tracing Date: Thu, 11 Jan 2024 10:19:03 +0200 Message-Id: <20240111081914.3123-1-adrian.hunter@intel.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787781385965780459 X-GMAIL-MSGID: 1787781385965780459 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 now (since V4) fleshed out. Changes in V4: perf/core: Add aux_pause, aux_resume, aux_start_paused Rename aux_output_cfg -> aux_action Reorder aux_action bits from: aux_pause, aux_resume, aux_start_paused to: aux_start_paused, aux_pause, aux_resume Fix aux_action bits __u64 -> __u32 coresight: Have a stab at support for pause / resume Dropped perf tools All new patches Changes in RFC V3: coresight: Have a stab at support for pause / resume 'mode' -> 'flags' so it at least compiles 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 (11): perf/core: Add aux_pause, aux_resume, aux_start_paused perf/x86/intel/pt: Add support for pause / resume perf tools: Enable evsel__is_aux_event() to work for ARM/ARM64 perf tools: Enable evsel__is_aux_event() to work for S390_CPUMSF perf tools: Add aux_start_paused, aux_pause and aux_resume perf tools: Add aux-action config term perf tools: Parse aux-action perf tools: Add missing_features for aux_start_paused, aux_pause, aux_resume perf intel-pt: Improve man page format perf intel-pt: Add documentation for pause / resume perf intel-pt: Add a test for pause / resume arch/x86/events/intel/pt.c | 63 +++- arch/x86/events/intel/pt.h | 4 + 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/Documentation/perf-intel-pt.txt | 558 +++++++++++++++++------------ tools/perf/Documentation/perf-record.txt | 4 + tools/perf/arch/arm/util/pmu.c | 3 + tools/perf/builtin-record.c | 4 +- tools/perf/tests/shell/test_intel_pt.sh | 28 ++ tools/perf/util/auxtrace.c | 67 +++- tools/perf/util/auxtrace.h | 6 +- tools/perf/util/evsel.c | 13 +- tools/perf/util/evsel.h | 1 + tools/perf/util/evsel_config.h | 1 + tools/perf/util/parse-events.c | 10 + tools/perf/util/parse-events.h | 1 + tools/perf/util/parse-events.l | 1 + tools/perf/util/perf_event_attr_fprintf.c | 3 + tools/perf/util/pmu.c | 6 +- 22 files changed, 645 insertions(+), 238 deletions(-) Regards Adrian Acked-by: James Clark