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 83EE0C433F5 for ; Mon, 10 Jan 2022 05:45:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238833AbiAJFpg (ORCPT ); Mon, 10 Jan 2022 00:45:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233436AbiAJFpd (ORCPT ); Mon, 10 Jan 2022 00:45:33 -0500 Received: from mail-il1-x12a.google.com (mail-il1-x12a.google.com [IPv6:2607:f8b0:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6756EC06173F for ; Sun, 9 Jan 2022 21:45:33 -0800 (PST) Received: by mail-il1-x12a.google.com with SMTP id c4so10381464iln.7 for ; Sun, 09 Jan 2022 21:45:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=I2Rp9THzxzMq/ttRbcNPqtEt7HusqSb4QCZKzlGP+9A=; b=juiqSHTVJOaVRhq5m+ZrXvTTrRVYb0CHU0nTSgQ5EbBBT6MbUr4A4GuiOClsTB/gdQ t34ORL1fAqvpdOtpu9hdVHt5yRe8CL0QMc/SFFsE2WrOtSRobmC2J0uS+w/+EJP4ySoU D7q84Pbg8+Ehz6bPkf5vsRmN6j9mys6WAR8oDkxPkN1u6Q15e0hWQsnld0wus+p/hqlo Jf5jSTlEyS6kVAY37Pa9zi8xDocpNnjuR+F1IVvqvhVE2pwFA8Xo3vXQvv2vXMNqEmuv K0b+L5hwH7MUOJre3i47A81eMI6K61WfeclIM8FYc824gFN3ez3zrBVu8ZIr4YBAySTw iOeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=I2Rp9THzxzMq/ttRbcNPqtEt7HusqSb4QCZKzlGP+9A=; b=iuc5iXjpF7nKpbbTTcaquilHgdr3ovRc24lW7ugl9RR+ZnaQv9H+2P8IWLOrLLFesa NIdzOHdF4aDERYusu+XF8BrC26lBgQD63mss3xMQYBRjb7Qi6WKRW9H/l1kc4cZAgrPF wjc240Tmcdvve8Nu7CiK4JiCUFU3EmagDvWZvn4kPdFfaIZN464bT4E6RCJvsdBszQ9m alhNysqTVIOY9V+mo1IrHuHlJZGf39gpUnRsMHf1PzOY61uvncupgLRao0MO8wDGL9sG Wo8bnzbBynVc7/eLsGePQ3D736YOJuA4oL3jOBSJbgCm/LAyUbCDkPdGpQpHnzNNG5wd BnwQ== X-Gm-Message-State: AOAM533j0OIb7ObSPJz6sjxh02f7KvofuMnfTnsoK0PAd/cfolHKrDbi xvfbO3wGLkhMKjU0fWXaG9cWYOrlGyAz+1r3w6n1Ww== X-Google-Smtp-Source: ABdhPJxyWGUAtz2QGisVN7rf6M/TgAXD97oRuJ2SmHNnR7fpvWKGhupRiQN2k/CqPMiyRGdiVhxTK3dqHhAXr2Cyq74= X-Received: by 2002:a92:da07:: with SMTP id z7mr5541162ilm.2.1641793532644; Sun, 09 Jan 2022 21:45:32 -0800 (PST) MIME-Version: 1.0 References: <20220105061351.120843-1-irogers@google.com> <20220105061351.120843-49-irogers@google.com> In-Reply-To: From: Ian Rogers Date: Sun, 9 Jan 2022 21:45:19 -0800 Message-ID: Subject: Re: [PATCH v4 48/48] perf cpumap: Give CPUs their own type. To: Jiri Olsa Cc: Andi Kleen , Namhyung Kim , John Garry , Kajol Jain , "Paul A . Clarke" , Arnaldo Carvalho de Melo , Riccardo Mancini , Kan Liang , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, Vineet Singh , James Clark , Mathieu Poirier , Suzuki K Poulose , Mike Leach , Leo Yan , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, zhengjun.xing@intel.com, eranian@google.com Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jan 9, 2022 at 10:30 AM Jiri Olsa wrote: > > On Tue, Jan 04, 2022 at 10:13:51PM -0800, Ian Rogers wrote: > > A common problem is confusing CPU map indices with the CPU, by wrapping > > the CPU with a struct then this is avoided. This approach is similar to > > atomic_t. > > > > Suggested-by: John Garry > > Signed-off-by: Ian Rogers > > SNIP > > > tools/perf/util/stat.h | 2 +- > > tools/perf/util/svghelper.c | 6 +- > > tools/perf/util/synthetic-events.c | 12 +- > > tools/perf/util/synthetic-events.h | 3 +- > > tools/perf/util/util.h | 5 +- > > 59 files changed, 408 insertions(+), 347 deletions(-) > > that's massive ;-) did it find any mis-use of the index/value? It did. The fixes precede this patch so that we can have the fixes without the large rename. > how about the same for threads? Agreed, but the patch set was already big enough. > > diff --git a/tools/lib/perf/include/internal/cpumap.h b/tools/lib/perf/include/internal/cpumap.h > > index 71a31ed738c9..581f9ffb4237 100644 > > --- a/tools/lib/perf/include/internal/cpumap.h > > +++ b/tools/lib/perf/include/internal/cpumap.h > > @@ -4,6 +4,11 @@ > > > > #include > > > > +/** A wrapper around a CPU to avoid confusion with the perf_cpu_map's map's indices. */ > > +struct perf_cpu { > > + int cpu; > > +}; > > should we use 'int val' or 'int v' instead, so we don't have cpu.cpu ? I can rename it if you have a preference. Thanks, Ian > jirka > > SNIP > 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7B49AC433F5 for ; Mon, 10 Jan 2022 05:46:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=m+/sq6D4afpPvGmzDgtU7sjphKDNC1BmzZb9PwCs4QQ=; b=lzr0p905Ztabyi KBEV/usNoyMaiCRH/EvyWxAC2oTPJ07DdRiUxJExZSbKwDMXYXzivx6iktK5zkydRw3ysj4eolcLL J/f4/L9ziIY2wDgGK3JBOyd2q7+JI5s5/pMVO084MEvMtdw3e2TZh2f1VGtrioW5UYKlfSFRv5U5x N4GFHxLmm4ptTtqYWIT2bqqHu0gvJ/mnTgfyGihRFotj6T6hpGezAqx+88oKj8hVqApXaxlgBDrbQ +Czm4y2Zb//ImDj0YbBmDDqIl+XrlwwCy08Yqrm2o8vaK7mMnpySz45GQAjL6tDiTR7wXCNQ7qGzf UGazAsmMbKp9+jk4WMbQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n6nV1-009Mit-KO; Mon, 10 Jan 2022 05:45:43 +0000 Received: from mail-il1-x12d.google.com ([2607:f8b0:4864:20::12d]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n6nUx-009Mg4-MG for linux-arm-kernel@lists.infradead.org; Mon, 10 Jan 2022 05:45:40 +0000 Received: by mail-il1-x12d.google.com with SMTP id o20so3938999ill.0 for ; Sun, 09 Jan 2022 21:45:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=I2Rp9THzxzMq/ttRbcNPqtEt7HusqSb4QCZKzlGP+9A=; b=juiqSHTVJOaVRhq5m+ZrXvTTrRVYb0CHU0nTSgQ5EbBBT6MbUr4A4GuiOClsTB/gdQ t34ORL1fAqvpdOtpu9hdVHt5yRe8CL0QMc/SFFsE2WrOtSRobmC2J0uS+w/+EJP4ySoU D7q84Pbg8+Ehz6bPkf5vsRmN6j9mys6WAR8oDkxPkN1u6Q15e0hWQsnld0wus+p/hqlo Jf5jSTlEyS6kVAY37Pa9zi8xDocpNnjuR+F1IVvqvhVE2pwFA8Xo3vXQvv2vXMNqEmuv K0b+L5hwH7MUOJre3i47A81eMI6K61WfeclIM8FYc824gFN3ez3zrBVu8ZIr4YBAySTw iOeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=I2Rp9THzxzMq/ttRbcNPqtEt7HusqSb4QCZKzlGP+9A=; b=cGrtJpi+xRkKcNk5gGcnjHUVpNU2D1SjYCZ2jpgr49ZlRZWvW++aF9NR8t5SCCh0vb 60WQ4mXQXfyDeFMcy4DQeU8lyn5pY9HWTo3MxNLo7ymAaySTXJdKPHjUy8deTjC3Xs19 JNCiReGTdwUA8RFkD97cYPRNJg5/kAOTX1pBrs7MwwUQ/r2XiSNC/687bLOlZzU9Z54u xGtHYU9oV1e0cAuYY/PJb0Qw1gV9HfsyeoE4KcarUqW/5AlPbMQiaQrOkS8WnZT6tcte O7Z0CPjx9/dsHhv3SbSlSkD3GtccTDlD3YWD2wbR6XbfUVU6Lfqlbq64eEKPTnwhC6Ic s9Kg== X-Gm-Message-State: AOAM532H0WxG74OESca0NOZslhcN+Aac2OCvhhGo/oFDCncJxA/cu+cq ugOAhvLxFbMU5g3eff42QFb8RqQV/yRwb4TeIDE0ig== X-Google-Smtp-Source: ABdhPJxyWGUAtz2QGisVN7rf6M/TgAXD97oRuJ2SmHNnR7fpvWKGhupRiQN2k/CqPMiyRGdiVhxTK3dqHhAXr2Cyq74= X-Received: by 2002:a92:da07:: with SMTP id z7mr5541162ilm.2.1641793532644; Sun, 09 Jan 2022 21:45:32 -0800 (PST) MIME-Version: 1.0 References: <20220105061351.120843-1-irogers@google.com> <20220105061351.120843-49-irogers@google.com> In-Reply-To: From: Ian Rogers Date: Sun, 9 Jan 2022 21:45:19 -0800 Message-ID: Subject: Re: [PATCH v4 48/48] perf cpumap: Give CPUs their own type. To: Jiri Olsa Cc: Andi Kleen , Namhyung Kim , John Garry , Kajol Jain , "Paul A . Clarke" , Arnaldo Carvalho de Melo , Riccardo Mancini , Kan Liang , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, Vineet Singh , James Clark , Mathieu Poirier , Suzuki K Poulose , Mike Leach , Leo Yan , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, zhengjun.xing@intel.com, eranian@google.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220109_214539_757331_220A6284 X-CRM114-Status: GOOD ( 21.13 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Sun, Jan 9, 2022 at 10:30 AM Jiri Olsa wrote: > > On Tue, Jan 04, 2022 at 10:13:51PM -0800, Ian Rogers wrote: > > A common problem is confusing CPU map indices with the CPU, by wrapping > > the CPU with a struct then this is avoided. This approach is similar to > > atomic_t. > > > > Suggested-by: John Garry > > Signed-off-by: Ian Rogers > > SNIP > > > tools/perf/util/stat.h | 2 +- > > tools/perf/util/svghelper.c | 6 +- > > tools/perf/util/synthetic-events.c | 12 +- > > tools/perf/util/synthetic-events.h | 3 +- > > tools/perf/util/util.h | 5 +- > > 59 files changed, 408 insertions(+), 347 deletions(-) > > that's massive ;-) did it find any mis-use of the index/value? It did. The fixes precede this patch so that we can have the fixes without the large rename. > how about the same for threads? Agreed, but the patch set was already big enough. > > diff --git a/tools/lib/perf/include/internal/cpumap.h b/tools/lib/perf/include/internal/cpumap.h > > index 71a31ed738c9..581f9ffb4237 100644 > > --- a/tools/lib/perf/include/internal/cpumap.h > > +++ b/tools/lib/perf/include/internal/cpumap.h > > @@ -4,6 +4,11 @@ > > > > #include > > > > +/** A wrapper around a CPU to avoid confusion with the perf_cpu_map's map's indices. */ > > +struct perf_cpu { > > + int cpu; > > +}; > > should we use 'int val' or 'int v' instead, so we don't have cpu.cpu ? I can rename it if you have a preference. Thanks, Ian > jirka > > SNIP > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel