Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp979040ybl; Fri, 10 Jan 2020 09:55:37 -0800 (PST) X-Google-Smtp-Source: APXvYqwc2x+sxqzvznZjYBzCS0FAqTKWf0F0IPB2jN2wY4cnOm+lvGRopZuOOOz/+O2Xb8E/wMlh X-Received: by 2002:aca:f555:: with SMTP id t82mr3282436oih.103.1578678937686; Fri, 10 Jan 2020 09:55:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578678937; cv=none; d=google.com; s=arc-20160816; b=LoQIM6M5GiJVqm9WZ5/6S+UDtEGAMsMNaUkzbg/nEGHO+qwtKKCi9rozZUqdS2kbY1 tvxyopB1OFSDweiS9kWlkG8NIicRgjbNd1NPpxzkvburLjCZFEjjUtZB7rt6sAVvEN6m mdAViM1cSHKhWibu2vvA5PUQxDDxuvfQDpet/K9ll6H/fK9O0F/PRP+rRk7rfwafo0MJ 7vDSSMwvlajZV3on8rn1x51qgjmk2rhLP54hobn8DLqS9k0+dqKBQ/oc5XKgA2a6g52g dKOQOrqPk82h+f+nLyISujXixdux2pOklCBNUZ9+8x8v0yKLMX89FmWK8TDNkuJ41Wtd 2/EA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :robot-unsubscribe:robot-id:message-id:mime-version:references :in-reply-to:cc:subject:to:reply-to:from:date; bh=iJfiH9PRv9/mfA8xRggOHbV3Rulkdjb0Bjzv2PfSIFc=; b=dS3x+W6ucbzDOBCtYzhce2Q123lsjD49BAe0dPZMdDyDKG/xixK8lJpPRRtL3l58ZA bshQkGm93cRnuha/Gk1ISBhWrCyOm0vHggqEMmvOy7tgDek1mKgE5qhAnAkxPC8Kf6xD V3NwXpMWwT1UqzOnCX9lkvjDXTff4RcnNfyBZeIvODwl/CaTQy9hYlxBzMnZxrZBbsfX PJRN3PZ6BsT2h6QNV0r84mrlCt5TPPAV2+sSbt+7E8EwjUB6IxIRf4OCKj1o1QF6S6+n Wd1jvDk7tWM9YmMRseV31Jq7OqmIYo0AcXa1MYpZn6Q/8ZuwQKGkBD7+nGnq9sij1u0w VqJg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k7si1425681oib.115.2020.01.10.09.55.25; Fri, 10 Jan 2020 09:55:37 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728978AbgAJRyG (ORCPT + 99 others); Fri, 10 Jan 2020 12:54:06 -0500 Received: from Galois.linutronix.de ([193.142.43.55]:59201 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728771AbgAJRxb (ORCPT ); Fri, 10 Jan 2020 12:53:31 -0500 Received: from [5.158.153.53] (helo=tip-bot2.lab.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1ipyTL-0001mo-4Q; Fri, 10 Jan 2020 18:53:23 +0100 Received: from [127.0.1.1] (localhost [IPv6:::1]) by tip-bot2.lab.linutronix.de (Postfix) with ESMTP id 5AC9D1C2D5A; Fri, 10 Jan 2020 18:53:18 +0100 (CET) Date: Fri, 10 Jan 2020 17:53:18 -0000 From: "tip-bot2 for Alexey Budankov" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: perf/core] perf mmap: Declare type for cpu mask of arbitrary length Cc: Alexey Budankov , Jiri Olsa , Alexander Shishkin , Andi Kleen , Namhyung Kim , Peter Zijlstra , Arnaldo Carvalho de Melo , x86 , LKML In-Reply-To: <0fd2454f-477f-d15a-f4ee-79bcbd2585ff@linux.intel.com> References: <0fd2454f-477f-d15a-f4ee-79bcbd2585ff@linux.intel.com> MIME-Version: 1.0 Message-ID: <157867879823.30329.8276302610164757060.tip-bot2@tip-bot2> X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the perf/core branch of tip: Commit-ID: 9c080c0279a80057cad3dfc05d09fb283ddf72f4 Gitweb: https://git.kernel.org/tip/9c080c0279a80057cad3dfc05d09fb283ddf72f4 Author: Alexey Budankov AuthorDate: Tue, 03 Dec 2019 14:44:18 +03:00 Committer: Arnaldo Carvalho de Melo CommitterDate: Mon, 06 Jan 2020 11:46:09 -03:00 perf mmap: Declare type for cpu mask of arbitrary length Declare a dedicated struct map_cpu_mask type for cpu masks of arbitrary length. The mask is available thru bits pointer and the mask length is kept in nbits field. MMAP_CPU_MASK_BYTES() macro returns mask storage size in bytes. The mmap_cpu_mask__scnprintf() function can be used to log text representation of the mask. Committer notes: To print the 'nbits' struct member we must use %zd, since it is a size_t, this fixes the build in some toolchains/arches. Signed-off-by: Alexey Budankov Acked-by: Jiri Olsa Cc: Alexander Shishkin Cc: Andi Kleen Cc: Namhyung Kim Cc: Peter Zijlstra Link: http://lore.kernel.org/lkml/0fd2454f-477f-d15a-f4ee-79bcbd2585ff@linux.intel.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/mmap.c | 12 ++++++++++++ tools/perf/util/mmap.h | 11 +++++++++++ 2 files changed, 23 insertions(+) diff --git a/tools/perf/util/mmap.c b/tools/perf/util/mmap.c index 063d1b9..2ee4faa 100644 --- a/tools/perf/util/mmap.c +++ b/tools/perf/util/mmap.c @@ -23,6 +23,18 @@ #include "mmap.h" #include "../perf.h" #include /* page_size */ +#include + +#define MASK_SIZE 1023 +void mmap_cpu_mask__scnprintf(struct mmap_cpu_mask *mask, const char *tag) +{ + char buf[MASK_SIZE + 1]; + size_t len; + + len = bitmap_scnprintf(mask->bits, mask->nbits, buf, MASK_SIZE); + buf[len] = '\0'; + pr_debug("%p: %s mask[%zd]: %s\n", mask, tag, mask->nbits, buf); +} size_t mmap__mmap_len(struct mmap *map) { diff --git a/tools/perf/util/mmap.h b/tools/perf/util/mmap.h index bee4e83..ef51667 100644 --- a/tools/perf/util/mmap.h +++ b/tools/perf/util/mmap.h @@ -15,6 +15,15 @@ #include "event.h" struct aiocb; + +struct mmap_cpu_mask { + unsigned long *bits; + size_t nbits; +}; + +#define MMAP_CPU_MASK_BYTES(m) \ + (BITS_TO_LONGS(((struct mmap_cpu_mask *)m)->nbits) * sizeof(unsigned long)) + /** * struct mmap - perf's ring buffer mmap details * @@ -52,4 +61,6 @@ int perf_mmap__push(struct mmap *md, void *to, size_t mmap__mmap_len(struct mmap *map); +void mmap_cpu_mask__scnprintf(struct mmap_cpu_mask *mask, const char *tag); + #endif /*__PERF_MMAP_H */