Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1827534lqa; Mon, 29 Apr 2024 23:37:13 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUb3QKbO4LPV6hJwzsxh61LMG8lf6m3rb6Zed+gqfFeBVpjOUf9nyFGywoD0nS5PJ07lDFYVaBncTSFo4YW9Pb5H80uYUevoqWy2qoHDg== X-Google-Smtp-Source: AGHT+IEYuP0FkfZvPYFA+6NHwyAfi2YOwA/2BXhRRhcMMJJcgHBM9WrUosTk2cmm4DzI1ui+r1Hu X-Received: by 2002:ac8:7dc6:0:b0:43b:6fa:9756 with SMTP id c6-20020ac87dc6000000b0043b06fa9756mr4887338qte.27.1714459033506; Mon, 29 Apr 2024 23:37:13 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714459033; cv=pass; d=google.com; s=arc-20160816; b=w+cYeLdTMNdcQtgbNeCgn6eeKbCj56pSreiV4toirHEeBvgam2Ruvl4bsqltY7Gjz2 ckDk0msocpJCo1pkV8vuvnszY6KEktBGLQSL95qePhDTAK7AXKhB0J+4MOKJFyUhrb/I kiu6xuKOx1UK2c+gDK2IKZEuj+VjVt0ZECTyJzhx35Dr1M+ebX7/eVWnxg3gfUB/JCZY 7E//1Nh3c9joy79PWwANPGNupTQTro+DrAbZLb3GAZof6iaozJiskUXi3MZjdQNABek/ gx9cZbNj1wMbKQCJb0YE607valxy23yt72nWpg4/4L8CA58JBrmwlgsI0y1MSUruiES1 ZrCg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:organization:from :content-language:references:cc:to:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature; bh=Pc40ZxBXfWqDjMVbOh6VCRUqGzQEdbYhKVN4pcYbiuk=; fh=eJ971dKriPwppWEfyZJNfDOOLX4rtQDgINHGZIxcbWc=; b=Jv+eg/ic5ppiAkePrJLK8FQwyLBTtsB2vsWmM3nwSx2DNqpfKIPP4eJppIyk78Ha2k eDhrb+ZENdSlpi/jecas7dYdEA+8ffBv9e1Ab5ue/1rbW/uHm7FxE8sEocXu6S7FuH3M ewBZHTzA52lXxXlB/DtSfCfvF2AKoBeBtv/iMP+E3M24vaXMpHQRwihnUIOvkyU34A6t zsgRlRPrAY7zrcwSSQnobe6qfANxfhtnmt2qr3AVrLKp2xq8l4tJmAV8TAxv1/RQXmh3 uerV9Fgw6BGiGEjFiOGh7rPkkMg+KCCDUKSScjF1UEvVIjJfd1h6+VS4r/XidFyNcdfT QTEw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="dPnWd5/x"; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-163417-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-163417-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id u5-20020ac858c5000000b0043b03837aeasi2701167qta.470.2024.04.29.23.37.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 23:37:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-163417-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="dPnWd5/x"; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-163417-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-163417-linux.lists.archive=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 326281C20FE0 for ; Tue, 30 Apr 2024 06:37:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A38AD199B8; Tue, 30 Apr 2024 06:37:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="dPnWd5/x" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) (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 E120B18030; Tue, 30 Apr 2024 06:37:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714459025; cv=none; b=GkcsF0YGp6eyKMaLKihHCfdUpJ+Ir7+mRudoatsZZ3Yrh36eNaHyd4y/QQBO6DfFFhBO0eXnm8EZM5qJrqaL3zKrgnNsfXzcKohlMqTKMtVngVae8JvlUqOoUAGIRh8XHieY29bp6WIu4Ehmaipav2UOADLXL2syi3t1TCMx2aU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714459025; c=relaxed/simple; bh=KGo6hIvlY2DFfXRayOwhLfEDabosAECVdBp2tiThtkc=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=eNTPE4gT7vHOZLPd8PwO76bt6+vO5A5uKyEagq/op592y8plSs8Mc8ETd6yiwngDt5cNXGqTCYU9EBpOdiP5o/KuGiuIpgy7k5MXWMNJujxJXeQWndem2NTnxhnkFEEquzmF16ZkbqHA+qsgU6PVI5qL/4XV6TkJNI9e27GHjJU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=dPnWd5/x; arc=none smtp.client-ip=198.175.65.18 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=1714459024; x=1745995024; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=KGo6hIvlY2DFfXRayOwhLfEDabosAECVdBp2tiThtkc=; b=dPnWd5/xeYkPlqxRHYfq0ExU1qCfMTDM84c7I1GonJSy+PuOXOIcwQxE Qw0CmqTGxmPXCoAu1SosSmCpPfWID7+Krn8Xy6nu+iuykHTEWnz3uFd5G 8jT2mKuC9+nU054yhcos3jd3YeaahZLrb2T+bGAzKurXpr36okRX7ulIS 1W2J9wEZ1oh9GSYNqUM69ZPxjOhatgJM9PJzf2/Qpfa7Y/F+jc+B2HL05 z3ZPMUGQnVejPq4O1+olotS2oVnr7gWYKgq/YSckxlY3Ial57tIZe1Avm /fZioxOKlvEBvBgROlF0kH/cm6f/wbjjHL6LMC61rMTmA1XW01KJQik9u w==; X-CSE-ConnectionGUID: SgMZENu0SwaZsTGMeNxM2g== X-CSE-MsgGUID: O6Vl92QJR2ab17VoNjb3Mg== X-IronPort-AV: E=McAfee;i="6600,9927,11059"; a="10316006" X-IronPort-AV: E=Sophos;i="6.07,241,1708416000"; d="scan'208";a="10316006" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Apr 2024 23:37:03 -0700 X-CSE-ConnectionGUID: kgMW4csVRV6x1K/Yr6uucg== X-CSE-MsgGUID: 8JTDsJIoQByUwUenbUVmng== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,241,1708416000"; d="scan'208";a="26973237" Received: from ahunter6-mobl1.ger.corp.intel.com (HELO [10.0.2.15]) ([10.252.49.27]) by orviesa008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Apr 2024 23:36:53 -0700 Message-ID: Date: Tue, 30 Apr 2024 09:36:48 +0300 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 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 , 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> Content-Language: en-US From: Adrian Hunter Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki In-Reply-To: <20240429152207.479221-3-james.clark@arm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 29/04/24 18:21, 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 Acked-by: Adrian Hunter > --- > 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,