Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp1404804imn; Sun, 31 Jul 2022 05:54:10 -0700 (PDT) X-Google-Smtp-Source: AA6agR5QkqtUo9m0cWc6O2LiyDDrC6zOT0wVV7k9b2owC3VIRoLOq2cXp46qL7ON9r4f2nOvNbFe X-Received: by 2002:a63:693:0:b0:41b:aa71:7a56 with SMTP id 141-20020a630693000000b0041baa717a56mr7155159pgg.427.1659272049880; Sun, 31 Jul 2022 05:54:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659272049; cv=none; d=google.com; s=arc-20160816; b=SlpUhe4z5BrLc95patz17GzTH9CE4LRbi/fNTdECdrObPByaxPdAotwvAwvasHa6+P dHZJt4TWiJJsiJQbjiFBfGY56hDH6WDIcXBgzza9C9cLygg+zIiQONdAu6TjmkbbfyXO KybIgqfy4ufpZJEjykg5mKIwmTc7ihkUDI4EFNDn9bTncYuIRUjDmHh2A5L8NMDsa9u0 jBgb97l1okRsFXBJ12qaWX5qLvdi3oFpPsom0C2G75L63JaRE8wWb45SLPtI7sYV81OU lcEoE6lFP5LnVy0dCLsw/GD2+AOQcmPpqtKdgJkgoSu/6XuThEvMl21M9jlXwtXR4y8a HFEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:date:from:dkim-signature; bh=j65sAOKYqI+Uxv1jBk/p69AEquNqVjyqeGyH/PlKGl8=; b=o+vv9N761u+7hOriISKtssnzrE+HEP70GXwM2cPXClLoWVH5VrPV8BbIgEy/BeG13q U/pBAP6X2/rVKPJyFWZD6cSPa4ePt+ltE5Ctw4AJ0cd3Iatc3/kpsbiyaXqyadu1lSEr vswZBD0yWBCA1VPNmDJV5MmUsgGbFZ2JNVAhv0CdtHX3OtpVhNf45eBu521kPPg25Xg+ eyICVo9Ld9LdLlPgsIbDm1tJDavoJvmvrzH1VBLcxL38vZ0BPQ8FUpC5FeUtMNOKMnOw gWgZcV2Xk4Mqkz8JBGG59jGOtEe8XY3rn9Ot+fDxEsTEtygjY68RgJLmXvTBGS/8F3tR NjXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=QT7G8U6c; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y18-20020a170902ed5200b0016cae200f99si9174197plb.330.2022.07.31.05.53.54; Sun, 31 Jul 2022 05:54:09 -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=@gmail.com header.s=20210112 header.b=QT7G8U6c; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236976AbiGaMjm (ORCPT + 99 others); Sun, 31 Jul 2022 08:39:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232268AbiGaMjk (ORCPT ); Sun, 31 Jul 2022 08:39:40 -0400 Received: from mail-ed1-x52c.google.com (mail-ed1-x52c.google.com [IPv6:2a00:1450:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 944F4DF8A; Sun, 31 Jul 2022 05:39:39 -0700 (PDT) Received: by mail-ed1-x52c.google.com with SMTP id i13so10609201edj.11; Sun, 31 Jul 2022 05:39:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:date:from:from:to:cc; bh=j65sAOKYqI+Uxv1jBk/p69AEquNqVjyqeGyH/PlKGl8=; b=QT7G8U6c2KAKqExmH16DbFOxqVACF96FT1etnfZAfBZRoPQqRi2oCom07LVhIxYtuT Wv6i4E4sEjG32iqikZ5yEi/A8tKid6IETe7/q8y1Owd4pTGtWGc7ESXBJETppN3xESpc 2GPpeyHCGGMRvgppDMP+dKJ+aYc9nf4Z9uDNTg5ARUtrGs2cCC5SbeliplKXAFBDirkM dESBNN18pyTMWZKNSTqJq8I4Abz95cgxfYJg1E1U4m8z6d8KjOkgxjh6imL7lsNioQ8U ZMiL08M/0HlzNmAJmDbXSICE6QV+eUVZCQjD28EM+cY0qYM6+nUfzzCWzzrJKdc95H6E cm+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:date:from:x-gm-message-state:from:to:cc; bh=j65sAOKYqI+Uxv1jBk/p69AEquNqVjyqeGyH/PlKGl8=; b=eklihG/jdlRygjR6cT4mUIXpvD5bcmZNb0kzloC/2n4rnVRgzIzE2YsZ9hCID+eZEi YRetrDok8zT97vFnjZlm9Xp5Yg9gjw9weNwVe/koDGvt2o/WP/0VUYvRFKjEl0seNjlg 1c7zphQstuogKsIyoDT8dQBjKCrc7d/QrffTrzGXXyO9eQDjvII5JR1ul2ucHKpOlVqC oXsVZuOY0n4g/5bW2hbAh3NMGPyatwBCQXCYpy3jhebCB08K8dcyu94LJ5BH1FRyk67n bM2HZUGbazZo5VzxYPRHga8tLKHyo2PyRTF4XXbS37fzt2Msvz0SJmn077rhL2c3Jwuu 1JIQ== X-Gm-Message-State: AJIora+i+9MkNij18Jnb5kFpfywyW+yiZlcrOCE1oEc3LkC8FJziEyL3 O993DixvIq4ezpxQ+zMicp4= X-Received: by 2002:a05:6402:294c:b0:43a:91a9:a691 with SMTP id ed12-20020a056402294c00b0043a91a9a691mr11513929edb.182.1659271178098; Sun, 31 Jul 2022 05:39:38 -0700 (PDT) Received: from krava ([83.240.61.175]) by smtp.gmail.com with ESMTPSA id u10-20020a17090626ca00b007262b7afa05sm3993497ejc.213.2022.07.31.05.39.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 Jul 2022 05:39:37 -0700 (PDT) From: Jiri Olsa X-Google-Original-From: Jiri Olsa Date: Sun, 31 Jul 2022 14:39:36 +0200 To: Ian Rogers 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 Message-ID: References: <20220614143353.1559597-1-irogers@google.com> <20220614143353.1559597-7-irogers@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220614143353.1559597-7-irogers@google.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 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 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 >