Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1363445ybl; Wed, 4 Dec 2019 23:33:37 -0800 (PST) X-Google-Smtp-Source: APXvYqz4ldy/vhzv1ZyNjoXoNjEAm+SUFE6khwsuydJw/0wN3+2+xlxjsFL2lUCb6LCOltD1OrGm X-Received: by 2002:a05:6808:8ec:: with SMTP id d12mr305313oic.131.1575531217529; Wed, 04 Dec 2019 23:33:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575531217; cv=none; d=google.com; s=arc-20160816; b=cfgrSyi/GRNXcCcjzjjoNMEBGo0pwsLLgG+ybzJ9l+/UoVjEEf3vDM3ZmlALY/ltWs pC7mFZQQGBzX+Q/YCBEi7O619jAXUnvzgV5Yio8S22Yfcwy/Dpemfgp/tCn4gvnrfcO4 EL1QQMqyCy944FqgvirqhUpwfE37urm35f5P4pTeFKSmbuQHXIMaYhiuRzxZkWHwlvO0 lLvB431FqxDCtnjMbf4BrS5LeCIc3yGrMVKfG5sL5VbA40kR70yjnB947T+OXqAg81KO vW+IWp5ZT/Mhv/7dOx8XdFRVej3rGKn27AQ6KFu7yEZrLGMIQJvZeqo88srb7ZP0rw9T 6FDQ== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject; bh=SxD43Hl/MQQ3eNQP/6o9gtQAicVzgzCU/a9XOPFB+6o=; b=TvkHX5b+HNnDkJFc7gwBTiFUCMVDvex2mE9SX7JEmP6vy6rLQrBkbqao1xkN16e/dx g3WvUbl3zQ8zZ54gqGRUNNfmRxx2Tc4q7/33HW1yoEGtwxHUyCJAi6YyNZ/Xvxj49l+c kn1+4vP/8nbFo+p9gujyutlTwpl9Qls2cJhS9OR30zNqX3+oAVEjeRwQfTieDzo4/9kO XAYQN2MNF7T85FCeGZb10E/UkQmtTEptyUzx/pcGfQA36aqEGG/buSA7ky+IBeEv3PS6 BG6/2vA64G4hME9NroSvHIDvOfYhsissYuRorTeTfv0fgx7OitF6GPgFDywiExf9mSA4 s1VQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q6si4497967oti.173.2019.12.04.23.33.24; Wed, 04 Dec 2019 23:33: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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728213AbfLEHbW (ORCPT + 99 others); Thu, 5 Dec 2019 02:31:22 -0500 Received: from mga12.intel.com ([192.55.52.136]:25418 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726384AbfLEHbW (ORCPT ); Thu, 5 Dec 2019 02:31:22 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Dec 2019 23:31:21 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,280,1571727600"; d="scan'208";a="411546745" Received: from linux.intel.com ([10.54.29.200]) by fmsmga005.fm.intel.com with ESMTP; 04 Dec 2019 23:31:21 -0800 Received: from [10.252.11.4] (abudanko-mobl.ccr.corp.intel.com [10.252.11.4]) by linux.intel.com (Postfix) with ESMTP id 7BAD9580261; Wed, 4 Dec 2019 23:31:18 -0800 (PST) Subject: Re: [PATCH v5 2/3] perf mmap: declare type for cpu mask of arbitrary length To: Arnaldo Carvalho de Melo , Jiri Olsa Cc: Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Ingo Molnar , Andi Kleen , linux-kernel References: <0fd2454f-477f-d15a-f4ee-79bcbd2585ff@linux.intel.com> <20191204134911.GB31283@kernel.org> From: Alexey Budankov Organization: Intel Corp. Message-ID: <9d31e13e-92b5-7e95-e4c8-cf6abab99502@linux.intel.com> Date: Thu, 5 Dec 2019 10:31:17 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 MIME-Version: 1.0 In-Reply-To: <20191204134911.GB31283@kernel.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04.12.2019 16:49, Arnaldo Carvalho de Melo wrote: > 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. Thanks Arnaldo, Jiri! Appreciate you collaboration and help. ~Alexey > > - Arnaldo >