From patchwork Tue Oct 30 13:26:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 10661069 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CC41314BD for ; Tue, 30 Oct 2018 15:21:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BD9ED2A689 for ; Tue, 30 Oct 2018 15:21:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AF7DC2A68D; Tue, 30 Oct 2018 15:21:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A7AE92A683 for ; Tue, 30 Oct 2018 15:21:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=hLy+f0SzAeYN2ntRTjoKaQB2Q4afDfYE+Iocvy0uG0g=; b=W2Q5WgEroNvtDQGhjzEstbzLIK fVyndeIQzeBqKGsJg011sAy3IogOfNIcvDx5VTjQ9s3SEcBvGZYBt2QSPv64baczXp2UByiD2Y5X7 9Yx1me6oRXAvZq45S3XpcWhFmOBkC5ZJ1yvzQdkRd6GFhVRPkfjFAt17yHNTB4u7TRawf4ly7M3hi dZTVPn1nzOzmbAQ+XVVomn89nKK86NtSZx2U2nJG00DebYwbWUCtRUC2ekVwTUs0wRDtIZJYEWpjk rYmN9+w1X9ipczKPd8IOkY9AcNg9FxXnBh094WHHJdleltOLU4SlGll6DnuPi/hfbOViR/KX6eL7E 2frb7+BQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gHVp5-0000aO-Se; Tue, 30 Oct 2018 15:20:51 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gHVdn-0000Xj-00 for linux-arm-kernel@bombadil.infradead.org; Tue, 30 Oct 2018 15:10:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=7zq4JN2HxJTjV/5nU9b2+C/0k3HKZw/IfsfKa/Q8AWk=; b=whB5+GfZUKQwsYg1HA9Jy8Tb5 IKwN8ERfIM19Q4BZHQaoDNNvtFDxpEOnP1w4O6QMuMIM9KTEZkDQ4NplgRcXoKH/q3dECtAiBxpUI vXthezagrUhNQe6cSsiBUViZz553VSthrlV28Z8ARLtb0aiJ59pGLijKA6rfPT56sgczVVe9X/+Ap jojyUNO6K2kV3BIEpHH11+6RA8Yy9K1fHlFvLbrOF/tnH42zZGt7VRxMcd7vc29jb/bLlA54CF5Ol H987Q8tYBNUqojHlW743OEDhV1+U0W2MDLfcYpggMyv4wSQCpxv6iGu/96uwNP4iq5DA0T3L0Ks4T pzuJd7nBw==; Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gHU4T-00038A-Lk for linux-arm-kernel@lists.infradead.org; Tue, 30 Oct 2018 13:28:38 +0000 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D295620827; Tue, 30 Oct 2018 13:27:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1540906077; bh=DtjZJcQ1neADCvX283Vl2SucERE04LpWvmmB2HEKues=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RNRVHgTO16SyyJfnWpanbDItWMTsvKGR4VyZkyeWFLnQK6sgVNlx0qYJMNx3q95BK E0Hx4lvGzQCrG0VNPVCsM5BFtzhZbtNvod+/PLG3TCP9GzzicT90Mb4IlnN+YBKrNP PdeRQ4S0PJ0U/VWEBfqk7GjXSFQeboYndcFTATFs= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH AUTOSEL 4.18 21/33] perf evsel: Store ids for events with their own cpus perf_event__synthesize_event_update_cpus Date: Tue, 30 Oct 2018 09:26:45 -0400 Message-Id: <20181030132657.217970-21-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181030132657.217970-1-sashal@kernel.org> References: <20181030132657.217970-1-sashal@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181030_092837_836429_C89639BE X-CRM114-Status: GOOD ( 12.95 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Sasha Levin , Andi Kleen , Alexander Shishkin , Will Deacon , linuxarm@huawei.com, Arnaldo Carvalho de Melo , Peter Zijlstra , Jiri Olsa , Namhyung Kim , Jiri Olsa , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jiri Olsa [ Upstream commit 4ab8455f8bd83298bf7f67ab9357e3b1cc765c7d ] 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 Signed-off-by: Sasha Levin --- 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 c04dc7b53797..82a3c8be19ee 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 6324afba8fdd..86ad1389ff5a 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c @@ -1078,6 +1078,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.