From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0B0DBECAAD3 for ; Wed, 7 Sep 2022 23:48:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229514AbiIGXsC (ORCPT ); Wed, 7 Sep 2022 19:48:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229498AbiIGXsB (ORCPT ); Wed, 7 Sep 2022 19:48:01 -0400 Received: from mail-oa1-x2a.google.com (mail-oa1-x2a.google.com [IPv6:2001:4860:4864:20::2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03E9CA7ABD; Wed, 7 Sep 2022 16:48:01 -0700 (PDT) Received: by mail-oa1-x2a.google.com with SMTP id 586e51a60fabf-127dca21a7dso12746242fac.12; Wed, 07 Sep 2022 16:48:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:references :in-reply-to:user-agent:subject:cc:to:from:date:from:to:cc:subject :date; bh=w1jsb9wOLkTivNg7H4Hec7LMmj4ViVYdB0XbI1tSz6Q=; b=YRQVcKMby3Lds4fI1dduM5cnu84BBJmqE+V/8aoNSsKHyJUvL3NSmRNZktPhQk1CA+ 1rhFzop7CfNMnPjf8jsb0zQIkyYvQyZa2aQ7Jz7a3VLwGyzXl2/VDk1QKwu1JrCrCuTJ R1HdxuEGGk1/2j508/saF+5jSg+UEy2yZv6cEnVImDYJvHx7sg0wm6ewRqWBzpZ+hAmO nwzixxJ7JxIvI7qI1RVAI66UKySJJPJP2/cK+yeUwDYCYxotEyZ4gaXyTgm09VbKI3Nq CkxlP61i7lOgiMmUppwzNFw/Jw/UIYW/KfBualPJ1UbCWKQVvlVwVw5JPsEbPV0Wq0Yw Ugtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:references :in-reply-to:user-agent:subject:cc:to:from:date:x-gm-message-state :from:to:cc:subject:date; bh=w1jsb9wOLkTivNg7H4Hec7LMmj4ViVYdB0XbI1tSz6Q=; b=P9b8u0IdN4c8xH9GxNBvZX5KKpsj3972dzV9QMhrUEnQiZTSRHHONFLKP24rk06diC 3o9gGPTWuJk32ZyqHhJ9pvVecgZJVS6UoHrEfwhOXVDeMxkR5Mua7IMymrlE6UnKdiR0 pDJdvCubuSGupWjXaaZ1IE8UJ1Db5vXShifoOAWNNZ496x9JSSCPFSr22dfMB0iFm3O4 dvzgeljtO5mpZzAHXJ7bKcoCoaaNK158iyfAwU7n6aVpXl8sDC9hooGDCm1LGHb1rxt7 UUfAITJSrevB9seBeN4mVAFxhPEUV19Li/FDjZ76KG97DY/e2y99FoS+y8uuJDRdBRYi NPvg== X-Gm-Message-State: ACgBeo0p5usGW+pActuYNbrCh57zATfFyu0gyE2Ws/N/Yjwdb6REAvA+ iBwTfMH1azzRN+X9nfc4ghM= X-Google-Smtp-Source: AA6agR6aDYxIORrlxVEIh/LKtjt+J4FbgrE3PqkkkgAjnjOoRvsRESt4PhxUQGT51MezedGJdeypDg== X-Received: by 2002:aca:2109:0:b0:345:7ad9:dbb5 with SMTP id 9-20020aca2109000000b003457ad9dbb5mr370923oiz.66.1662594480279; Wed, 07 Sep 2022 16:48:00 -0700 (PDT) Received: from [127.0.0.1] ([179.97.37.151]) by smtp.gmail.com with ESMTPSA id w62-20020acaad41000000b0034516ca90dcsm6943533oie.23.2022.09.07.16.47.58 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 07 Sep 2022 16:47:59 -0700 (PDT) Date: Wed, 07 Sep 2022 20:47:52 -0300 From: Arnaldo Carvalho de Melo To: Ian Rogers , Jiri Olsa CC: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Namhyung Kim , James Clark , Kees Cook , "Gustavo A. R. Silva" , Adrian Hunter , Riccardo Mancini , German Gomez , Colin Ian King , Song Liu , Dave Marchevsky , Athira Rajeev , Alexey Bayduraev , Leo Yan , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, Stephane Eranian Subject: Re: [PATCH v2 6/6] perf cpumap: Add range data encoding User-Agent: K-9 Mail for Android In-Reply-To: References: <20220614143353.1559597-1-irogers@google.com> <20220614143353.1559597-7-irogers@google.com> Message-ID: <9B5AEBE0-D000-4D58-94BA-85153C5CD66F@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-perf-users@vger.kernel.org On September 7, 2022 7:41:19 PM GMT-03:00, Ian Rogers wrote: >On Thu, Aug 4, 2022 at 12:30 PM Ian Rogers wrote: >> >> On Sun, Jul 31, 2022 at 5:39 AM Jiri Olsa wrote: >> > >> > On Tue, Jun 14, 2022 at 07:33:53AM -0700, Ian Rogers wrote: >> > >> > SNIP >> > >> > > + event =3D cpu_map_data__alloc(&syn_data, sizeof(struct perf_e= vent_header)); >> > > if (!event) >> > > return NULL; >> > > >> > > + syn_data=2Edata =3D &event->data; >> > > event->header=2Etype =3D PERF_RECORD_CPU_MAP; >> > > - event->header=2Esize =3D size; >> > > - event->data=2Etype =3D type; >> > > - >> > > - cpu_map_data__synthesize(&event->data, map, type, max); >> > > + event->header=2Esize =3D syn_data=2Esize; >> > > + cpu_map_data__synthesize(&syn_data); >> > > return event; >> > > } >> > > >> > > + >> > > int perf_event__synthesize_cpu_map(struct perf_tool *tool, >> > > const struct perf_cpu_map *map, >> > > perf_event__handler_t process, >> > > @@ -1891,24 +1894,20 @@ int perf_event__synthesize_event_update_nam= e(struct perf_tool *tool, struct evse >> > > int perf_event__synthesize_event_update_cpus(struct perf_tool *too= l, struct evsel *evsel, >> > > perf_event__handler_t pr= ocess) >> > > { >> > > - size_t size =3D sizeof(struct perf_event_header) + sizeof(u64= ) + sizeof(u64); >> > > + struct synthesize_cpu_map_data syn_data =3D { =2Emap =3D evse= l->core=2Eown_cpus }; >> > > struct perf_record_event_update *ev; >> > > - int max, err; >> > > - u16 type; >> > > - >> > > - if (!evsel->core=2Eown_cpus) >> > > - return 0; >> > >> > all seems fine, just looks like we no longer do this check, >> > might not be needed anymore, as that changed in past >> >> This function is called in a test and in this file=2E The caller alread= y >> does this test and so the check is redundant plus a little confusing: >> https://git=2Ekernel=2Eorg/pub/scm/linux/kernel/git/acme/linux=2Egit/tr= ee/tools/perf/util/synthetic-events=2Ec?h=3Dperf/core#n2062 >> As you say, it wasn't needed any more and so I removed it=2E >> >> Thanks, >> Ian > >Would be nice to land this imo=2E Anything outstanding? I'll check first hour tomorrow, today was a holiday down here=2E - Arnaldo > >Thanks, >Ian > >> > thanks, >> > jirka >> > >> > > + int err; >> > > >> > > - ev =3D cpu_map_data__alloc(evsel->core=2Eown_cpus, &size, &ty= pe, &max); >> > > + ev =3D cpu_map_data__alloc(&syn_data, sizeof(struct perf_even= t_header) + 2 * sizeof(u64)); >> > > if (!ev) >> > > return -ENOMEM; >> > > >> > > + syn_data=2Edata =3D &ev->cpus=2Ecpus; >> > > ev->header=2Etype =3D PERF_RECORD_EVENT_UPDATE; >> > > - ev->header=2Esize =3D (u16)size; >> > > + ev->header=2Esize =3D (u16)syn_data=2Esize; >> > > ev->type =3D PERF_EVENT_UPDATE__CPUS; >> > > ev->id =3D evsel->core=2Eid[0]; >> > > - >> > > - cpu_map_data__synthesize(&ev->cpus=2Ecpus, evsel->core=2Eown_= cpus, type, max); >> > > + cpu_map_data__synthesize(&syn_data); >> > > >> > > err =3D process(tool, (union perf_event *)ev, NULL, NULL); >> > > free(ev); >> > > -- >> > > 2=2E36=2E1=2E476=2Eg0c4daa206d-goog >> > >