Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5426252imu; Sun, 20 Jan 2019 10:34:29 -0800 (PST) X-Google-Smtp-Source: ALg8bN50zRJKJr7nPwuxKaCIH+PA6XtsiPCimrEinaExMmCJJAKM7mJ2dVriAE7OczQSn8ElpAP3 X-Received: by 2002:a63:4f5e:: with SMTP id p30mr25310603pgl.71.1548009269678; Sun, 20 Jan 2019 10:34:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548009269; cv=none; d=google.com; s=arc-20160816; b=oaDAYS+LLYUtdYnyk3uWvJcgrIYlQzLCI9d68LkPTY7nyeLZg6GzPJ3ZDwc9vmGzw4 KeJpqnD9Zg+8oWTBe5gc2pW6eW1rBQ7YXdOKgUaWoHmrMivf4I/QmlNQWO+o1jWwSYXg kgFNk//ZKELcFOAK+2kfp2xK0uvx2Wl9KRuaVB0TtMSRvjw9fEDMjBY2nz7KRw5AsdPr JLapvSSMvgvIge3A8rn5Waacj4/sAEGLWmP00l8DUfGIpROU09LrhiRUZ5/nYT4l/v0r N286+oLs8MPlmHWrbVFVP5BZ8KeihZKMlGxJxFhGjm94HCa6RPsTKbyCD43waTXu5fVu xTjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=dCEYbXiUyVfp+fyede4ZfXhCER/Af8oKrmOVoJesbPM=; b=ydt5bwOA1cVaA+12+V+IpnD4pXBXlDNNGv5ekiEvY7d2EKnRp1pSo8BXv+43dybXNQ YQApts6Tvd4d+eo/MjNJIAOQcC+a8oNrEuWKtEy7Us9pYZgxNe9xwjIgUWf7Kvizn2y2 SrvmGtAKfZ/oTV95fjWgNGy8Y+wy3oLQnp1ds87jImORGmeH99HYEcqonVy6HMvYe2iP PvQJoUaIH7298jnrc5qNC1+reAIAWmbkVRPjpPs+KT/s1FrF+v0eGPCNYL4bHhK7VOyj M5/MJ1OOJXfwnVtXJHZMFsifrQrjGl7/IAbORb5DqYgJI/2GV3lD0cxsvzfQYMlZPDxT zYkA== 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y7si10644386pgc.236.2019.01.20.10.34.14; Sun, 20 Jan 2019 10:34:29 -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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727622AbfATST3 (ORCPT + 99 others); Sun, 20 Jan 2019 13:19:29 -0500 Received: from mx1.redhat.com ([209.132.183.28]:39596 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726541AbfATST3 (ORCPT ); Sun, 20 Jan 2019 13:19:29 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 20B849E63F; Sun, 20 Jan 2019 18:19:29 +0000 (UTC) Received: from krava (ovpn-204-22.brq.redhat.com [10.40.204.22]) by smtp.corp.redhat.com (Postfix) with SMTP id 55B2360BE9; Sun, 20 Jan 2019 18:19:25 +0000 (UTC) Date: Sun, 20 Jan 2019 19:19:25 +0100 From: Jiri Olsa To: Stephane Eranian Cc: linux-kernel@vger.kernel.org, acme@redhat.com, peterz@infradead.org, mingo@elte.hu, ak@linux.intel.com, kan.liang@intel.com Subject: Re: [PATCH] perf tools: handle TOPOLOGY headers with no CPU Message-ID: <20190120181925.GC8591@krava> References: <1547885559-1657-1-git-send-email-eranian@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1547885559-1657-1-git-send-email-eranian@google.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Sun, 20 Jan 2019 18:19:29 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jan 19, 2019 at 12:12:39AM -0800, Stephane Eranian wrote: > This patch fixes an issue in cpumap.c when used with the > TOPOLOGY header. In some configurations, some NUMA nodes may > have no CPU (empty cpulist). Yet a cpumap map must be created > otherwise perf abort with an error. This patch handles this > case by creating a dummy map. > > Before: > $ perf record -o - -e cycles noploop 2 | perf script -i - > 0x6e8 [0x6c]: failed to process type: 80 > > After: > $ perf record -o - -e cycles noploop 2 | perf script -i - > noploop for 2 seconds > > Signed-off-by: Stephane Eranian Acked-by: Jiri Olsa thanks, jirka > --- > tools/perf/util/cpumap.c | 11 +++++++++-- > 1 file changed, 9 insertions(+), 2 deletions(-) > > diff --git a/tools/perf/util/cpumap.c b/tools/perf/util/cpumap.c > index 1ccbd3342069..383674f448fc 100644 > --- a/tools/perf/util/cpumap.c > +++ b/tools/perf/util/cpumap.c > @@ -134,7 +134,12 @@ struct cpu_map *cpu_map__new(const char *cpu_list) > if (!cpu_list) > return cpu_map__read_all_cpu_map(); > > - if (!isdigit(*cpu_list)) > + /* > + * must handle the case of empty cpumap to cover > + * TOPOLOGY header for NUMA nodes with no CPU > + * ( e.g., because of CPU hotplug) > + */ > + if (!isdigit(*cpu_list) && *cpu_list != '\0') > goto out; > > while (isdigit(*cpu_list)) { > @@ -181,8 +186,10 @@ struct cpu_map *cpu_map__new(const char *cpu_list) > > if (nr_cpus > 0) > cpus = cpu_map__trim_new(nr_cpus, tmp_cpus); > - else > + else if (*cpu_list != '\0') > cpus = cpu_map__default_new(); > + else > + cpus = cpu_map__dummy_new(); > invalid: > free(tmp_cpus); > out: > -- > 2.7.4 >