From patchwork Thu Dec 23 07:44:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 12697978 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 40273C433EF for ; Thu, 23 Dec 2021 07:48:04 +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:From:Subject:References: Mime-Version:Message-Id:In-Reply-To:Date:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=3d98wb9iC4ys8Q9OnYKaQhEjMCZAjroSYt8rCZXAMK8=; b=n2/ZNw9yLVf/rm8v5Tyn311qxb ZBVp4M+KdLiIP8gByfkYAmU7Tf9XbvFi6yl01uGvQKj8DwXSmizsc15nOjbxYVso7eRKOWjPVyxhO MKiTAQGN/kKjkz+cJbI4+nTdXuYwkFqcDHKpE8szoFSJxDF3PMzqcKa2T3Ax1q4DPGujwA/mwrpoX OZbjkmSUBznkeDppdxXqlEi1XjsuKICH7iWiYs43vNb0wtbJ5HKX1Un3BRpsJYgyTgN83j70paTpb fsksJDprwxDqADHGA0lHfRQUScQdXsrjHko70oSMdhSsqsztXAb4LlQmaz4Tii6UAL5kWAcLOInx2 24QQKlfg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n0Inx-00BzSC-7G; Thu, 23 Dec 2021 07:46:25 +0000 Received: from mail-yb1-xb4a.google.com ([2607:f8b0:4864:20::b4a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n0Ink-00BzMN-5c for linux-arm-kernel@lists.infradead.org; Thu, 23 Dec 2021 07:46:13 +0000 Received: by mail-yb1-xb4a.google.com with SMTP id b15-20020a25ae8f000000b005c20f367790so8721579ybj.2 for ; Wed, 22 Dec 2021 23:46:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=88O+wwMIUMjGSp8vBh5a99/6nPbt91KU3ZoFuApgaYM=; b=kkIK6Jg8+WpZYmng3joQ3qp7DcIRoNBjVuzHPir6XhEiQ2dPDMf24HdOEIFj3H32O9 iAV59G2dqE3olG8dUf/LvN+WWu5yfgmfxfZ8dbpDvAH7gRDurmrARUNNtzzHoYMTKDHK bvm6ebVeuPWxP3qt1IWSHXjt2CEDs3rvibkZprdo+h54jN0UFejfqm5XnZ+hkM1CkKv2 Aoktcu01x4wkJ/4Owe/c+dJR8ZrXFc6418v3JO03Rj7gytXcvJSbvaCIZoOPzWUI/gpf kRnd7H+McfkEgdyWEtX5i7mcPvrtbLMMXFDUopiv4D9nLN6qYz+mknTdUvJhu1Mh6yxE dorQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=88O+wwMIUMjGSp8vBh5a99/6nPbt91KU3ZoFuApgaYM=; b=wyXKxS57+rkCNor3In+i1fXy3bHEbe0O4e1ufFP4RpQVwuylt0TpV0qF7MG3XJAAUT km7v0l/UHNg3V66uOdBQ48UO0/PAD+tOUXwQpOGCMhJei0YSESCeD7RilAi9OMQhcM59 SJHbmWOuIzn77BSmDJs/ZnyiCT8rKj+O2k72Oieaa221nKbPWOh/hZmh6inewahC1WKl KLzuuFCwheiGxZux+4SjSGuIlSIOGuJQQ9oBKcIh9c9U6vRq8TS4yFUtmoSfgeDcHy9a c3/Wo1bjHb7YXuUV8LaNTKzQH4aeBmPXCrYv9pSsNrqtS+/difbg65x1JKsPehFSuJRx 9b7w== X-Gm-Message-State: AOAM531lkBVgN1ThfV2ho0LxtPBYTxoFr7JJ7JvSL3Gnw8qCwlPU9UsH Zg3bNqbwzuNV9tT6Ejpnv+pVnASepSKE X-Google-Smtp-Source: ABdhPJzjEgbayUhuRxq6Yf8H4X/kehgDmv/v3Teayg7xc+3ZCMqY4PFVtePthRhrD2JiHRScvPQB4dR3Qvxm X-Received: from irogers.svl.corp.google.com ([2620:15c:2cd:202:4fef:90ff:589d:24ca]) (user=irogers job=sendgmr) by 2002:a25:d984:: with SMTP id q126mr1810815ybg.392.1640245570595; Wed, 22 Dec 2021 23:46:10 -0800 (PST) Date: Wed, 22 Dec 2021 23:44:54 -0800 In-Reply-To: <20211223074541.3318938-1-irogers@google.com> Message-Id: <20211223074541.3318938-2-irogers@google.com> Mime-Version: 1.0 References: <20211223074541.3318938-1-irogers@google.com> X-Mailer: git-send-email 2.34.1.307.g9b7440fafd-goog Subject: [PATCH v2 01/48] libperf: Add comments to perf_cpu_map. From: Ian Rogers To: Andi Kleen , Jiri Olsa , 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 Cc: eranian@google.com, Ian Rogers X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211222_234612_236294_6F4B9050 X-CRM114-Status: GOOD ( 12.25 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org A particular observed problem is confusing the index with the CPU value, documentation should hopefully reduce this type of problem. Reviewed-by: James Clark Signed-off-by: Ian Rogers --- tools/lib/perf/include/internal/cpumap.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tools/lib/perf/include/internal/cpumap.h b/tools/lib/perf/include/internal/cpumap.h index 840d4032587b..4054169c12c5 100644 --- a/tools/lib/perf/include/internal/cpumap.h +++ b/tools/lib/perf/include/internal/cpumap.h @@ -4,9 +4,18 @@ #include +/** + * A sized, reference counted, sorted array of integers representing CPU + * numbers. This is commonly used to capture which CPUs a PMU is associated + * with. The indices into the cpumap are frequently used as they avoid having + * gaps if CPU numbers were used. For events associated with a pid, rather than + * a CPU, a single dummy map with an entry of -1 is used. + */ struct perf_cpu_map { refcount_t refcnt; + /** Length of the map array. */ int nr; + /** The CPU values. */ int map[]; };