Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1436103lqa; Mon, 29 Apr 2024 08:24:03 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV+FqrvLOXXzYx3O+NNBgDkzYuauXXaG/fjtvEhMDAebYpRaXSKntyNu5vuUaDwRgzghm5U6JJWJjO8yvSBre8histwjaSJqTPSC9vI/Q== X-Google-Smtp-Source: AGHT+IEv3xvoMwa6Gt9gKVm8sl4Jh4X3q76SHIrwHc39Y+xYtVxjRtcU3A8ujg7kn2gWyiL8GFP3 X-Received: by 2002:a50:9b50:0:b0:570:5b70:3407 with SMTP id a16-20020a509b50000000b005705b703407mr8905153edj.10.1714404243215; Mon, 29 Apr 2024 08:24:03 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714404243; cv=pass; d=google.com; s=arc-20160816; b=vGFbi6DuGnG9czTznKOEav8lE11NnP8sdF6h0K/9dFhPjIXCvUcmYvz0qWcymTRedz KhToD2EelA6XB1to74M3kNmpx8MCvArtBRCCDPN7iyH6WyN5clvv3YaYje0VwVvmbb9g h4zY5M5NGj/YUp1tZWBKwYE4CCraPwy7jGBUzanTvzLIh9xi+orX2/L031NT0ugto65p 2/kQsjMsqlAHzidM1piCsM1IlQhG30ETu7rpYRsNB9WlUiMdM5xCLNbtgQi/C06Iszgm vHeXDfuTAcetA64D9315IOqzhsbPfadrFx/YK1U1UY1dABFe1L1lubOyVf3S4r9M7A9Z rFuw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=wMUgF0w4VsAF5cud0VhGVilyQDa8+Togi6081C9nlX8=; fh=eTkjUs/l3a9lPpUjmicKO4brnHa0D6Qg87n5LIjfzgo=; b=ZzVtV56KQoktssrwJ4++OU0cvK1P++Kpgw1kUNqON5qfYAaJaeqU4FFMEfgwm3zzN4 y9SXsDmefFZENpT2+YGV8PZy58ye42uUDB7vqEWvizJitAJUkja1b2hgCFNlPWnBWDVk dWJ04avLS0aMMRFNg909ag49lexmfiyPzGqcSA6RNO/ytU3eyNuoyYw98sKG32xCEYvd kDX/oakzEYiG43WuhbyWayxz0wi0DEUqWwsDXgaV2ZRHP9DkWwgM28sSU3ZiEt/Gi8XZ Ri8U7RhmpAN2Vr7MEd8s858cQFU1fl0LaUC5IVqkFd//l97SSg7lMoIHcmjGWpp8m367 gdPg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-162567-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162567-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id j17-20020a05640211d100b005727d5aa208si1869181edw.163.2024.04.29.08.24.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 08:24:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-162567-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-162567-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162567-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 am.mirrors.kernel.org (Postfix) with ESMTPS id ED6C91F21D4B for ; Mon, 29 Apr 2024 15:24:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AEB6581AD0; Mon, 29 Apr 2024 15:23:39 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EC299745C5; Mon, 29 Apr 2024 15:23:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714404219; cv=none; b=ubjW7wZmNfGPSm9ETZ7Qa/K90kpzbT5VMsVKcfQ30gzFA0ni6YcMI93wgGCytQuSh0qKq1gq9T4PhHsFhy9iioLHVQQezGXGv9cF5OF/IQZVsRD6xJuyGqGiTmyevQN9hOKw6SUcDuNcT5ut2OAUkoATkZhLNqnWYX9YOR+SmOo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714404219; c=relaxed/simple; bh=T97eXiCoo8c2wzSk/75hX1LVypK0OF869Y6KpZyXIaU=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=hOppTAivQoQXZTh6w2JACBn8XLNPNbytXqQDYhu29gifxyAjYSrFqW3XRyCichF2sT8UUmj547VDLzd9dcQysEzvSZGnWLy2zHoS6piRFisY8ZQ1w6HS0bNWnaP1lJbL56Ot35bLzjhVcUwI7irkPQOUo4Dx4IO+wo+8DGg9Efc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 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 8AD4F2F4; Mon, 29 Apr 2024 08:24:02 -0700 (PDT) Received: from e127643.broadband (usa-sjc-mx-foss1.foss.arm.com [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id B9B823F793; Mon, 29 Apr 2024 08:23:32 -0700 (PDT) From: James Clark To: linux-perf-users@vger.kernel.org, gankulkarni@os.amperecomputing.com, scclevenger@os.amperecomputing.com, coresight@lists.linaro.org, suzuki.poulose@arm.com, mike.leach@linaro.org Cc: James Clark , Alexander Shishkin , Maxime Coquelin , Alexandre Torgue , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Jiri Olsa , Ian Rogers , Adrian Hunter , John Garry , Will Deacon , Leo Yan , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com Subject: [PATCH 00/17] coresight: Use per-sink trace ID maps for Perf sessions Date: Mon, 29 Apr 2024 16:21:45 +0100 Message-Id: <20240429152207.479221-1-james.clark@arm.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 Content-Transfer-Encoding: 8bit This will allow sessions with more than CORESIGHT_TRACE_IDS_MAX ETMs as long as there are fewer than that many ETMs connected to each sink. Each sink owns its own trace ID map, and any Perf session connecting to that sink will allocate from it, even if the sink is currently in use by other users. This is similar to the existing behavior where the dynamic trace IDs are constant as long as there is any concurrent Perf session active. It's not completely optimal because slightly more IDs will be used than necessary, but the optimal solution involves tracking the PIDs of each session and allocating ID maps based on the session owner. This is difficult to do with the combination of per-thread and per-cpu modes and some scheduling issues. The complexity of this isn't likely to worth it because even with multiple users they'd just see a difference in the ordering of ID allocations rather than hitting any limits (unless the hardware does have too many ETMs connected to one sink). Per-thread mode works but only until there are any overlapping IDs, at which point Perf will error out. Both per-thread mode and sysfs mode are left to future changes, but both can be added on top of this initial implementation and only sysfs mode requires further driver changes. The HW_ID version field hasn't been bumped in order to not break Perf which already has an error condition for other values of that field. Instead a new minor version has been added which signifies that there are new fields but the old fields are backwards compatible. James Clark (17): perf cs-etm: Print error for new PERF_RECORD_AUX_OUTPUT_HW_ID versions perf auxtrace: Allow number of queues to be specified perf: cs-etm: Create decoders after both AUX and HW_ID search passes perf: cs-etm: Allocate queues for all CPUs perf: cs-etm: Move traceid_list to each queue perf: cs-etm: Create decoders based on the trace ID mappings perf: cs-etm: Support version 0.1 of HW_ID packets coresight: Remove unused stubs coresight: Clarify comments around the PID of the sink owner coresight: Move struct coresight_trace_id_map to common header coresight: Expose map argument in trace ID API coresight: Make CPU id map a property of a trace ID map coresight: Pass trace ID map into source enable coresight: Use per-sink trace ID maps for Perf sessions coresight: Remove pending trace ID release mechanism coresight: Re-emit trace IDs when the sink changes in per-thread mode coresight: Emit HW_IDs for all ETMs that are using the sink drivers/hwtracing/coresight/coresight-core.c | 10 + drivers/hwtracing/coresight/coresight-dummy.c | 3 +- .../hwtracing/coresight/coresight-etm-perf.c | 82 ++- .../hwtracing/coresight/coresight-etm-perf.h | 20 +- .../coresight/coresight-etm3x-core.c | 14 +- .../coresight/coresight-etm4x-core.c | 14 +- drivers/hwtracing/coresight/coresight-stm.c | 3 +- drivers/hwtracing/coresight/coresight-sysfs.c | 3 +- .../hwtracing/coresight/coresight-tmc-etr.c | 5 +- drivers/hwtracing/coresight/coresight-tmc.h | 5 +- drivers/hwtracing/coresight/coresight-tpdm.c | 3 +- .../hwtracing/coresight/coresight-trace-id.c | 107 +-- .../hwtracing/coresight/coresight-trace-id.h | 57 +- include/linux/coresight-pmu.h | 17 +- include/linux/coresight.h | 20 +- tools/include/linux/coresight-pmu.h | 17 +- tools/perf/util/auxtrace.c | 9 +- tools/perf/util/auxtrace.h | 1 + .../perf/util/cs-etm-decoder/cs-etm-decoder.c | 28 +- tools/perf/util/cs-etm.c | 617 ++++++++++++------ tools/perf/util/cs-etm.h | 2 +- 21 files changed, 633 insertions(+), 404 deletions(-) -- 2.34.1