Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp821763ybl; Fri, 10 Jan 2020 07:17:01 -0800 (PST) X-Google-Smtp-Source: APXvYqx4j+RQ4y9H37LxG282eXe4vCCqetxFIm2ydYXHpqVtSvTcwURnDKjvH5q5vgNT1ZoU7R/U X-Received: by 2002:aca:503:: with SMTP id 3mr2453632oif.24.1578669421044; Fri, 10 Jan 2020 07:17:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578669421; cv=none; d=google.com; s=arc-20160816; b=EWrsDjm2lYyMpn59e47fLyw6zWEPO9MbtypV9rMqAs0ZqrvANy4zgmO1kjskkLUdFQ hZBUq0XF9Zf1JbhhyyxJ8gxHgE+mFhfdhzPP6hA4vXP8d5qypFJLrIwunvyKv2rTJz4l FlG/B7mXsdYeLFLwq583KScb+TE+jth0/ceMY0v2/Oo8oV3pLZVeBrI6SK8mpfgPN4Xm SPleVB6kKYXP5AQY6LSZ3SZGxq2aRYuIC4h0X7VPJ2nXo1hzOdq9mgEJ2BshAJNzuiJe TQYPRwAGxrTQpWprvRDL7Rpbklt5FNm8R1jBerzY8VdA9GnFMY3jgAz3A7Yyc6L1mOJG 2xkw== 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:mime-version :message-id:date:subject:cc:to:from; bh=gmQBa4RQnI34fo30E4667y3TSm4qwHzluj7lgnq/zGk=; b=FPjrSgECCLswb4PerKeG24UN14K+ks7nXaWIDS9xQ6p+6QQdU860HFzBjsPBCZmsFc hOVQWQHfHQVYGacECS4mODHhnvoJMoqAoGQFT9ofM0MWCiHLJh5JjajStF6jjM2Y9zs0 w70HNWkmZjPDFJs+V2WqD4jp8lOnW2kC0loYY+v5tr/l8fle4qOSC/M/bjXsXFer2GfB 7b3NxkXyLIbRy1iEFXQBWGkarqfB41xzgwmuO6nzdCNmJFhrYd3IbO5I9HUy+JF/Z49u 2++lbD6ZUTkrBzzw5EZ0/SB4nKjFoxVYWLyYYVGHpXO9piCUJQLtXzSurwCnRVnP514F suPg== 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q26si1101422oij.38.2020.01.10.07.16.48; Fri, 10 Jan 2020 07:17:01 -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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728342AbgAJPPt convert rfc822-to-8bit (ORCPT + 99 others); Fri, 10 Jan 2020 10:15:49 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:23225 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726402AbgAJPPt (ORCPT ); Fri, 10 Jan 2020 10:15:49 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-257-khQgLo3xPieZKhEqLPLOZQ-1; Fri, 10 Jan 2020 10:15:43 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3075D911E8; Fri, 10 Jan 2020 15:15:41 +0000 (UTC) Received: from krava.redhat.com (ovpn-205-164.brq.redhat.com [10.40.205.164]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3D31A60CC0; Fri, 10 Jan 2020 15:15:38 +0000 (UTC) From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: Jann Horn , lkml , Ingo Molnar , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Michael Petlan , Andi Kleen Subject: [PATCH] perf tools: Setup initial evlist::all_cpus value Date: Fri, 10 Jan 2020 16:15:37 +0100 Message-Id: <20200110151537.153012-1-jolsa@kernel.org> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-MC-Unique: khQgLo3xPieZKhEqLPLOZQ-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Jann Horn reported crash in perf ftrace because evlist::all_cpus isn't initialized if there's evlist without events, which is the case for perf ftrace. Adding initial initialization of evlist::all_cpus from given cpus, regardless of events in the evlist. Reported-by: Jann Horn Link: https://lkml.kernel.org/n/tip-kzioebqr5c3u4t7tafju8pbx@git.kernel.org Signed-off-by: Jiri Olsa --- tools/lib/perf/evlist.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/lib/perf/evlist.c b/tools/lib/perf/evlist.c index ae9e65aa2491..5b9f2ca50591 100644 --- a/tools/lib/perf/evlist.c +++ b/tools/lib/perf/evlist.c @@ -164,6 +164,9 @@ void perf_evlist__set_maps(struct perf_evlist *evlist, evlist->threads = perf_thread_map__get(threads); } + if (!evlist->all_cpus && cpus) + evlist->all_cpus = perf_cpu_map__get(cpus); + perf_evlist__propagate_maps(evlist); } -- 2.24.1