Received: by 10.213.65.68 with SMTP id h4csp2158487imn; Sun, 8 Apr 2018 21:13:45 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+p7tD8/2R+rX/bGZS2Iiw2wK7j3mc5zwOmxwUt4ExuixdShtVg7hMe/E+uFy4R8gXLEIfk X-Received: by 10.98.157.6 with SMTP id i6mr28083081pfd.52.1523247225056; Sun, 08 Apr 2018 21:13:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523247225; cv=none; d=google.com; s=arc-20160816; b=AwFY9rtXLAr7RpAlKwnIidxFv7Fa5yIWN6jCtUhS5YApucwnbjQFnl/EGN0wZ/oOHk 6YBLwbn9OvKmBnqlwhXGygbtH9WoJEoMIiLJ17Ap9Sd8iI3mh9sgWdPpoJgzlY27Ojp6 4gCfEaw0Y2b4G1MU/O928lrmVQa2pKyC9U2fLj9IBbY9jUrxCz71DPlQeweJInEcE1tB X8mE/0x7zxXtVo0s7NL1WNDb08MLIOrwz5EY7Ahp4p03ZWPEDkpge+j1Xe5rxwmx7/UF 8KlItTczg0wVRfTbrJapxekNBCJlfFNirFFpb92FQn1PrDnBZiJiTDa+l2vquVe7W3fw 4mVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=XH7psHMVzFegc6P8d73ZzHHn4NIlSHUArYLyAFAYpyA=; b=W8vPsZWx9TFs74RxOd7tRy5+q/l1g6CEFtWbIxvdYLhvzeN/Ie2v18FUfE0bYuJ7uY xpT+yfU3qn8Kh/hOj99wkWAp/Hzt/TnWw+uuhrD5uwcT4KaLj70w26dpN+7HA+xrZp1V +qAX+97bL3WfvbCOSddEj/11bYKNOyz/dkBMWRcZ/FrFXqRzNuNYhxAVN2pd5+Jgzd1W GL9wFv09LcE6HixHg625hWY9bkYiQVLtwCb2o4yu8mdxMb6517J81fGjZSy6VoV4Nt6E 3pVsxr0tgSFRoyQqBjH1l3HMk/lB6dkIPOKOAMvQBWJKya67fYY7EbnWd30UTftU0cub BDVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=TYtS0PHY; 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=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 62si11897170pfw.173.2018.04.08.21.13.08; Sun, 08 Apr 2018 21:13:44 -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=@microsoft.com header.s=selector1 header.b=TYtS0PHY; 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=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753969AbeDIEIK (ORCPT + 99 others); Mon, 9 Apr 2018 00:08:10 -0400 Received: from mail-co1nam03on0128.outbound.protection.outlook.com ([104.47.40.128]:49080 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753101AbeDIARQ (ORCPT ); Sun, 8 Apr 2018 20:17:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=XH7psHMVzFegc6P8d73ZzHHn4NIlSHUArYLyAFAYpyA=; b=TYtS0PHYHfH8oQz8GNKszpMI8oPZR2DqpYnLOe0JpMO9OQfG2SHDDVaRBZfNx7Pof9yWeaaF1MdqMY6QxPgBysnQsnALAF0KNiUwedslEMhjewe5swWi7i1X6z2mqWMfF0W3AK9U70wbn+SI63gOMVuYG8Vw+kKuVLyuquOxN2Y= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB1127.namprd21.prod.outlook.com (52.132.132.167) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.696.0; Mon, 9 Apr 2018 00:17:10 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059%2]) with mapi id 15.20.0696.003; Mon, 9 Apr 2018 00:17:10 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Arnaldo Carvalho de Melo , Adrian Hunter , David Ahern , Hendrick Brueckner , Jiri Olsa , Namhyung Kim , Thomas Richter , Wang Nan , Sasha Levin Subject: [PATCH AUTOSEL for 4.15 030/189] perf callchain: Fix attr.sample_max_stack setting Thread-Topic: [PATCH AUTOSEL for 4.15 030/189] perf callchain: Fix attr.sample_max_stack setting Thread-Index: AQHTz5gZnAPabOG5pkyhNynPOZz8RQ== Date: Mon, 9 Apr 2018 00:17:10 +0000 Message-ID: <20180409001637.162453-30-alexander.levin@microsoft.com> References: <20180409001637.162453-1-alexander.levin@microsoft.com> In-Reply-To: <20180409001637.162453-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM5PR2101MB1127;7:aY6yhG3dYo7wfzgXhlZKkKpZCG8V/EdIRU3IOs3UXeRgfONL9KNIVyvHiVuiX/aUe0AF0oSBBx/l5+8Gs7eIWUl3OpQAlrOG5w7NzxDbkec+XP1MqtyAFbgQcuIkzQ2EO6OP+nmUY8LO/75ZL/jIsq36o216uVl+p5LFzFHb7D5X73lR9/yS6e0kEUD87lRDxmEUDqG/5hM0MdvCUgcHdIZG3U4RlWisC76ymIguKffrpHOilBWgAA+oDMs8Pn34;20:hkDoy3YWoXSzQsOWJB1gYOoYhgdSyxCs9sRtgf3+3CO8RQ3EUZU4xDrGdqd9gzLwf3y2NopHK/Lyh42kl1HOHm00zkjRQm7r0KWIZNOV4qE6vlKTEu74z3o/IXHyL71aJPnT7Bm5+lIjcmx8OA5byrHyUespQW0iG7Aa2cO1VTY= x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-ht: Tenant X-MS-Office365-Filtering-Correlation-Id: 68e807b9-c901-46fc-0e63-08d59daf3c7d x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB1127; x-ms-traffictypediagnostic: DM5PR2101MB1127: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(50582790962513)(85827821059158)(42068640409301)(84791874153150)(104084551191319)(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040522)(2401047)(8121501046)(5005006)(3231221)(944501327)(52105095)(3002001)(93006095)(93001095)(10201501046)(6055026)(61426038)(61427038)(6041310)(20161123560045)(20161123564045)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011);SRVR:DM5PR2101MB1127;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB1127; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(1496009)(396003)(39380400002)(39860400002)(376002)(346002)(366004)(189003)(199004)(105586002)(186003)(7416002)(66066001)(6486002)(54906003)(7736002)(26005)(575784001)(86362001)(316002)(305945005)(110136005)(478600001)(3280700002)(86612001)(10290500003)(25786009)(5250100002)(2616005)(99286004)(22452003)(5660300001)(966005)(3660700001)(2900100001)(81166006)(3846002)(2906002)(106356001)(6506007)(107886003)(486006)(39060400002)(8676002)(81156014)(14454004)(10090500001)(68736007)(4326008)(6116002)(1076002)(72206003)(102836004)(6306002)(97736004)(11346002)(8936002)(476003)(2501003)(6436002)(6512007)(446003)(76176011)(36756003)(53936002)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB1127;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: vVJ/v5ris4SNNNGA7L/6MfhecbPAVx4Q7/G12UJJcjP5gxE3qp0Jz+X4QB2Bxhc/DMpWkkg5w5Pw/iGWzvNJXKe/ZWAGvd2ajiQsNM2VXWq5MoCX3M2Iw9Zso2TLyHUZ2IIw16i5b0rK1wzkqj/WqkHqz5q6sJKWBEz4ySvlLgmT/YyBIhpq0EWWp6m038+xyJN9OJ8QKlp+cma+9tftn4Bho7ddBNYKQo3fKqfFCajaaANa0sV5ZHsNcdHCNYj4zdDm0Ax369b1IB8PvrIMOgzWyFXCEPlkVvHvFFIbQDRiTZpF5nkt9SWyVsJfjd+qujEJ0QBU9IxMFF2ZCeqMhgqYg7Jg8d9X4ggi4HPoYIUGcEYFPdIyc/H5AXjWtZYIphE5gX5xrvHqfxszOgtVfJrCJS1i0z0pM2cCRFV5bBQ= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 68e807b9-c901-46fc-0e63-08d59daf3c7d X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:17:10.1209 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1127 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnaldo Carvalho de Melo [ Upstream commit 249d98e567e25dd03e015e2d31e1b7b9648f34df ] When setting the "dwarf" unwinder for a specific event and not specifying the max-stack, the attr.sample_max_stack ended up using an uninitialized callchain_param.max_stack, fix it by using designated initializers for that callchain_param variable, zeroing all non explicitely initialized struct members. Here is what happened: # perf trace -vv --no-syscalls --max-stack 4 -e probe_libc:inet_pton/call= -graph=3Ddwarf/ ping -6 -c 1 ::1 callchain: type DWARF callchain: stack dump size 8192 perf_event_attr: type 2 size 112 config 0x730 { sample_period, sample_freq } 1 sample_type IP|TID|TIME|ADDR|CALLCHAIN|CPU|PERIOD|= RAW|REGS_USER|STACK_USER|DATA_SRC exclude_callchain_user 1 { wakeup_events, wakeup_watermark } 1 sample_regs_user 0xff0fff sample_stack_user 8192 sample_max_stack 50656 sys_perf_event_open failed, error -75 Value too large for defined data type # perf trace -vv --no-syscalls --max-stack 4 -e probe_libc:inet_pton/call= -graph=3Ddwarf/ ping -6 -c 1 ::1 callchain: type DWARF callchain: stack dump size 8192 perf_event_attr: type 2 size 112 config 0x730 sample_type IP|TID|TIME|ADDR|CALLCHAIN|CPU|PERIOD|= RAW|REGS_USER|STACK_USER|DATA_SRC exclude_callchain_user 1 sample_regs_user 0xff0fff sample_stack_user 8192 sample_max_stack 30448 sys_perf_event_open failed, error -75 Value too large for defined data type # Now the attr.sample_max_stack is set to zero and the above works as expected: # perf trace --no-syscalls --max-stack 4 -e probe_libc:inet_pton/call-gra= ph=3Ddwarf/ ping -6 -c 1 ::1 PING ::1(::1) 56 data bytes 64 bytes from ::1: icmp_seq=3D1 ttl=3D64 time=3D0.072 ms --- ::1 ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev =3D 0.072/0.072/0.072/0.000 ms 0.000 probe_libc:inet_pton:(7feb7a998350)) __inet_pton (inlined) gaih_inet.constprop.7 (/usr/lib64/= libc-2.26.so) __GI_getaddrinfo (inlined) [0xffffaa39b6108f3f] (/usr/bin/pin= g) # Cc: Adrian Hunter Cc: David Ahern Cc: Hendrick Brueckner Cc: Jiri Olsa Cc: Namhyung Kim Cc: Thomas Richter Cc: Wang Nan Link: https://lkml.kernel.org/n/tip-is9tramondqa9jlxxsgcm9iz@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin --- tools/perf/util/evsel.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index d5fbcf8c7aa7..784d852c91cc 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c @@ -722,14 +722,14 @@ static void apply_config_terms(struct perf_evsel *evs= el, struct perf_evsel_config_term *term; struct list_head *config_terms =3D &evsel->config_terms; struct perf_event_attr *attr =3D &evsel->attr; - struct callchain_param param; + /* callgraph default */ + struct callchain_param param =3D { + .record_mode =3D callchain_param.record_mode, + }; u32 dump_size =3D 0; int max_stack =3D 0; const char *callgraph_buf =3D NULL; =20 - /* callgraph default */ - param.record_mode =3D callchain_param.record_mode; - list_for_each_entry(term, config_terms, list) { switch (term->type) { case PERF_EVSEL__CONFIG_TERM_PERIOD: --=20 2.15.1