Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1443793lqa; Mon, 29 Apr 2024 08:35:37 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXiImJG/EkmFEbi7j5MMCc54UyhHcORRzcRctZYt8/d/DKD1YKUMVgsClSQBIa6+Z2yASsKA2KMrA/0d5HZemkWeBSoJo947/7vBVxsfw== X-Google-Smtp-Source: AGHT+IHyfrK1NxyqYRQdNclFflE4CqmwIN0HU+gopF48ye6w3Zh/DLD5kBwg+yyxQ8R296Z2hKvL X-Received: by 2002:a05:6e02:1e09:b0:36a:fe86:5fcc with SMTP id g9-20020a056e021e0900b0036afe865fccmr183515ila.0.1714404937188; Mon, 29 Apr 2024 08:35:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714404937; cv=pass; d=google.com; s=arc-20160816; b=wALqAzBxvhkTVwp7U+zdVnCHizufMq2i+j/X2dSMreU3YLbAxOO05K8D66zs1U04N3 y3/ledy/k35yiDi0fhw7E7NjiC4FPnCWhcOt9RUbMOEMAgTUdP425RAwuMDJqD4i+WDq Zdi1YjMRXF14lxtWbugmSaT5cu5AG+rAhz0ar4AiOQ2RFTTUDpWiTMxzkHQlc822FFpu 6mD+GHHOu/WU4sc9mEHH8wpXDSz0FbzlbqzEoNy47xKBxRZUJmnh2a1jtUIZehBvrXP9 R42tmgrOWkMe2YWC7hzugSDNt4AQ368nn8e79chQGEChHBtryNb/NgJHFiNszEtaW9l6 N4AQ== 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:references:in-reply-to:message-id :date:subject:cc:to:from; bh=tLhLLGF5GbeZ9SFwXUD0CCJ9clEqeEM+YPIJHhDfGqI=; fh=eTkjUs/l3a9lPpUjmicKO4brnHa0D6Qg87n5LIjfzgo=; b=iqNG205qhE3DMTrfVD46RWGQVKGekGbKP1Ej6n/lof7KIIJUWZxwLuPHYPlG/RRf1j qYJHrRXd3DEiJ/dg2hvifN9K4gsgUvCksd7W4d0F6ObbhIqfmBmK09lISMMgivTXAvzi ycM1xfSEBF6TxZX8nBYkLv4U+Lx6fV5hYSlNWZnPKYoTiOHFNflh89TEnkkgdPvHC1I3 5psoL/nMDq6UJQHCIaZc/w9e0cWKM2ZJk+m4FQA//yRYidPrz4D7AV4AWcxdMx6oFjQk pm7T2w+C7szG8aMKBi4EG7HYBfF/zVheqexNXnYq+64Lq8zlH3hlif6RQ46WgHC0kkFd RuKA==; 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-162569-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162569-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d13-20020a65424d000000b005f757037ae0si20280507pgq.221.2024.04.29.08.35.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 08:35:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-162569-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; 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-162569-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162569-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id C1C3D286680 for ; Mon, 29 Apr 2024 15:24:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D7F2E83A12; Mon, 29 Apr 2024 15:23:53 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 813308121A; Mon, 29 Apr 2024 15:23:51 +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=1714404233; cv=none; b=FPD6JtpoQ5yNTuNTKI0PfotPMBd97WYjjudKUIQQl9UupSvMIsS77rZDe+op6t1bg9T1yqlGngvXR3b42icV9nVpHCK22YmehTiLpDa4ct1nHTVB2ZY10yGhe53ffqPB/QxZmtHLsn9DHCIESSifBMB4LJQT46hRx8Pi/HhzJOU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714404233; c=relaxed/simple; bh=1Za128McDTF/C8ZV/bPj12q2cashQOnFU9fLRV2wwQA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ciZqtywy/p+/EvZOPGFTSY6MvqSy1GO0fCUHajkK6NqJoSWGE9jAB/9Vx3d8T4HkAavhvkvZvdOZHnhwB6okVbnOMV+jELgLRlHO0oCFSdwCP9NyVRLmzPa5y4S3BKZ66C0itRhOGosh90+0mJF6Qk7BZNyiN2d2wwI/PF/UveQ= 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 A4BED2F4; Mon, 29 Apr 2024 08:24:17 -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 D917C3F793; Mon, 29 Apr 2024 08:23:47 -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 02/17] perf auxtrace: Allow number of queues to be specified Date: Mon, 29 Apr 2024 16:21:47 +0100 Message-Id: <20240429152207.479221-3-james.clark@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240429152207.479221-1-james.clark@arm.com> References: <20240429152207.479221-1-james.clark@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Currently it's only possible to initialize with the default number of queues and then use auxtrace_queues__add_event() to grow the array. But that's problematic if you don't have a real event to pass into that function yet. The queues hold a void *priv member to store custom state, and for Coresight we want to create decoders upfront before receiving data, so add a new function that allows pre-allocating queues. One reason to do this is because we might need to store metadata (HW_ID events) that effects other queues, but never actually receive auxtrace data on that queue. Signed-off-by: James Clark --- tools/perf/util/auxtrace.c | 9 +++++++-- tools/perf/util/auxtrace.h | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/tools/perf/util/auxtrace.c b/tools/perf/util/auxtrace.c index 3684e6009b63..563b6c4fca31 100644 --- a/tools/perf/util/auxtrace.c +++ b/tools/perf/util/auxtrace.c @@ -218,15 +218,20 @@ static struct auxtrace_queue *auxtrace_alloc_queue_array(unsigned int nr_queues) return queue_array; } -int auxtrace_queues__init(struct auxtrace_queues *queues) +int auxtrace_queues__init_nr(struct auxtrace_queues *queues, int nr_queues) { - queues->nr_queues = AUXTRACE_INIT_NR_QUEUES; + queues->nr_queues = nr_queues; queues->queue_array = auxtrace_alloc_queue_array(queues->nr_queues); if (!queues->queue_array) return -ENOMEM; return 0; } +int auxtrace_queues__init(struct auxtrace_queues *queues) +{ + return auxtrace_queues__init_nr(queues, AUXTRACE_INIT_NR_QUEUES); +} + static int auxtrace_queues__grow(struct auxtrace_queues *queues, unsigned int new_nr_queues) { diff --git a/tools/perf/util/auxtrace.h b/tools/perf/util/auxtrace.h index 55702215a82d..8a6ec9565835 100644 --- a/tools/perf/util/auxtrace.h +++ b/tools/perf/util/auxtrace.h @@ -521,6 +521,7 @@ int auxtrace_mmap__read_snapshot(struct mmap *map, struct perf_tool *tool, process_auxtrace_t fn, size_t snapshot_size); +int auxtrace_queues__init_nr(struct auxtrace_queues *queues, int nr_queues); int auxtrace_queues__init(struct auxtrace_queues *queues); int auxtrace_queues__add_event(struct auxtrace_queues *queues, struct perf_session *session, -- 2.34.1