Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp466593ybl; Wed, 4 Dec 2019 05:50:16 -0800 (PST) X-Google-Smtp-Source: APXvYqxhTasvZ8vuTgB92PzD3CpXycImGrqOJHvsrJKMqlAAvKEVdiCq6u0pYhwgOPu9f9dE4U+X X-Received: by 2002:a05:6808:117:: with SMTP id b23mr2437899oie.151.1575467416167; Wed, 04 Dec 2019 05:50:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575467416; cv=none; d=google.com; s=arc-20160816; b=zdhec+8W/jRwN/XsNrQLSEdwRJ6fOId+qw7FTS1J4Zv5TBX1nsS7ETNZifCEpILVMU Wg0b1OeSVbM86HLCHm4w0aWFBWItiPS/+Aj4UFhbZh3OzJtX7Pql/gwyyoBY33RnfceE Y5j3bH5+BUuTsb10P6i22DJAEhfTPliczyP0Qfl7+sdIL6npKlUh3GSLQyvZmUHxKW6j a1trYpkaw96qKq4p2fv3F8V0nzlefx9IIDbivsbowIGECLvtX7BeBNirnf5WKBE4v8Bn FPcw3Yruw1st2GLpHXxP3Yi3yMBDU2b7Rx56IOuIS4HJQzslwpYm+bwEYQboOErg12d1 b/zQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:date:from :dkim-signature; bh=/0qggl8Qfx1sGOKIUuMhcgVnjQ03MmdH56rEv45DUUE=; b=wLrIHlJ94a+rBxQTxr3fLAHmBjw2JD28JHFWaNsC94VDv6yjXfLExVQX5yrqQqqwp+ yDeWv2UCadPNsGK4pnqXs0Tsa7fRuieU84St56aGWlg8dPfGBO99McHwURU8wwDwFPuI XoredFOlCt/9XDXKuvtcNQaJjv7F6myX4v0FXksNISP48uYglbbtX33GlBFGLj62hdhq 0hmSEvGRn9v7AM4ViAsZ2fOLt1Q6v+yJ5wRmcVZcS+F5c/PoG6Ue7XHI8Fk/4qr+hwvH Ev7tzPSo1XIGQf3Q/vdxvIt56yvBWgYZdHwSVJrfXH3KEF2A7odDGk8TV475DzqXAGDK 4Kzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="fFe7mD/u"; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x9si3094924otk.170.2019.12.04.05.50.03; Wed, 04 Dec 2019 05:50:16 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b="fFe7mD/u"; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728009AbfLDNtP (ORCPT + 99 others); Wed, 4 Dec 2019 08:49:15 -0500 Received: from mail-qk1-f196.google.com ([209.85.222.196]:46651 "EHLO mail-qk1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727880AbfLDNtP (ORCPT ); Wed, 4 Dec 2019 08:49:15 -0500 Received: by mail-qk1-f196.google.com with SMTP id f5so7103935qkm.13 for ; Wed, 04 Dec 2019 05:49:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=/0qggl8Qfx1sGOKIUuMhcgVnjQ03MmdH56rEv45DUUE=; b=fFe7mD/us4cmdd4Er5X1vBQPwjlVgHncxM5CfRBl3XdEFCTxMcngltDvL3rWCeanDR SduuujY+88DaboY+qc8rv9xbN/13Mw3anhWGcYSNspba4H3zpU08gGanRcl2Xs2HbIMr SgdeA/fHJLXN5cAgnyacOu5xLeHUaSw2MgD6VxAxRz35fAGvpgBIOS0TSSZCHlL0WqCX 96JbN9FqNzK3H5tcLI2u2tkOi/EGeLyJoJWGEglOlvQJ99/9cFaDzwe9OTFMcOmlyy68 4bgdxUhsbFNH0gjCOAJTUCFxwraq5t3Esn6l5QZ7luRyC5LWrDxoTjyRiRslT1ZcqpjE wNeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=/0qggl8Qfx1sGOKIUuMhcgVnjQ03MmdH56rEv45DUUE=; b=q8ZzshmlAq22LC1Ul4ADC10PXIj67PQdsAbmNUyieoGzzjLjui6JdVnuVjsn4j11Uy Fw2A1xj/Te7Q4v6xiTa97MVcApC+MG6Xdldy+ObkWjmhQeraOiqGFC3AM/tULAQBTWHH PH5JXgxPlvW0g4MbGF/V3yAb9loQ93+xIH8RQiDACu2WmjCcTGq8vP6sOF9aRozG9HW0 83h4KlPs8S2WTD3oIVwALCS77A1YggFWUV1GuswHLver2yd/cS20lD7tOJQGI8e9RKGM sSkCXgEqHHTkgHdIvp6lWT77RibdH5fbJS1KuCb0weDvhVxm20RF9jlGMS/3hnx07sS6 NzGg== X-Gm-Message-State: APjAAAVqbC1Y6UKaROkvSm62AHB8E6MsEHXV3sGJZ6B5Eb1sJfeYAaeS +ET82Wja3N5+k6FB2uT0hrE= X-Received: by 2002:a37:b602:: with SMTP id g2mr3026172qkf.174.1575467354488; Wed, 04 Dec 2019 05:49:14 -0800 (PST) Received: from quaco.ghostprotocols.net ([179.97.35.50]) by smtp.gmail.com with ESMTPSA id s27sm2245490qkm.97.2019.12.04.05.49.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Dec 2019 05:49:13 -0800 (PST) From: Arnaldo Carvalho de Melo X-Google-Original-From: Arnaldo Carvalho de Melo Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 3FDF74121E; Wed, 4 Dec 2019 10:49:11 -0300 (-03) Date: Wed, 4 Dec 2019 10:49:11 -0300 To: Alexey Budankov Cc: Jiri Olsa , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Ingo Molnar , Andi Kleen , linux-kernel Subject: Re: [PATCH v5 2/3] perf mmap: declare type for cpu mask of arbitrary length Message-ID: <20191204134911.GB31283@kernel.org> References: <0fd2454f-477f-d15a-f4ee-79bcbd2585ff@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0fd2454f-477f-d15a-f4ee-79bcbd2585ff@linux.intel.com> X-Url: http://acmel.wordpress.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Tue, Dec 03, 2019 at 02:44:18PM +0300, Alexey Budankov escreveu: > > Declare a dedicated struct map_cpu_mask type for cpu masks of > arbitrary length. 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. mmap_cpu_mask__scnprintf() > function can be used to log text representation of the mask. > > Signed-off-by: Alexey Budankov > --- > 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 063d1b93c53d..43c12b4a3e17 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[%ld]: %s\n", mask, tag, mask->nbits, buf); > +} Above should also be %zd, fixed. - Arnaldo