Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1227233imm; Wed, 17 Oct 2018 15:56:25 -0700 (PDT) X-Google-Smtp-Source: ACcGV61QS4tpqacrG/dqvgzBC1H/yUa9mii4evRCUagvCq7F8Da57vy7J2IBlt4Xees72O0uMMi0 X-Received: by 2002:a17:902:9047:: with SMTP id w7-v6mr27590314plz.4.1539816985072; Wed, 17 Oct 2018 15:56:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539816985; cv=none; d=google.com; s=arc-20160816; b=FPGBQOp8tOQh7gQLvdJCakRDAAy+ngojXN6RQQgrJCESvBXcOYunsuw+SV7SY4nhr0 HXeD/nOJoRwVy0YeEDau4ysZ6IzNpkU66N/41w8cWu11XWCFDJ4eiLFbBB8cWhMfJheA VxFU9unPRbC2+GZ0IQXjWFzBvCe21i2pKf0BNQ6QFxLVh8DJuiB1VnhnEaZmst9Qn7xq Wy17LOwmR/SKqZ9bR7WTWPhUjyaX1vfZzQL0InuUAcS8gYzevy0XYDLAZGNkM/QFt6nQ Ar0qbi2ZwRWuuVQXfoNhB6PNHdnTmjjXMBlx1cniAtycPD/3m4CGIkgzWiie/9Xc/U4y u+sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=L0bGtCDWDnwpj1/QLwpdf1Ys8k6TL6iCBhLrcaZCefU=; b=yxVoW3vbYReG5Lc8uSc6khaUFcW3V4xlkMO2AZ8JiXL3a4dCFOpEK52QdbZG94D+TB J+uFjkGm9wlzbmnVhEr6FDvatWyDG6sc52vkaaE98ISd3hsmBDfFh3QmEOHLnOMl9HWd xMwvaJ+sUXie2vMVH/qEKrjHS6SGsFBptidq5ToHXGIaJHjYr3LHdYT4Ob6r8xbIodtz iUF6bk3OhQEj+vroSNFdgmIhzKU87Kr3Ki/nOlltejXBT9BXafqmxgbuVCngiotiPoZj +/cPaq8mMJOXQC+QgswpIw3FaS3BSaH/CWfM9oDZoN0iW0FnAxSbKzINieoruQqFo1Rc lLsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=IwfA7sKU; 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=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 u21-v6si19048760pgm.406.2018.10.17.15.56.09; Wed, 17 Oct 2018 15:56:25 -0700 (PDT) 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=@kernel.org header.s=default header.b=IwfA7sKU; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727729AbeJRGxb (ORCPT + 99 others); Thu, 18 Oct 2018 02:53:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:42064 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726412AbeJRGxb (ORCPT ); Thu, 18 Oct 2018 02:53:31 -0400 Received: from jouet.infradead.org (unknown [179.97.41.186]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9F45521473; Wed, 17 Oct 2018 22:55:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539816937; bh=syB5c/+/I7wOobpC2m0UcjSqXb5PxndVZYwYSdGOa9I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IwfA7sKUJ7dsUNAYUHerSHjD8fuC7b3b9WS0o8LtVlr/Xhg1g+drc+qldtPYwBGux Y0RpxU0MBdBAj7jPzVh2f2RM50uJlUXBdS/7Pi66aD29bMvBMjuA23cTxjSrqgCH/+ HAzV3eAIAc34TfEGWQ8cNJqiT4rDe66nL5koHZhk= From: Arnaldo Carvalho de Melo To: Ingo Molnar Cc: Clark Williams , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Jiri Olsa , Jiri Olsa , Alexander Shishkin , Andi Kleen , Mark Rutland , Namhyung Kim , Peter Zijlstra , Will Deacon , linux-arm-kernel@lists.infradead.org, linuxarm@huawei.com, Arnaldo Carvalho de Melo Subject: [PATCH 05/11] perf evsel: Store ids for events with their own cpus perf_event__synthesize_event_update_cpus Date: Wed, 17 Oct 2018 19:54:55 -0300 Message-Id: <20181017225501.32150-6-acme@kernel.org> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20181017225501.32150-1-acme@kernel.org> References: <20181017225501.32150-1-acme@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jiri Olsa John reported crash when recording on an event under PMU with cpumask defined: root@localhost:~# ./perf_debug_ record -e armv8_pmuv3_0/br_mis_pred/ sleep 1 perf: Segmentation fault Obtained 9 stack frames. ./perf_debug_() [0x4c5ef8] [0xffff82ba267c] ./perf_debug_() [0x4bc5a8] ./perf_debug_() [0x419550] ./perf_debug_() [0x41a928] ./perf_debug_() [0x472f58] ./perf_debug_() [0x473210] ./perf_debug_() [0x4070f4] /lib/aarch64-linux-gnu/libc.so.6(__libc_start_main+0xe0) [0xffff8294c8a0] Segmentation fault (core dumped) We synthesize an update event that needs to touch the evsel id array, which is not defined at that time. Fixing this by forcing the id allocation for events with their own cpus. Reported-by: John Garry Signed-off-by: Jiri Olsa Tested-by: John Garry Cc: Alexander Shishkin Cc: Andi Kleen Cc: Mark Rutland Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Will Deacon Cc: linux-arm-kernel@lists.infradead.org Cc: linuxarm@huawei.com Fixes: bfd8f72c2778 ("perf record: Synthesize unit/scale/... in event update") Link: http://lkml.kernel.org/r/20181003212052.GA32371@krava Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-report.c | 1 + tools/perf/util/evsel.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index 76e12bcd1765..b2188e623e22 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c @@ -981,6 +981,7 @@ int cmd_report(int argc, const char **argv) .id_index = perf_event__process_id_index, .auxtrace_info = perf_event__process_auxtrace_info, .auxtrace = perf_event__process_auxtrace, + .event_update = perf_event__process_event_update, .feature = process_feature_event, .ordered_events = true, .ordering_requires_timestamps = true, diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index 1a61628a1c12..e596ae358c4d 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c @@ -1089,6 +1089,9 @@ void perf_evsel__config(struct perf_evsel *evsel, struct record_opts *opts, attr->exclude_user = 1; } + if (evsel->own_cpus) + evsel->attr.read_format |= PERF_FORMAT_ID; + /* * Apply event specific term settings, * it overloads any global configuration. -- 2.14.4