Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp879639rwb; Thu, 4 Aug 2022 12:42:11 -0700 (PDT) X-Google-Smtp-Source: AA6agR6+RiWiGK9nX0cRrXer/PZ/Fvpom9B/IzjYhhgGLgfYKjVFi/h6VHxx9gd8iTsV+s//glEv X-Received: by 2002:a05:6402:4148:b0:43b:7f36:e25f with SMTP id x8-20020a056402414800b0043b7f36e25fmr3497324eda.407.1659642131348; Thu, 04 Aug 2022 12:42:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659642131; cv=none; d=google.com; s=arc-20160816; b=upOIr3K6NI6Cn3v0sDwm+EaYyZ9aTYKA7ZJQ0q0B7/QjXHGnTqX6wweYAIMRv9+IN5 6r/UYX6egrgv4HBnQkN1fmbKB2WKUurPuDMBwUefKwEOPzw75xVlFbC5c7tJpLJiQKtL QvQoHiI+tjIevFU19HJMz2rMxvVVr3sPFZEjaE2BytDSo0lEAVzig37jVuvPUmkJh3GR vIlBTojhXCPRIWedsna4Qdc04pjl8jgCAsWcZjr6FzUIduQs7PAo/a5CUMf6vqn/r7Vz k9QUr3Q4DESru4ZpXWCYAUqxmEtdEZ+XYnf0hOn6WLl08xSiI94UvOXTvMmNz4PYu6fQ Ej5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=aGjkhmIvnwcqLQbSOFBCkR1cfjJE7Hbwa+5fNevRKuc=; b=XCgFGMbvFvjmOB8nuCHQewRt+jlyLvQ06ibqiAOYRFLjTOREcWGoEctsOzkXCIjAdk BxakbP4WPr397N9ho0XT0Co7TFpP0Oj44Xi8+lm+/opgHuUdKB2sJ0zpUt+W8VQnyWkw hsNwA1jv8S6ltClnBRAyhAkeTvUPp1jxzQUexOCAsuOWsL0FW0XFGTwOdfFjI8zr7Izq OSfoZqAb0GFT+Of2YsxQJ6aoNZj6sxjfEvA8lKqiSoZ6joXI1I8Jm/m019A1B9loXOf/ JAn/N2ZcNWRUYH9Cz7UTrD7GJFq+klkADnWFJG/dNwQhmaC3wZ1X4SE9wU14xCU7Yz3s auwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=QaVYvQCz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gs43-20020a1709072d2b00b00730bc62502dsi1890298ejc.713.2022.08.04.12.41.46; Thu, 04 Aug 2022 12:42:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=QaVYvQCz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238488AbiHDTbL (ORCPT + 99 others); Thu, 4 Aug 2022 15:31:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233540AbiHDTbJ (ORCPT ); Thu, 4 Aug 2022 15:31:09 -0400 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2ECB6E2C2 for ; Thu, 4 Aug 2022 12:31:07 -0700 (PDT) Received: by mail-wr1-x435.google.com with SMTP id q30so861610wra.11 for ; Thu, 04 Aug 2022 12:31:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=aGjkhmIvnwcqLQbSOFBCkR1cfjJE7Hbwa+5fNevRKuc=; b=QaVYvQCz30zqEprRDkqypJhLvUiWaB4HFXQtkkrHtZSTC55M9bFdWYP9Fhi3TJhUkp grFlEeAySbHkix58AxR9WzAvLQG8UkV5srm0Srzp5r7xmg452kovuHWCEbNcm7/IYsw8 HK8BO2Ty/iW3zrj7ftgMnxvuwm8Uem0BFKfYefgl703v0mupkMJJOUGwOAclEd/9RnJg mxGg+f5w9xUiFrZ6KO1SKTWkRV52RzGgrmG+h7mld1ktX1qa9TUp1U5vCyFzKXhSleeG LW+lNqrn9KoBWR0xxzPasviGm2ZKSRMGX1zxsv9eSrNTlHiv0rGAyDd/y94Um6MDywSh qwsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=aGjkhmIvnwcqLQbSOFBCkR1cfjJE7Hbwa+5fNevRKuc=; b=1hzn8HQtkreAiDHUVZsMhNvzYEzmYp+B/F6NZbw7DjRpqwA2Ct19YILgwL0mficlB9 PitDrvhkf4QwFdVSvuW+gQvT4kn5IMCuByv0A2jlZabQ8M6GA06aFYbeQMzg0cznKrSI jtUDhiaXR+9H1F6rgaMTJ6wGy8IzN2wNh5AyBgk1IuZId2BfzRRlklkX0Z5SCnBTb4r1 KzBJxwhWVeNJzxrLUGMybTSm+5O0XIaLqAFe4MIXBKlgrcWwumgQmHLLeXVJ1NL6N6LG DaLSoamr85Hy6tbXbSu0Yk1AKQ9W6gKvrn2XJmPvzz1RFsHX/PAUoEwP+2Xi3MXQd0HR ayMg== X-Gm-Message-State: ACgBeo0G0sMr0qXN6uj25L46/qd0K1FzhgLuArPK7knUhjl4hVY/8hs/ 5YqoXxUB5li/TcO9qOJh1fxc7Qswdvqu9rsDhzR86Q== X-Received: by 2002:adf:e28d:0:b0:21e:4c3b:b446 with SMTP id v13-20020adfe28d000000b0021e4c3bb446mr2278375wri.300.1659641466133; Thu, 04 Aug 2022 12:31:06 -0700 (PDT) MIME-Version: 1.0 References: <20220614143353.1559597-1-irogers@google.com> <20220614143353.1559597-7-irogers@google.com> In-Reply-To: From: Ian Rogers Date: Thu, 4 Aug 2022 12:30:53 -0700 Message-ID: Subject: Re: [PATCH v2 6/6] perf cpumap: Add range data encoding To: 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 Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 = cpu_map_data__alloc(&syn_data, sizeof(struct perf_event_header)); > > if (!event) > > return NULL; > > > > + syn_data.data = &event->data; > > event->header.type = PERF_RECORD_CPU_MAP; > > - event->header.size = size; > > - event->data.type = type; > > - > > - cpu_map_data__synthesize(&event->data, map, type, max); > > + event->header.size = syn_data.size; > > + 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_name(struct perf_tool *tool, struct evse > > int perf_event__synthesize_event_update_cpus(struct perf_tool *tool, struct evsel *evsel, > > perf_event__handler_t process) > > { > > - size_t size = sizeof(struct perf_event_header) + sizeof(u64) + sizeof(u64); > > + struct synthesize_cpu_map_data syn_data = { .map = evsel->core.own_cpus }; > > struct perf_record_event_update *ev; > > - int max, err; > > - u16 type; > > - > > - if (!evsel->core.own_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. The caller already does this test and so the check is redundant plus a little confusing: https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/tree/tools/perf/util/synthetic-events.c?h=perf/core#n2062 As you say, it wasn't needed any more and so I removed it. Thanks, Ian > thanks, > jirka > > > + int err; > > > > - ev = cpu_map_data__alloc(evsel->core.own_cpus, &size, &type, &max); > > + ev = cpu_map_data__alloc(&syn_data, sizeof(struct perf_event_header) + 2 * sizeof(u64)); > > if (!ev) > > return -ENOMEM; > > > > + syn_data.data = &ev->cpus.cpus; > > ev->header.type = PERF_RECORD_EVENT_UPDATE; > > - ev->header.size = (u16)size; > > + ev->header.size = (u16)syn_data.size; > > ev->type = PERF_EVENT_UPDATE__CPUS; > > ev->id = evsel->core.id[0]; > > - > > - cpu_map_data__synthesize(&ev->cpus.cpus, evsel->core.own_cpus, type, max); > > + cpu_map_data__synthesize(&syn_data); > > > > err = process(tool, (union perf_event *)ev, NULL, NULL); > > free(ev); > > -- > > 2.36.1.476.g0c4daa206d-goog > >