Received: by 2002:a05:6500:1b41:b0:1fb:d597:ff75 with SMTP id cz1csp146360lqb; Tue, 4 Jun 2024 07:32:05 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUqJRDhUmJAdVsPhR/exTNmJ8hB4dywk51sOuXA0/3R+6bGXMy9T4RD6KL/irenx0pInLdO8OCS11xncq6WS2QX8UYoVHPpw3noQlj+ww== X-Google-Smtp-Source: AGHT+IF0JlKqB4zNoRb5X6J1SJj9dAAKgfvI8fTYIqrT97aI6ZY7Wg5S3L114PgletgqvqO+tEaN X-Received: by 2002:a50:9b1b:0:b0:57a:79c2:e9d6 with SMTP id 4fb4d7f45d1cf-57a79c2ea66mr2349750a12.33.1717511525582; Tue, 04 Jun 2024 07:32:05 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717511525; cv=pass; d=google.com; s=arc-20160816; b=Bawl7J8uhZGOy9+OfPKMktHXx799dsZAH77xyM2tA5YkJ4yKz9gpzNRNGy5Y5aMWyD PXdautSJ+CijWqTbfAFGRI/dVFHZaOm/UPooV+WoiNEvC5z4ideWDoyGSlYFFtT/NIvy Y8xT5Q99mTb+hxfTXWpVILPjWQel32FUmvhq4nTIp8tyZm5HuDFQi7dbdxB8Ql2fLOmd QM/sAyu7ftfKb0s2KogxtPjWIN4N2h6nWEhU1KVP4LGXyu3MhcgYwz4m97tbPJsr34gz klCMD+EfGftuMy0AXmwpYDpha9TGQ/4M8a5VM8UOMyWJLhi1CKrv3LlHyezxEQfpbDyD 7SzQ== 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=PS2xZ37x6i1et2MxEVJy4TSpqrJZGNwd6DyYCR5/2fw=; b=DArCzySl+sf6t7XAHt9txHgQHrM0Y6KStLPxLBBhnYQdUWwmgNwHHs+mHDJeBRXhhf nq5Z63gHDWlIO82nHFJA79L7y08UvZhpHtPPje8dPzP738mOKpVBLSOeWXEmBg6JmyVl mHSuo7zXqaDPOWGPIIan8epzj8ZnSaa81OjpQaQiFbEx7CmWAvhoUdYIWF87puP9mYyL QX7980iKvvsOD7EfBhrWv6JE452tod/yLEe9BEuZLGy8AuhymtJ+42taOlrQ5Be7DY35 0dx+hyR9qqKMuLq45UOo7wnMiXWz97Py7Pfl3OngRmwnxvY1VOOzuzdnDVNfuCOd9Sto PdXA==; 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-200820-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-200820-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 4fb4d7f45d1cf-57a31ca4ed2si5050489a12.502.2024.06.04.07.32.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 07:32:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-200820-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-200820-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-200820-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 4E8151F21A6F for ; Tue, 4 Jun 2024 14:32:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5D61A13D273; Tue, 4 Jun 2024 14:31:36 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 545C8C147; Tue, 4 Jun 2024 14:31:34 +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=1717511495; cv=none; b=p0IH9/0509gbemaP1kh0s6Q/5KrZYw+oEWCZIUmAY2+a7QJ5XPn6n73kzqoZccobV+5HCMJsj3tHqE5pQ6i/qaHymhHzZz/g7kAgi2nQuMy9qlDiIFwJr89wvQGLhIGVMEizQhyRmhtrNyVXO6TVOshPcToCDGKjByfyeWlArdE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717511495; c=relaxed/simple; bh=1Za128McDTF/C8ZV/bPj12q2cashQOnFU9fLRV2wwQA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=FdzDkgHNOAqiKc5PjNJFVc84UQRYJGh2xJhIvF1MbDWfDGR92tqMV8xdqOVFV4qtE1G2nkdS3EDa9OSJ3iLz2+kzEweTygO/1Jij+KZv763Furh84ulp1uUXLvVx/v00yYVshUKwmRM809l2k9reRH6sb/d47MmiFJ+NfJUTEpA= 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 4700F1042; Tue, 4 Jun 2024 07:31:58 -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 C7F403F64C; Tue, 4 Jun 2024 07:31:30 -0700 (PDT) From: James Clark To: coresight@lists.linaro.org, suzuki.poulose@arm.com, gankulkarni@os.amperecomputing.com, mike.leach@linaro.org, leo.yan@linux.dev, anshuman.khandual@arm.com 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 , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-perf-users@vger.kernel.org Subject: [PATCH v2 02/16] perf auxtrace: Allow number of queues to be specified Date: Tue, 4 Jun 2024 15:30:11 +0100 Message-Id: <20240604143030.519906-3-james.clark@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240604143030.519906-1-james.clark@arm.com> References: <20240604143030.519906-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