Received: by 10.213.65.68 with SMTP id h4csp2113107imn; Sun, 8 Apr 2018 20:03:02 -0700 (PDT) X-Google-Smtp-Source: AIpwx49C4tMoupFby/7rHH0+tzZq8c3DJtvpLLEty6g7nj2f7KKTDw88t+Z93L3DEFZtQokPd8uZ X-Received: by 10.98.63.75 with SMTP id m72mr27560543pfa.167.1523242982928; Sun, 08 Apr 2018 20:03:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523242982; cv=none; d=google.com; s=arc-20160816; b=jkHCdKuASA+w5O+zMcPAuPpTdTIWx7YE3/xkm2E/fy+GPHI1oG2x/3fKTzes+v/GEl qXIhI+FpnffAgF8MRwfgXSslbwJNsrxEAcSroF6Q61ViVocZ4RlJdLK3RALFscWC9f09 RuAhTCrd82kkKHoQ3RFN5iCljNGoAnX3Ikb574YYUN0blyQhBgYa9sIC+ojbt5snVlmS zuxgGUodEYU3O8KoU3LhoSCcdEjHmHh8rpjLSL4IkQMvGvBKQKvoYL4A2KrmKHWNeZp2 4xjnCb8PSNbiZLylyQuKOmQGGsvryP24R0mGYrUJ30kmN8nTEQxws4d5OMnSqHSOLqFZ PB/w== 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=oC6cDmq05pgQTTWZL+itGtoHYTjaXK+KsS7ePpOOycw=; b=zIeJw9aGclCyl8II5LJaebgkLfpb61VQ4dRBVtdp/4i561uxYVYTSESIt2VKtRMNa0 g8oU0imsTo2tQKi+EOFShCN2jNZRwRyJBMhWXDk8IZT9XMGy3hMwMXIGk0RMR8Gok+hU TZxZWLPsKIbrPOaYJX1wafQhpYS85HbfeJCN1TQzgbY1U3z8ASguObNIYGBKMRRoTHdH JaCCTGq0fRu9EFk2QWLnUSgoY280Hesq43pmtnkR3/iAmtLoIsn8GlAwGFR0bo94lzqQ xJfGbxJekYXaIPL1W2Ary7BViU7WkLcmNIvbJNoHq/AyPNSqTf8xV/xzwtpe22PF1fBJ smJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=lXjw9qHm; 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 u45si10636990pgn.702.2018.04.08.20.02.26; Sun, 08 Apr 2018 20:03:02 -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=lXjw9qHm; 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 S1755447AbeDIA0s (ORCPT + 99 others); Sun, 8 Apr 2018 20:26:48 -0400 Received: from mail-by2nam03on0126.outbound.protection.outlook.com ([104.47.42.126]:2432 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754647AbeDIA0o (ORCPT ); Sun, 8 Apr 2018 20:26:44 -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=oC6cDmq05pgQTTWZL+itGtoHYTjaXK+KsS7ePpOOycw=; b=lXjw9qHmFa1MN9RsDQ59AIsZGvvQHXspIDsWbhGMEN8grw3acFLobBTyV0mMlR0/h+HPG9z9Pq78M9vyT7sXa9hCp8V0fp8wkBvrEaVVWRlxkdDA4u7vsOUtft2CgLrnGvxjE0QRIS/Txeh/NpaUDD9nS3PP0ChkVKkl07CI1Z8= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0885.namprd21.prod.outlook.com (52.132.132.154) 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:26:39 +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:26:39 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Namhyung Kim , David Ahern , Peter Zijlstra , Wang Nan , "kernel-team@lge.com" , Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH AUTOSEL for 4.9 016/293] perf tests: Decompress kernel module before objdump Thread-Topic: [PATCH AUTOSEL for 4.9 016/293] perf tests: Decompress kernel module before objdump Thread-Index: AQHTz5jrALn3ow7XIk+jZZngG7wkkg== Date: Mon, 9 Apr 2018 00:23:01 +0000 Message-ID: <20180409002239.163177-16-alexander.levin@microsoft.com> References: <20180409002239.163177-1-alexander.levin@microsoft.com> In-Reply-To: <20180409002239.163177-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;DM5PR2101MB0885;7:e6vmq+50B+CsXG5O9yFN/jS+PkTjdpph1YvepJ5FV7FORN81oxFSiEGYkX9ujYSrSiq1d8DSl2cbVYR6tVZ4OAAQEx9LbDnr56OHBXgfoDIK2bj27jQ+07uTBo9pW/T+3xmINo8GLxJZHmr2GnvNUHnJsQGDazuZoHKwx4CA4awzT2iWAJl2DqToHDYnR/QTU2wX0PHJaXX8+sRZwpIis2vtjFQ2Bw+jwtRQwreM1S4AmFz69M9kt0DERFuFJ0+U;20:rtBpQr2ckQwVoTBQQ4D5TXX61NjAClugqLkYTAHMdJAr0WONlfNrDUa408CM25iweMCEodCHMihErdYMH6nPdfxB0Yc6n7E5SMlhKEslbSn0E2I8+CM2+hFDq1UdiT0ESRGfBvxbpCvzZVQr54IYT/SsEIPb6Xyq5kyMwS+AF4s= x-ms-office365-filtering-ht: Tenant X-MS-Office365-Filtering-Correlation-Id: 225234af-ad5d-40a3-42ea-08d59db08fba x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB0885; x-ms-traffictypediagnostic: DM5PR2101MB0885: 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)(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3231221)(944501327)(52105095)(3002001)(10201501046)(6055026)(61426038)(61427038)(6041310)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123564045)(20161123560045)(6072148)(201708071742011);SRVR:DM5PR2101MB0885;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB0885; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(979002)(39860400002)(366004)(346002)(376002)(396003)(39380400002)(189003)(199004)(2906002)(68736007)(22452003)(316002)(6512007)(5660300001)(6666003)(54906003)(110136005)(486006)(6486002)(102836004)(6306002)(36756003)(14454004)(99286004)(86612001)(105586002)(72206003)(106356001)(2900100001)(1076002)(97736004)(10090500001)(3280700002)(5250100002)(6436002)(3660700001)(6116002)(575784001)(3846002)(305945005)(86362001)(59450400001)(66066001)(39060400002)(10290500003)(186003)(81166006)(8936002)(478600001)(476003)(25786009)(81156014)(8676002)(4326008)(7736002)(2501003)(107886003)(966005)(6506007)(2616005)(26005)(76176011)(446003)(53936002)(11346002)(22906009)(217873001)(969003)(989001)(999001)(1009001)(1019001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB0885;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: Uu0WxjcYr5QHQ+mJY2FG7oXOfiLbATOhsLnbIlEDMkN8kboLkZVoisFYlRyJviuQuJAcE3Iv82C+ufWwXuL3HQOub8Khq1zn0zMo6Xykz70lwf8JYKG04CIjoIe+39g+0eiH/Oe6nRBlCjFxy60PYEmqY/ehNQnuYRS1s+Nn+wTXmEFi/EgDTExnF4iJpCzqa79UWBWu8rdow4zB6NFu/e9dXH6zg4SsQevLh3+0zc5m9awJhe/rrMsOL9QZksIdZvBp+8vNIdmwus2Cv5ObxMO58H+LvHTHJ2ZxrxI7hV9sPcmUC6SCEKU7Xv+huYN0lva+Jl33a4nvojKYIQdQlqnajBKs7CGLetJhp0lFOFE1QEYDIfuXTh+7iUjU16rhGwoLg4lZG42uciat4iREx5TjzzeeffK2WVrIXnRJdx0= 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: 225234af-ad5d-40a3-42ea-08d59db08fba X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:23:01.3310 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0885 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Namhyung Kim [ Upstream commit 94df1040b1e6aacd8dec0ba3c61d7e77cd695f26 ] If a kernel modules is compressed, it should be decompressed before running objdump to parse binary data correctly. This fixes a failure of object code reading test for me. Signed-off-by: Namhyung Kim Acked-by: Adrian Hunter Acked-by: Jiri Olsa Cc: David Ahern Cc: Peter Zijlstra Cc: Wang Nan Cc: kernel-team@lge.com Link: http://lkml.kernel.org/r/20170608073109.30699-8-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin --- tools/perf/tests/code-reading.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-readin= g.c index ff5bc6363a79..150334064071 100644 --- a/tools/perf/tests/code-reading.c +++ b/tools/perf/tests/code-reading.c @@ -224,6 +224,8 @@ static int read_object_code(u64 addr, size_t len, u8 cp= umode, unsigned char buf2[BUFSZ]; size_t ret_len; u64 objdump_addr; + const char *objdump_name; + char decomp_name[KMOD_DECOMP_LEN]; int ret; =20 pr_debug("Reading object code for memory address: %#"PRIx64"\n", addr); @@ -284,9 +286,25 @@ static int read_object_code(u64 addr, size_t len, u8 c= pumode, state->done[state->done_cnt++] =3D al.map->start; } =20 + objdump_name =3D al.map->dso->long_name; + if (dso__needs_decompress(al.map->dso)) { + if (dso__decompress_kmodule_path(al.map->dso, objdump_name, + decomp_name, + sizeof(decomp_name)) < 0) { + pr_debug("decompression failed\n"); + return -1; + } + + objdump_name =3D decomp_name; + } + /* Read the object code using objdump */ objdump_addr =3D map__rip_2objdump(al.map, al.addr); - ret =3D read_via_objdump(al.map->dso->long_name, objdump_addr, buf2, len)= ; + ret =3D read_via_objdump(objdump_name, objdump_addr, buf2, len); + + if (dso__needs_decompress(al.map->dso)) + unlink(objdump_name); + if (ret > 0) { /* * The kernel maps are inaccurate - assume objdump is right in --=20 2.15.1