Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) (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 63BB5327A2E for ; Mon, 15 Sep 2025 15:08:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=192.198.163.7 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757948914; cv=fail; b=A0A0xzdXnkr6KvptbO7AUnKTqlg8Ap2DRMHRKQsFQeNj1e75vkG780S1hjLo3W4RqKMs8Qsxe+74ZGv4TE9kQSyDBvKClY3inOa/y4hMjOqcV9EONUY9RnRp2MHAF74pmNd3DfiqrKHb3IyZfScvfSlQ0gaie5n3mp4mtWWeFcc= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757948914; c=relaxed/simple; bh=t9VYVmHrPFxT0myMzAeZJoxR+axwKCGNhLWwoHFfWjM=; h=Message-ID:Date:Subject:To:CC:References:From:In-Reply-To: Content-Type:MIME-Version; b=S9Ak2KSm06yMWFzXsHTqY0DDFKVVo3gcgKLvHN/ppIjIbGrbp2NqrHhadrt7N8thf/f053BQlNdm6psaHg9+1jYDbBzTcjbhYu5/Tzjzv9arxfxgd+J3HqzNPeV+vYUcoeAvGm49H9t9bqEIKolztkxbM/IUicy7R2Q01Mi0zcI= ARC-Authentication-Results:i=2; 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=Fbnla1Rc; arc=fail smtp.client-ip=192.198.163.7 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Fbnla1Rc" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1757948912; x=1789484912; h=message-id:date:subject:to:cc:references:from: in-reply-to:content-transfer-encoding:mime-version; bh=t9VYVmHrPFxT0myMzAeZJoxR+axwKCGNhLWwoHFfWjM=; b=Fbnla1RcOvw+pqC3f5OyxizFpNH9TYizV8MIc8jWwieBSKlVW12vz4M6 Mm4Mgcada9cCqYBiTUt/w8zyh8Xmkk7xXToSPqTGzo3fLfiUekTVqVT9M sOwpH0gsW+aOrmSyroHe2wYwtiKlhUiHT5DTLH5s0Ob3IoIl+3DN6LJET 8LtzztBUuDv9gxeE5oENQFHbZTaRSog+ZmYnvqZrr4DA/YxDoBSkdnLb3 lKaaiDwUOIesVZRcjSTmqb2z/S3E9biFYuS68QYwye7D5xYpU3ymTHiOx 18qGaVlPn4FrGgJRdBVWNep9iZ+vYl1Z1KJicCphAJ0s9PDCna2gc7+T+ g==; X-CSE-ConnectionGUID: Hw/ZaYfaTj2BgvYP667mKA== X-CSE-MsgGUID: shvP7H9vT0GwMSiyswFwvA== X-IronPort-AV: E=McAfee;i="6800,10657,11554"; a="85642794" X-IronPort-AV: E=Sophos;i="6.18,266,1751266800"; d="scan'208";a="85642794" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Sep 2025 08:08:31 -0700 X-CSE-ConnectionGUID: Mpi8C6IjTwCSRKCuvw8f9g== X-CSE-MsgGUID: X1L6DwOsQ+KLWheFmCO41A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.18,266,1751266800"; d="scan'208";a="211838729" Received: from fmsmsx902.amr.corp.intel.com ([10.18.126.91]) by orviesa001.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Sep 2025 08:08:31 -0700 Received: from FMSMSX903.amr.corp.intel.com (10.18.126.92) by fmsmsx902.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.17; Mon, 15 Sep 2025 08:08:30 -0700 Received: from fmsedg902.ED.cps.intel.com (10.1.192.144) by FMSMSX903.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.17 via Frontend Transport; Mon, 15 Sep 2025 08:08:30 -0700 Received: from SN4PR0501CU005.outbound.protection.outlook.com (40.93.194.66) by edgegateway.intel.com (192.55.55.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.17; Mon, 15 Sep 2025 08:08:30 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=GseXsf9WrNid4DhLDM9M2OuBxu1OyUWRRUTMFyLu8P0x+ZGEbJgAg/yLd1g3/W+OxZ69OJI/6/Ue5fhqyOMLIg0m88+t+ViuXtOdzLPN0ujxukLJuK5ojf2Gg3RJfK8Wnl4qPhKQ2Fk6NK7xtSg6mqz2oG7Nk/zw0AO9kEFM4UsNw2P7Iam8bClKqXrkDHJV3358eGA4FPfSzpoqgeARcaiYUvQOPSLap99No/hRHHBF8NU9wFr9C46TLSK8xNgekJClbxLBRFVEK1/cyKt8EfIpyx3sD5jSjOpScoAFKhmczSxuCM/EdfJex2btygEg/3B1VA8/kKDEFo28vBlZ1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=qZ9v9t/fiAMnuEzWIZbTRLip8yZIWc038rtrV0XPeTk=; b=PzO6CdXU3ehwavx2dp9BcjCcrG6uq3XGpKKEWE9575QWps+KA9Kf57wr5z5jEg04N6ZikdKBv+eL12eneT0t86pu4KS2cw9tDYHtMRDg/n1MhdO+MdL8xhpqSp+RZCKB8hsd3e3R6ZLAnKkJA/bwccDvhFchZJRdsKdWgv+/WTFZfKVKIJG+Y4O9jTD9BOw9USYF1OSCWwUHI4iUKQPXZSGPp5M7+npvzfbTWiR2AFA7YSdI+4CMCjg/T+2gHQ/Wo/x9aRzHQjuLzcd6LJqsJ+6xoafFt9jfwOR6GMqAl78VmfoMD7qU1gDihEuqriqV+7rydtYUibJU/LKH9/tf5w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from IA1PR11MB7198.namprd11.prod.outlook.com (2603:10b6:208:419::15) by DS4PPF75D68BA1B.namprd11.prod.outlook.com (2603:10b6:f:fc02::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9115.22; Mon, 15 Sep 2025 15:08:27 +0000 Received: from IA1PR11MB7198.namprd11.prod.outlook.com ([fe80::eeac:69b0:1990:4905]) by IA1PR11MB7198.namprd11.prod.outlook.com ([fe80::eeac:69b0:1990:4905%5]) with mapi id 15.20.9115.020; Mon, 15 Sep 2025 15:08:27 +0000 Message-ID: <3a294b79-165e-4922-b4fc-8d85d65c8004@intel.com> Date: Mon, 15 Sep 2025 18:08:22 +0300 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH V2 4/6] tools/perf: Allocate and setup aux buffer queue to help co-relate with other events across CPU's To: Athira Rajeev , , , , , , CC: , , , , , References: <20250915072754.99850-1-atrajeev@linux.ibm.com> <20250915072754.99850-5-atrajeev@linux.ibm.com> Content-Language: en-US From: Adrian Hunter Organization: Intel Finland Oy, Registered Address: c/o Alberga Business Park, 6 krs, Bertel Jungin Aukio 5, 02600 Espoo, Business Identity Code: 0357606 - 4, Domiciled in Helsinki In-Reply-To: <20250915072754.99850-5-atrajeev@linux.ibm.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-ClientProxiedBy: DUZPR01CA0042.eurprd01.prod.exchangelabs.com (2603:10a6:10:468::9) To IA1PR11MB7198.namprd11.prod.outlook.com (2603:10b6:208:419::15) Precedence: bulk X-Mailing-List: linux-perf-users@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: IA1PR11MB7198:EE_|DS4PPF75D68BA1B:EE_ X-MS-Office365-Filtering-Correlation-Id: 094161f0-dcd2-4ff8-58f3-08ddf469b907 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|7416014|376014; X-Microsoft-Antispam-Message-Info: =?utf-8?B?MUxSQjlOamtSR0dZY1JMdERLcXM5TFJqU3VrU2xmMnFJejZnNGFkNHlSZ0NY?= =?utf-8?B?QlNDc2hTN1crd3YxNWY5L29mem0zRVloa2QxcUlyMTJYL2l4QVJLZUZuRkNV?= =?utf-8?B?RjFMcWp3Wkt3UWZSWEtaMTlKNTFvMjMzYUk4b29pVjF4dzhFWGVpb0tPbVFQ?= =?utf-8?B?akNHYndLcm51ZEo2eEg1RjlhbXRteWw3NFN3ZTRHZ3l2RlliUDN0QzhJVHN2?= =?utf-8?B?YkFrNld4WTUyOUNhbk05OXpSTjFlZmh4NzdzTUlKbmo0Wldab2ExcVdLL1Qx?= =?utf-8?B?SEQ3b3h3dzBjRWpEVlN5eko1NHNKaVJkajBQaFdsRnhyc25xM2VwdTE0S0t0?= =?utf-8?B?YVZHZUgzVUpUVXBCS2xsTGNmK1NvNE5Zd0NCVkVQU1NwUmNMZHVvd3ZZb2Z3?= =?utf-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nJmazM0dkh6?= =?utf-8?B?YkFNaktub0t0RUpJZjlyZzZWWlJQb2RjNUNxQjVEZ3dzVHlXQ3R5VCt6ands?= =?utf-8?B?QVhBdXl4VzZHSGdCRTZHbjZOaXFRYTlndDhISFBWOXpkb28zTmNJaEVQRlJZ?= =?utf-8?B?Tll1M2ppdlVTYXd0TzBsYVRyamgrMTJLVThlQkNjUk43RjNkSWpDdVlsTGc5?= =?utf-8?B?VXhKN0FwOFM5U3NKVml3a25JVUhhblB6M1RwWFlhKzBsbUdSeW0rcldrWmpo?= =?utf-8?B?cVlTcGQzQzNpcTBuelJoaU1TSlFDd1A3RURsTGJtdmE5dWdWSGRWdWV2SnBk?= =?utf-8?B?UWpwWVNncmtWSjJoVk1LcmlxNlU3RXR3a3g5MFp3NTZscElzSWFNRkF3SVJm?= =?utf-8?B?R0NweU9WM1BiekVReEtxNUVqbHhwOVRaQUI3ZjZMeUlSczNGdWpJT214Tnp5?= =?utf-8?B?b2JaSmJKb2lrMEd1UGFGQnZKNlJOOWU0Q0kza0wreWV2Y3NNRHRMajNyYlRV?= =?utf-8?B?REdwblg2OGpMMWlmS2c0V2V4aGdZbVh3Wlh3cm12Tm1TajIxdlR6YXgrcndJ?= =?utf-8?B?RXA0YzRxL1hPa1o4Z0FEaTZZSlB3NDVYbVpOWmUrQzJJY2oyUmkydUVGU2FQ?= =?utf-8?Q?2maxr1eQW0o=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:IA1PR11MB7198.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(366016)(7416014)(376014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?SXZ3MUEyQ05xQmhWRjcrRTRCaWZ2UzBNWkMvVmVWKzNucFRGaTlJSndNR3V4?= =?utf-8?B?am5tTVc1eWM5NE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vcGlF?= =?utf-8?B?SEZSSHlVQzNZSnROSDR4bFNjL2swOEtkU0M0NS9Kdkoza0FTellnUmZwbWQw?= =?utf-8?B?QURoQW9xSnM4bGNtaHpoY0NSb1QvOHhpNGlsYVh6UWNUQUYwam91V1BWREty?= =?utf-8?B?Zko4S2tDTlhUTHVKalRmbXdBMXIrbDlZVGFPR1gvUXFPbGZqZFZ1K2NFYzkw?= =?utf-8?B?dkdIejlkR080WWgra0piYk9uRHNlWk9ZeWtNUllnRHVJbFhlY1F2OGpKc3RC?= =?utf-8?B?MjFjVm5vTjh4YUVHT3Fhdm1MSkU3SlJQSXprNkVWb3FjZlljd21hL25Iby82?= =?utf-8?B?U3c9PQ==?= X-MS-Exchange-CrossTenant-Network-Message-Id: 094161f0-dcd2-4ff8-58f3-08ddf469b907 X-MS-Exchange-CrossTenant-AuthSource: IA1PR11MB7198.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2025 15:08:27.1346 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: xkqn8WnL0W/dihZeW3OwWEUGweHFL6EAJ2nsN6mColiwSESVAG3+MIxtLsi613fknqk0SjJMqh4cnxB//JlwwQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS4PPF75D68BA1B X-OriginatorOrg: intel.com On 15/09/2025 10:27, Athira Rajeev wrote: > When the Dispatch Trace Log data is collected along with other events > like sched tracepoint events, it needs to be correlated and present > interleaved along with these events. Perf events can be collected > parallely across the CPUs. Hence it needs to be ensured events/dtl > entries are processed in timestamp order. > > An auxtrace_queue is created for each CPU. Data within each queue is in > increasing order of timestamp. Each auxtrace queue has a array/list of > auxtrace buffers. When processing the auxtrace buffer, the data is > mmapp'ed. All auxtrace queues is maintained in auxtrace heap. Each queue > has a queue number and a timestamp. The queues are sorted/added to head > based on the time stamp. So always the lowest timestamp (entries to be > processed first) is on top of the heap. > > The auxtrace queue needs to be allocated and heap needs to be populated > in the sorted order of timestamp. The queue needs to be filled with data > only once via powerpc_vpadtl__update_queues() function. > powerpc_vpadtl__setup_queues() iterates through all the entries to > allocate and setup the auxtrace queue. To add to auxtrace heap, it is > required to fetch the timebase of first entry for each of the queue. > > The first entry in the queue for VPA DTL PMU has the boot timebase, > frequency details which are needed to get timestamp which is required to > correlate with other events. The very next entry is the actual trace data > that provides timestamp for occurrence of DTL event. Formula used to get > the timestamp from dtl entry is: > > ((timbase from DTL entry - boot time) / frequency) * 1000000000 > > powerpc_vpadtl_decode() adds the boot time and frequency as part of > powerpc_vpadtl_queue structure so that it can be reused. Each of the > dtl_entry is of 48 bytes size. Sometimes it could happen that one buffer > is only partially processed (if the timestamp of occurrence of another > event is more than currently processed element in queue, it will move on > to next event). In order to keep track of position of buffer, additional > fields is added to powerpc_vpadtl_queue structure. > > Signed-off-by: Athira Rajeev > --- > Changelog: > Addressed review comments from Adrian > - Moved time calculation to separate function > > tools/perf/util/powerpc-vpadtl.c | 226 ++++++++++++++++++++++++++++++- > 1 file changed, 223 insertions(+), 3 deletions(-) > > diff --git a/tools/perf/util/powerpc-vpadtl.c b/tools/perf/util/powerpc-vpadtl.c > index 9098cbe00bfd..637abde60f44 100644 > --- a/tools/perf/util/powerpc-vpadtl.c > +++ b/tools/perf/util/powerpc-vpadtl.c > @@ -10,6 +10,8 @@ > #include "session.h" > #include "debug.h" > #include "powerpc-vpadtl.h" > +#include "sample.h" > +#include "tool.h" > > /* > * Structure to save the auxtrace queue > @@ -38,6 +40,14 @@ struct powerpc_vpadtl_queue { > struct auxtrace_buffer *buffer; > struct thread *thread; > bool on_heap; > + struct powerpc_vpadtl_entry *dtl; > + u64 timestamp; > + unsigned long pkt_len; > + unsigned long buf_len; > + u64 boot_tb; > + u64 tb_freq; > + unsigned int tb_buffer; > + unsigned int size; > bool done; > pid_t pid; > pid_t tid; > @@ -112,6 +122,33 @@ static void powerpc_vpadtl_dump(struct powerpc_vpadtl *vpa __maybe_unused, > } > } > > +static unsigned long long powerpc_vpadtl_timestamp(struct powerpc_vpadtl_queue *vpaq) > +{ > + struct powerpc_vpadtl_entry *record = vpaq->dtl; > + double result, div; > + double boot_freq; > + unsigned long long boot_tb; > + unsigned long long diff; > + unsigned long long timestamp = 0; Prettier in descending line length e.g. struct powerpc_vpadtl_entry *record = vpaq->dtl; unsigned long long timestamp = 0; unsigned long long boot_tb; unsigned long long diff; double result, div; double boot_freq; > + > + /* > + * Formula used to get timestamp that can be co-related with > + * other perf events: > + * ((timbase from DTL entry - boot time) / frequency) * 1000000000 > + */ > + if (record->timebase) { > + boot_tb = vpaq->boot_tb; > + boot_freq = vpaq->tb_freq; > + diff = be64_to_cpu(record->timebase) - boot_tb; > + div = diff / boot_freq; > + result = div; > + result = result * 1000000000; > + timestamp = result; > + } > + > + return timestamp; > +} > + > static struct powerpc_vpadtl *session_to_vpa(struct perf_session *session) > { > return container_of(session->auxtrace, struct powerpc_vpadtl, auxtrace); > @@ -124,12 +161,195 @@ static void powerpc_vpadtl_dump_event(struct powerpc_vpadtl *vpa, unsigned char > powerpc_vpadtl_dump(vpa, buf, len); > } > > +static int powerpc_vpadtl_get_buffer(struct powerpc_vpadtl_queue *vpaq) > +{ > + struct auxtrace_buffer *buffer = vpaq->buffer; > + struct auxtrace_queues *queues = &vpaq->vpa->queues; > + struct auxtrace_queue *queue; > + > + queue = &queues->queue_array[vpaq->queue_nr]; > + buffer = auxtrace_buffer__next(queue, buffer); > + > + if (!buffer) > + return 0; > + > + vpaq->buffer = buffer; > + vpaq->size = buffer->size; > + > + /* If the aux_buffer doesn't have data associated, try to load it */ > + if (!buffer->data) { > + /* get the file desc associated with the perf data file */ > + int fd = perf_data__fd(vpaq->vpa->session->data); > + > + buffer->data = auxtrace_buffer__get_data(buffer, fd); > + if (!buffer->data) > + return -ENOMEM; > + } > + > + vpaq->buf_len = buffer->size; > + > + if (buffer->size % dtl_entry_size) > + vpaq->buf_len = buffer->size - (buffer->size % dtl_entry_size); > + > + if (vpaq->tb_buffer != buffer->buffer_nr) { > + vpaq->pkt_len = 0; > + vpaq->tb_buffer = 0; > + } > + > + return 1; > +} > + > +/* > + * The first entry in the queue for VPA DTL PMU has the boot timebase, > + * frequency details which are needed to get timestamp which is required to > + * correlate with other events. Save the boot_tb and tb_freq as part of > + * powerpc_vpadtl_queue. The very next entry is the actual trace data to > + * be returned. > + */ > +static int powerpc_vpadtl_decode(struct powerpc_vpadtl_queue *vpaq) > +{ > + int ret; > + char *buf; > + struct boottb_freq *boottb; > + > + ret = powerpc_vpadtl_get_buffer(vpaq); > + if (ret <= 0) > + return ret; > + > + boottb = (struct boottb_freq *)vpaq->buffer->data; > + if (boottb->timebase == 0) { > + vpaq->boot_tb = boottb->boot_tb; > + vpaq->tb_freq = boottb->tb_freq; > + vpaq->pkt_len += dtl_entry_size; > + } > + > + buf = vpaq->buffer->data; > + buf += vpaq->pkt_len; > + vpaq->dtl = (struct powerpc_vpadtl_entry *)buf; > + > + vpaq->tb_buffer = vpaq->buffer->buffer_nr; > + vpaq->buffer = NULL; > + vpaq->buf_len = 0; > + > + return 1; > +} > + > +static struct powerpc_vpadtl_queue *powerpc_vpadtl__alloc_queue(struct powerpc_vpadtl *vpa, > + unsigned int queue_nr) > +{ > + struct powerpc_vpadtl_queue *vpaq; > + > + vpaq = zalloc(sizeof(*vpaq)); > + if (!vpaq) > + return NULL; > + > + vpaq->vpa = vpa; > + vpaq->queue_nr = queue_nr; > + > + return vpaq; > +} > + > +/* > + * When the Dispatch Trace Log data is collected along with other events > + * like sched tracepoint events, it needs to be correlated and present > + * interleaved along with these events. Perf events can be collected > + * parallely across the CPUs. > + * > + * An auxtrace_queue is created for each CPU. Data within each queue is in > + * increasing order of timestamp. Allocate and setup auxtrace queues here. > + * All auxtrace queues is maintained in auxtrace heap in the increasing order > + * of timestamp. So always the lowest timestamp (entries to be processed first) > + * is on top of the heap. > + * > + * To add to auxtrace heap, fetch the timestamp from first DTL entry > + * for each of the queue. > + */ > +static int powerpc_vpadtl__setup_queue(struct powerpc_vpadtl *vpa, > + struct auxtrace_queue *queue, > + unsigned int queue_nr) > +{ > + struct powerpc_vpadtl_queue *vpaq = queue->priv; > + > + if (list_empty(&queue->head) || vpaq) > + return 0; > + > + vpaq = powerpc_vpadtl__alloc_queue(vpa, queue_nr); > + if (!vpaq) > + return -ENOMEM; > + > + queue->priv = vpaq; > + > + if (queue->cpu != -1) > + vpaq->cpu = queue->cpu; > + > + if (!vpaq->on_heap) { > + int ret; > +retry: > + ret = powerpc_vpadtl_decode(vpaq); > + if (!ret) > + return 0; > + > + if (ret < 0) > + goto retry; > + > + vpaq->timestamp = powerpc_vpadtl_timestamp(vpaq); > + > + ret = auxtrace_heap__add(&vpa->heap, queue_nr, vpaq->timestamp); > + if (ret) > + return ret; > + vpaq->on_heap = true; > + } > + > + return 0; > +} > + > +static int powerpc_vpadtl__setup_queues(struct powerpc_vpadtl *vpa) > +{ > + unsigned int i; > + int ret; > + > + for (i = 0; i < vpa->queues.nr_queues; i++) { > + ret = powerpc_vpadtl__setup_queue(vpa, &vpa->queues.queue_array[i], i); > + if (ret) > + return ret; > + } > + > + return 0; > +} > + > +static int powerpc_vpadtl__update_queues(struct powerpc_vpadtl *vpa) > +{ > + if (vpa->queues.new_data) { > + vpa->queues.new_data = false; > + return powerpc_vpadtl__setup_queues(vpa); > + } > + > + return 0; > +} > + > static int powerpc_vpadtl_process_event(struct perf_session *session __maybe_unused, session is not __maybe_unused > union perf_event *event __maybe_unused, > - struct perf_sample *sample __maybe_unused, > - const struct perf_tool *tool __maybe_unused) > + struct perf_sample *sample, > + const struct perf_tool *tool) > { > - return 0; > + struct powerpc_vpadtl *vpa = session_to_vpa(session); > + int err = 0; > + > + if (dump_trace) > + return 0; > + > + if (!tool->ordered_events) { > + pr_err("VPA requires ordered events\n"); > + return -EINVAL; > + } > + > + if (sample->time) { > + err = powerpc_vpadtl__update_queues(vpa); > + if (err) > + return err; > + } > + > + return err; > } > > /*