Received: by 10.213.65.68 with SMTP id h4csp1670921imn; Mon, 19 Mar 2018 10:09:06 -0700 (PDT) X-Google-Smtp-Source: AG47ELt4MsCP7wJQZVkn4Ei1onOKs9YcxL2B+9wGYTQySnQ9nqDHKODV3A/PLUHKGQIMTcMEdI87 X-Received: by 2002:a17:902:684:: with SMTP id 4-v6mr13459873plh.262.1521479346743; Mon, 19 Mar 2018 10:09:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521479346; cv=none; d=google.com; s=arc-20160816; b=IFQ24b1UKDut7ac+vanwM12DYbyBrfq5KIzCe1KowHwkNDRqjgiOPmeUaAv5vUXDg/ s0BtkZc0UQn9I424BTcNTU2Xco1FE9T5gS91CFj7dCIfbBV7rfy6vpBJg1WndCZ2qLWs 8SVtjCOO/T67WHqpKHqFsqEGKoeFm6sXovhHx2cfuYuc5EjelXrr3mEOtuRRPIhqQxUn fDdlWcIKTh1vuyU9De5fD9AbsWTtbePBnmvSZkdqxTEoNMY+pxnAjN1l5bCQ3qUHRBUi yN7CwFWAOTjN3ZAZOBn4k02/LZvynqklAkJLx94CfzlhDne+K86G3sKjLVxh7TYV9roI 5c5Q== 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=wK3VrgV1APM/9dLfOF5FEkqruoYpNgrWvYpNXpIOO1Q=; b=gTUQfi4T8UtIQV1dzoqTBlM0kjcwuew/qGGRxrbw4daXbB6/9Xqa6B+spfE5LEkZb9 J6TPzLsbkjYkEAX92zdLlUAfBHvKvFXSwjVq6LAv4gM0XQFbl3IJNuvgms2LUcePjXMx +STPIgJehVZevy2+WhiT29M80FRD9AVxzF2Jj3aTwYptlh3XzRMtfZQtgfMm7FmvCe0G l51iCbgwpDdcoBaKwd6wbnfdxdnJbcuXIAbqdYCn46/ANXQu2P3yxj97D66sPkn517on Y2vx0W2MsvoX1baDQ5t/rTEVIISfsZpCblf92wEJbK7dSMli2L2JN/TuaLbp3XEb3KjM HlOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=JIdnKGp5; 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 l63-v6si297984plb.466.2018.03.19.10.08.53; Mon, 19 Mar 2018 10:09:06 -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=JIdnKGp5; 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 S966438AbeCSRHM (ORCPT + 99 others); Mon, 19 Mar 2018 13:07:12 -0400 Received: from mail-sn1nam02on0118.outbound.protection.outlook.com ([104.47.36.118]:57012 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S966666AbeCSQKu (ORCPT ); Mon, 19 Mar 2018 12:10:50 -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=wK3VrgV1APM/9dLfOF5FEkqruoYpNgrWvYpNXpIOO1Q=; b=JIdnKGp5LreDu80w0V/macIxg2Q3doMbgTAmN5EuzPOKf5IaGU5sgGV9/SQjQvdo+cUR6dskZgnOHITgoypVh6i0j3rwhjTDlBMrEKfzyeNT90jlS5lrz2rTlpH/TG31S2mYub0x4rSJyEjgexCwviQtWkDKRx3Coda3EZ0zEbE= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB1095.namprd21.prod.outlook.com (52.132.130.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.631.0; Mon, 19 Mar 2018 16:10:45 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::3d9b:79e7:94eb:5d62]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::3d9b:79e7:94eb:5d62%5]) with mapi id 15.20.0631.004; Mon, 19 Mar 2018 16:10:45 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@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.4 140/167] perf tests: Decompress kernel module before objdump Thread-Topic: [PATCH AUTOSEL for 4.4 140/167] perf tests: Decompress kernel module before objdump Thread-Index: AQHTv5x+0ElvJ8Bke02EnUy4VtJaiA== Date: Mon, 19 Mar 2018 16:08:18 +0000 Message-ID: <20180319160513.16384-140-alexander.levin@microsoft.com> References: <20180319160513.16384-1-alexander.levin@microsoft.com> In-Reply-To: <20180319160513.16384-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;DM5PR2101MB1095;7:9CrU/Rcern0qlAiY8+YFmBAHWEu3SluG2czMVEolYIVKOqJN6hf/nnVQVc7MURod8OJqLEKCF0pBPOVwppI1H1qi7y/FeTUF27geXNH9t/ZkMQDAwgRBaUHuySqPiIfP4ZVLxC2v0W5v4p7h3lm8WuMqV3Hl+flFTXO88yHEhtX20yfsIrk12c3ekBDYWdFaMk0mdREqwRc5ygncjh6kJyVn8TOfMNwz3C+0VH3ZJVz8dYH7SToXHw0ZpbIk7UL5;20:Pe/BFyjPuxW3Xpjn5K+EmBEspE4CDlvnLqc45kcET7w+sYCzOMHFdVvdcVxxu97p5jewmZMXwjMKpuLIq0uqDR9OTSzuUqxxF/UnlnVwb3hg1CuHhGdMAQcbhZHTxnjWNl+20HDLCi5qRrz5svM8efWOvipwzG4TW2drjrO9D7I= x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 5da18f2c-aa69-4b31-42dc-08d58db3f89f x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB1095; x-ms-traffictypediagnostic: DM5PR2101MB1095: 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)(5005006)(8121501046)(3231221)(944501300)(52105095)(3002001)(93006095)(93001095)(10201501046)(6055026)(61426038)(61427038)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123564045)(20161123558120)(6072148)(201708071742011);SRVR:DM5PR2101MB1095;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB1095; x-forefront-prvs: 06167FAD59 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(376002)(346002)(366004)(39860400002)(396003)(39380400002)(189003)(199004)(305945005)(316002)(1076002)(7736002)(14454004)(86612001)(25786009)(8936002)(2950100002)(110136005)(66066001)(186003)(10090500001)(6666003)(5250100002)(39060400002)(2501003)(99286004)(76176011)(86362001)(575784001)(4326008)(68736007)(3660700001)(105586002)(8676002)(81166006)(81156014)(106356001)(3280700002)(72206003)(10290500003)(478600001)(2900100001)(966005)(59450400001)(97736004)(54906003)(6512007)(6306002)(53936002)(6506007)(102836004)(6436002)(5660300001)(6486002)(107886003)(26005)(2906002)(22452003)(6116002)(3846002)(36756003)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB1095;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: QWRNxILbJIeaXtcI0ZW+0yKWcrOQf9J9K3SBP6MH0AhklRAJwV0XJAkosdyJM2SqnkbMY6b/kVIjb5ZiPlW2BZ5xdVr/YOc1QZtTjNwyf4lq73gcGU+O218X8bW0DSy6KmvRzTSwxhILJ3kf3DhaV/nW8Eo4egJkRsu7BRftiL9PgMLcTpQ5ZTlUZSgU4tPtlS8X1u2iLf1g4OZ8RyqhoCxuVrNcjkIGK9XNwoULfjm6ZAjE5H+HLcsniXcFCtU24RhTJyFH58Ee+dM2pnG7fevRPDUBBrkSUIUKhLJkIqKgorWTiAVXazDSs7efNC7A0Gb1WOoK0ZscE1yeIB0Sdw== 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: 5da18f2c-aa69-4b31-42dc-08d58db3f89f X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Mar 2018 16:08:18.7744 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1095 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 a767a6400c5c..6ea4fcfaab36 100644 --- a/tools/perf/tests/code-reading.c +++ b/tools/perf/tests/code-reading.c @@ -182,6 +182,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); @@ -242,9 +244,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.14.1