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.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, 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 12BFAC433DB for ; Thu, 25 Feb 2021 16:03:23 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 B45A764F18 for ; Thu, 25 Feb 2021 16:03:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B45A764F18 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org 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=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=TJIRZVN7CphTlxWqB+QBV7PjDdHQ49Ah63yHQmTOZmo=; b=qtMyGc8T1J73GIY9TipZMghlZ R6BWjryDJEgb1zfBa5CfK0TBIDN98VC0GgrUVlhMUrFlrBaVEjWqESugG93i3tw+z1thpcOcf15hs e84ZEQe901asEARK+NAuYYLWWDJotuv8xO8SubNMATpT/0eyYaMXugkLmSwMEIj2eWvhht3+EpN3I yshrCBNOWPD+qeOn1V96+mn/P8xo2vnZTvGFy3mNW16vV+PMmjnZar9IMHe8GrUE5qb+Lx9APNWiG BNiYmTMXUi52k9lP8+fpob8MULf92+6T1yLPfjaNMlcgBrXzQpoNzozXhaPBFwtUgOUYQznQHaqFV +y6+4bNnQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1lFJ4v-0002mc-Kh; Thu, 25 Feb 2021 16:01:25 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1lFJ4t-0002m7-4e for linux-arm-kernel@lists.infradead.org; Thu, 25 Feb 2021 16:01:23 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8E5D964EDB; Thu, 25 Feb 2021 16:01:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1614268882; bh=nyR5e5Sw00AV8E+QvgPhcwRlboPNI2VFPrdUASzSmnc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=j1QM7b31tj393PX+O5gCyJlNEYUHRI1Ykhhb8q2HNwX/cZjai6sf2DqRaXIQKf/Tu 4MBH7KrC5XDOrF5Xp8KZrcFw3nIquE4Te8hpS9R3fQmaZrzEID29IC0yRCi/dQ36/X MhOgnudGLTMk2PGqQug2VOrymjUcEIBEPwFVvKPFNrnoY4/Z9ljR05YWe7mjZPAmjw c4oup5HE5gHZtcxWRgpLr0AVWH1Jm0/TqwILYOcCkBXV5VjwN5WyJIIb2ay0gbRnr7 0Cl6+TAJ9CJWpscANbXy2GQKIElWtYTI30ACEq+vBqk+n6wyhxvKbWVzceh130bu1i Su/uLFQQ621CQ== Date: Thu, 25 Feb 2021 16:01:17 +0000 From: Will Deacon To: Steven Rostedt Subject: Re: [PATCH] recordmcount: Fix the wrong use of w* in arm64_is_fake_mcount() Message-ID: <20210225160116.GA13604@willie-the-truck> References: <20210225140747.10818-1-lihuafei1@huawei.com> <20210225094426.7729b9cc@gandalf.local.home> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210225094426.7729b9cc@gandalf.local.home> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210225_110123_284346_133DD700 X-CRM114-Status: GOOD ( 26.19 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: catalin.marinas@arm.com, linux-kernel@vger.kernel.org, christophe.leroy@csgroup.eu, zhangjinhao2@huawei.com, yangjihong1@huawei.com, Li Huafei , gregory.herrero@oracle.com, xukuohai@huawei.com, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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? ;) Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel