Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp114090rwe; Tue, 23 Aug 2022 19:50:12 -0700 (PDT) X-Google-Smtp-Source: AA6agR7yr1BNbu3Cvyx9Ss//B1o+LDg3ExwtSMCEhfo+1rGmZTVlB9Ti/G4s6xev9phN7Y2n7c6i X-Received: by 2002:a05:6402:24a4:b0:440:8c0c:8d2b with SMTP id q36-20020a05640224a400b004408c0c8d2bmr5669164eda.311.1661309412247; Tue, 23 Aug 2022 19:50:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661309412; cv=none; d=google.com; s=arc-20160816; b=KPMrmhE/Dk0UNiimcznvoVM2TjbUGoc9DvqRwo36/SC+lz2ahCjzVUqT78Z1IRD+LG OxzJ+smcRI3Gl8JcygtGqE5jEvkSDHc9bkQqB5T0zGVA96cVaBZVZ3t/qxvGHp0VR+Z5 UVukMaZ5hFtSv7r+kWb+VH1IMbX/Iq1lelcwBaTQr2CyurGygCTpOjigCFapwJZN1LK0 0sNGKRvjR/tajDbKxbbtUTzlM4TlA6UfRed01rdL9ORDQX9lHrBkiJWRelnuwVDPvg/d 9qIM5/yW6JaEvs5Sjv4h87SdopPlAx70HuLcyvgBj3gwYO6gbJNXDkTsyvqkmdP1qlXL PQ3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id; bh=C1U93QWPEdq4KrLdjO9tIz9ZxoNsecVyovZI7LRJ0XY=; b=L+8Hb2VnMxuLe1fTBB1uWbVE6eDVfNr/+hoxZiR8lJ2edZ+vw+CV3nf7ynXcdz1plX hP6I52js8/UN2tqkOz6Rtvg8mDQPdY7Ty1UGwobao2MhbfIYDiIW0Q+wfO0St99llQ7r rGXBH6SqwsBeuF7Zt+bbdgFH4ilD61IC8TE0dfghiMDgiiXLv/EDsgnEhQTNikyWCuCA XKh367uAR8VXOAHWWAaEUkm0N00Esd9U4GuN4pWVI5wv0kWBh4haU5M2lCNnyLstq1mn WKW5q/X+UsUVh0ZQvE44eR5+JjQehfXMRj1aXlFJ1IEDZcOL0T81PgAK/wn81PyHyjH0 vQ9A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m23-20020a50d7d7000000b0044637388fb5si2924080edj.234.2022.08.23.19.49.46; Tue, 23 Aug 2022 19:50:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233210AbiHXCHY (ORCPT + 99 others); Tue, 23 Aug 2022 22:07:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229700AbiHXCHW (ORCPT ); Tue, 23 Aug 2022 22:07:22 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF9C26EF34 for ; Tue, 23 Aug 2022 19:07:20 -0700 (PDT) Received: from dggpemm500020.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4MC8W55gFrzXf3N; Wed, 24 Aug 2022 10:02:41 +0800 (CST) Received: from dggpemm500013.china.huawei.com (7.185.36.172) by dggpemm500020.china.huawei.com (7.185.36.49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 24 Aug 2022 10:06:56 +0800 Received: from [127.0.0.1] (10.67.108.67) by dggpemm500013.china.huawei.com (7.185.36.172) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 24 Aug 2022 10:06:56 +0800 Message-ID: <3d479f53-9028-1640-985f-0fdd084c5037@huawei.com> Date: Wed, 24 Aug 2022 10:06:53 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.0 Subject: Re: [PATCH] objtool: replace _ASM_PTR with quad in macros To: Christophe Leroy , "linux-kernel@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" CC: "jpoimboe@kernel.org" , "peterz@infradead.org" , "bp@suse.de" , "mhiramat@kernel.org" , "sv@linux.ibm.com" , "naveen.n.rao@linux.vnet.ibm.com" References: <20220823133124.55914-1-chenzhongjin@huawei.com> <27c6906c-baf3-6802-9843-50b27df74a71@csgroup.eu> Content-Language: en-US From: Chen Zhongjin In-Reply-To: <27c6906c-baf3-6802-9843-50b27df74a71@csgroup.eu> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.67.108.67] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemm500013.china.huawei.com (7.185.36.172) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2022/8/24 0:47, Christophe Leroy wrote: > > Le 23/08/2022 à 15:31, Chen Zhongjin a écrit : >> Macros STACK_FRAME_NON_STANDARD and ANNOTATE_NOENDBR uses >> _ASM_PTR. It switch between .long and .quad based on 32bit >> or 64bit. However objtool doesn't work for 32bit, so _ASM_PTR >> makes no sense. >> >> Considering that _ASM_PTR comes from asm.h, which is x86 >> specific head file, while objtool.h is generic. Replace >> _ASM_PTR with quad and remove asm.h reference. > objtool is about to be used on powerpc on both PPC32 and PPC64, see > https://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=312955&state=* > > So if this part is meant to be used by all architectures, we need > nothing that also works on 32 bits, don't we ? > > Christophe > ANNOTATE_NOENDBR affects nothing because it's for x86 IBT. Leaving this macro here is harmless now, but I think maybe it's better to move this to arch-specific. The problem is STACK_FRAME_NON_STANDARD. The C version macro uses function pointer so the reloc symbol type can change between 32 and 64 bit. Although I think quad is workable for both 32 and 64 bit, and this macro is .discard so it won't affect something else, but it may not keep reloc symbol type consistency. Anyway, NO _ASM_PTR and asm.h, they are arch-specific and will break compiling on other arches. Maybe we should create a macro similar to _ASM_PTR for other arches. Till now I didn't find one. I'll send v2 patch to make this and Peter can judge. Best, Chen >> Signed-off-by: Chen Zhongjin >> --- >> include/linux/objtool.h | 6 ++---- >> tools/include/linux/objtool.h | 6 ++---- >> 2 files changed, 4 insertions(+), 8 deletions(-) >> >> diff --git a/include/linux/objtool.h b/include/linux/objtool.h >> index 62c54ffbeeaa..d2413cb78037 100644 >> --- a/include/linux/objtool.h >> +++ b/include/linux/objtool.h >> @@ -45,8 +45,6 @@ struct unwind_hint { >> >> #ifdef CONFIG_OBJTOOL >> >> -#include >> - >> #ifndef __ASSEMBLY__ >> >> #define UNWIND_HINT(sp_reg, sp_offset, type, end) \ >> @@ -87,7 +85,7 @@ struct unwind_hint { >> #define ANNOTATE_NOENDBR \ >> "986: \n\t" \ >> ".pushsection .discard.noendbr\n\t" \ >> - _ASM_PTR " 986b\n\t" \ >> + ".quad 986b\n\t" \ >> ".popsection\n\t" >> >> #define ASM_REACHABLE \ >> @@ -144,7 +142,7 @@ struct unwind_hint { >> >> .macro STACK_FRAME_NON_STANDARD func:req >> .pushsection .discard.func_stack_frame_non_standard, "aw" >> - _ASM_PTR \func >> + .quad \func >> .popsection >> .endm >> >> diff --git a/tools/include/linux/objtool.h b/tools/include/linux/objtool.h >> index 62c54ffbeeaa..d2413cb78037 100644 >> --- a/tools/include/linux/objtool.h >> +++ b/tools/include/linux/objtool.h >> @@ -45,8 +45,6 @@ struct unwind_hint { >> >> #ifdef CONFIG_OBJTOOL >> >> -#include >> - >> #ifndef __ASSEMBLY__ >> >> #define UNWIND_HINT(sp_reg, sp_offset, type, end) \ >> @@ -87,7 +85,7 @@ struct unwind_hint { >> #define ANNOTATE_NOENDBR \ >> "986: \n\t" \ >> ".pushsection .discard.noendbr\n\t" \ >> - _ASM_PTR " 986b\n\t" \ >> + ".quad 986b\n\t" \ >> ".popsection\n\t" >> >> #define ASM_REACHABLE \ >> @@ -144,7 +142,7 @@ struct unwind_hint { >> >> .macro STACK_FRAME_NON_STANDARD func:req >> .pushsection .discard.func_stack_frame_non_standard, "aw" >> - _ASM_PTR \func >> + .quad \func >> .popsection >> .endm >>