From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B029DC433DB for ; Wed, 3 Mar 2021 19:49:08 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6C87964EBA for ; Wed, 3 Mar 2021 19:49:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6C87964EBA Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:CC:From: References:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=r48a+IGG3ErpVqWAa+bgOsYx0RzkPTFppwhVUASnm1w=; b=GMQ9Xj0LT3ILtWtM++a90DgCL ZjtsHL7Oy8k5iLJ1fOddOt0kCBjQxS2djTo0zkEPTDVfxvWKSylfKH553uso8wqwg1mtXwa0cJgI2 5z1R1ZYndj2DukW+V5DrPBcfI3BdKi30imrXwmejhF0ESpEsR5KEkToBFNYKLH7K3D+UAZImN5l1o 6WWV0GiGAVNHXqid+pGnH41FEYKMh7d88FtylvHvJJjj8GDAC3R0JQqcVvoOldnP8g8ivfogLyGjA JsxMW2K2+UxRasZtPfjf/4+fLZglKG5DlaJzoK2CoZNoLdRQAY1dAE2kqv2+KJVPeWn6Ugf6i7EDU dWvaW9VCA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lHXS9-006HQk-Jz; Wed, 03 Mar 2021 19:46:37 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lHT4L-005ILJ-Is for linux-arm-kernel@desiato.infradead.org; Wed, 03 Mar 2021 15:05:45 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:CC:From:References:To:Subject:Sender :Reply-To:Content-ID:Content-Description; bh=17FcWvyRlGWBpevvM7Ww6Yyh8+4R3OjRfiyv5ywqc7I=; b=q2sZMZZ1FAf4oaSy6AWLGYxPG8 TOc/OK6sPwXWXpmCU9KuhVtppHE/ml6Ojczaqo6qVurbmyqqpPaXH+7gbYcCrZ3LQttQyaCCzrLEI Q3QTUQYzN+pCJrt+w4gbUSWqLwnKVoCt3l0moVyVzBWnJH/AOr4kToyvPYe/Qu/AQdtBYpdFGao9i 0f+lm2qz84dQno3uJywfn+wW9sjNgtgU7X3PBvO1UJe5txa0g4BnyOll/rFWFiX2xjGsaY8rFgefr CZ8BSQPt04GhKka9LqprlaywLRtPbGMFjpQ7/T+k91ozrhXNnox6dvM9/r83kTT8e2pqZhd5cvvk0 ayMT2LjA==; Received: from szxga04-in.huawei.com ([45.249.212.190]) by casper.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lHGGd-000rRb-R3 for linux-arm-kernel@lists.infradead.org; Wed, 03 Mar 2021 01:25:37 +0000 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4Dqx8h5ljDz16FRB; Wed, 3 Mar 2021 09:23:32 +0800 (CST) Received: from [10.67.110.237] (10.67.110.237) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.498.0; Wed, 3 Mar 2021 09:25:05 +0800 Subject: Re: [PATCH] recordmcount: Fix the wrong use of w* in arm64_is_fake_mcount() To: Steven Rostedt References: <20210225140747.10818-1-lihuafei1@huawei.com> <20210225094426.7729b9cc@gandalf.local.home> <20210225160116.GA13604@willie-the-truck> <20210302173058.28fd3d36@gandalf.local.home> From: Li Huafei CC: , , , , , Zhangjinhao , , , Message-ID: <54eb164c-695d-57c5-6bcd-51483b7998d3@huawei.com> Date: Wed, 3 Mar 2021 09:25:05 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: <20210302173058.28fd3d36@gandalf.local.home> Content-Language: en-US X-Originating-IP: [10.67.110.237] X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210303_012537_377092_FA29ACA9 X-CRM114-Status: GOOD ( 18.53 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 2021/3/3 6:30, Steven Rostedt wrote: > On Thu, 25 Feb 2021 16:01:17 +0000 > Will Deacon wrote: > >> On Thu, Feb 25, 2021 at 09:44:26AM -0500, Steven Rostedt wrote: >>> This requires an acked-by from one of the ARM64 maintainers. >>> >>> -- Steve >>> >>> >>> On Thu, 25 Feb 2021 22:07:47 +0800 >>> Li Huafei wrote: >>> >>>> When cross-compiling the kernel, the endian of the target machine and >>>> the local machine may not match, at this time the recordmcount tool >>>> needs byte reversal when processing elf's variables to get the correct >>>> value. w* callback function is used to solve this problem, w is used for >>>> 4-byte variable processing, while w8 is used for 8-byte. >>>> >>>> arm64_is_fake_mcount() is used to filter '_mcount' relocations that are >>>> not used by ftrace. In arm64_is_fake_mcount(), rp->info is 8 bytes in >>>> size, but w is used. This causes arm64_is_fake_mcount() to get the wrong >>>> type of relocation when we cross-compile the arm64_be kernel image on an >>>> x86_le machine, and all valid '_mcount' is filtered out. The >>>> recordmcount tool does not collect any mcount function call locations. >>>> At kernel startup, the following ftrace log is seen: >>>> >>>> ftrace: No functions to be traced? >>>> >>>> and thus ftrace cannot be used. >>>> >>>> Using w8 to get the value of rp->r_info will fix the problem. >>>> >>>> Fixes: ea0eada45632 ("recordmcount: only record relocation of type >>>> R_AARCH64_CALL26 on arm64") >>>> Signed-off-by: Li Huafei >>>> --- >>>> scripts/recordmcount.c | 2 +- >>>> 1 file changed, 1 insertion(+), 1 deletion(-) >>>> >>>> diff --git a/scripts/recordmcount.c b/scripts/recordmcount.c >>>> index b9c2ee7ab43f..cce12e1971d8 100644 >>>> --- a/scripts/recordmcount.c >>>> +++ b/scripts/recordmcount.c >>>> @@ -438,7 +438,7 @@ static int arm_is_fake_mcount(Elf32_Rel const *rp) >>>> >>>> static int arm64_is_fake_mcount(Elf64_Rel const *rp) >>>> { >>>> - return ELF64_R_TYPE(w(rp->r_info)) != R_AARCH64_CALL26; >>>> + return ELF64_R_TYPE(w8(rp->r_info)) != R_AARCH64_CALL26; >> >> Acked-by: Will Deacon >> >> But you know you could avoid these sorts of problems by moving to little >> endian along with everybody else? ;) >> > > I just realized that I received this patch twice, and thought it was the > same patch! Chen was three days ahead of you, so he get's the credit ;-) > > https://lore.kernel.org/r/20210222135840.56250-1-chenjun102@huawei.com > > -- Steve > . > That's fine, thanks Steve and Will! Huafei _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel