Received: by 2002:a89:288:0:b0:1f7:eeee:6653 with SMTP id j8csp290247lqh; Mon, 6 May 2024 21:26:37 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVUTK29UlfJx3taVb3+z1Kr61GiownfynSX5hX4oeklMtW3M5ouc6u6DrHxkZ4qltZUsipKR3fgioU8C+dgzcuFgc9bBus50rq5xXUcHg== X-Google-Smtp-Source: AGHT+IFQoI1DvW/Ee1bIa04ZGe3aGZECjAQ31M/hMUqJ1ra+aNf4Jl3g215UhXGUdmmXunIZf+cD X-Received: by 2002:a05:6a00:2290:b0:6f0:b53c:dfb4 with SMTP id f16-20020a056a00229000b006f0b53cdfb4mr14999222pfe.22.1715055997007; Mon, 06 May 2024 21:26:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715055996; cv=pass; d=google.com; s=arc-20160816; b=RdNyEkbSrSGJTo9Rs6VSk3aE75hQFjZnPekMZxmLgM/npZNtKlulE6MbBN5ARLoYKj 5lE/KtgfsjauYcxAQd0T54BnXGGyiEoFUgpfOBpRejx9zLjRaRQL4tvfcJSliX6dKKqp jEOI747rmdLlmlWrXagnXu+y2PPZjqpePfnk7i5T8n41J2R0JQRZI7Yr9FH10Wqn7+TX bJN2m7OSVStMdcwr/O+5Sm0RilnDlJMasxkx3TLlCPnIgzlu7ozZlzAsqjUJ3gfRHhdw T5iHlNlMtdyUQTxudhfez4UFNSatlAFdHvM6XMvLB8OP5MFtORdp9Zi69sn9yzDS6j53 PmFQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=YGZHLHucMFIE8/Ied1fB2hdiCecZJ4y5USU6XSW9ijQ=; fh=VZwZbsQXtmVFpxvC7gcuhPF/zVY5sB/CE4c7obzPUYw=; b=IBq2gICyrEJsVVccLkiqjB3CwjNv8FjxFiZo5vtxzp/+Ir8wxjpRW61DgTyryAciiC dqLnFx+V9NFg+VNTf0x8etGu3bTdVGSSwZq/g+YiLrTmHf1tO/mdG9DiFqiTqlC/mBGO SJ7BzCVzDVgLG1ARf3j9GSDT/vY8WJBZNGczd+fuDPVmRpKDCctN0qEKDOcNShmjKghM NoDcPvRLoT52GAzmqY04CaN9RZmSAzkcMjwp6NJPDh+irKisRt1MCOMRiH2mPK2K7Xb9 x4eirh308PN5pzv/hrzxpLRLxzkxVJEjRJ2PhaEPi8p+lbpqt6LWTXC6t0B9XiEjjipw +aiw==; 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-170649-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-170649-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. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id fa31-20020a056a002d1f00b006f0c249ee94si9760951pfb.166.2024.05.06.21.26.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 21:26:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-170649-linux.lists.archive=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; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-170649-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-170649-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 C534F283065 for ; Tue, 7 May 2024 04:26:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3363A4F888; Tue, 7 May 2024 04:26:19 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 395994A12; Tue, 7 May 2024 04:26:17 +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=1715055978; cv=none; b=lAyEDkMnoksNVWlA8L+ULlS7L9+wCZXWXmuRZBjUXPuFO6MzRlQ83bM18LaNBlji2WmLV1PssUzRZwe+dWUkQZt0Rwa93Fu3TsDB50P3LuPkjTE+ML9Z4Z5z24UsAYibjd+W+hbyyGW92SpJmU9lG0ah6HSLiVQOZwyyjOXtSZE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715055978; c=relaxed/simple; bh=pSBUf1dK/6EsyOZ7Wud4+U1Sfmzs2Lcwsbd1Oxjjb8c=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=ZVDBA66cyhwcDGReUUrMbTxusYDHYARW16UKSwgVPMvvTMy3ai0uOdZaTg/EjWLa8o8ci28wDyawKZotuu5YzPInxrlPKfDwkcHMPFdU20aHeY9hnJZ9t2YuyF0I8FGFGUaVYsSPd6X6QwK2eVeBDSkxIxIRtnenBsxPZTR6vrw= 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 AB28D1042; Mon, 6 May 2024 21:26:42 -0700 (PDT) Received: from [10.163.33.37] (unknown [10.163.33.37]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7AD963F762; Mon, 6 May 2024 21:26:08 -0700 (PDT) Message-ID: <9896e877-276e-4c43-9368-f13cf7f2b25d@arm.com> Date: Tue, 7 May 2024 09:56:13 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 02/17] perf auxtrace: Allow number of queues to be specified Content-Language: en-US To: James Clark , 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: 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 References: <20240429152207.479221-1-james.clark@arm.com> <20240429152207.479221-3-james.clark@arm.com> From: Anshuman Khandual In-Reply-To: <20240429152207.479221-3-james.clark@arm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 4/29/24 20:51, James Clark wrote: > 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 LGTM Reviewed-by: Anshuman Khandual > --- > 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,