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=-16.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, USER_AGENT_SANE_1 autolearn=ham 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 C5985C432BE for ; Wed, 1 Sep 2021 00:23:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 97AE36103D for ; Wed, 1 Sep 2021 00:23:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241431AbhIAAYG (ORCPT ); Tue, 31 Aug 2021 20:24:06 -0400 Received: from out30-42.freemail.mail.aliyun.com ([115.124.30.42]:41340 "EHLO out30-42.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231249AbhIAAYE (ORCPT ); Tue, 31 Aug 2021 20:24:04 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R201e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04423;MF=laijs@linux.alibaba.com;NM=1;PH=DS;RN=9;SR=0;TI=SMTPD_---0UmncIwp_1630455786; Received: from C02XQCBJJG5H.local(mailfrom:laijs@linux.alibaba.com fp:SMTPD_---0UmncIwp_1630455786) by smtp.aliyun-inc.com(127.0.0.1); Wed, 01 Sep 2021 08:23:07 +0800 Subject: Re: [PATCH 05/24] x86/entry: Introduce __entry_text for entry code written in C To: Peter Zijlstra , Lai Jiangshan Cc: linux-kernel@vger.kernel.org, Andy Lutomirski , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" References: <20210831175025.27570-1-jiangshanlai@gmail.com> <20210831175025.27570-6-jiangshanlai@gmail.com> <20210831193430.GL4353@worktop.programming.kicks-ass.net> From: Lai Jiangshan Message-ID: <75312407-36e9-b3da-f7a3-0aabe09ed1ae@linux.alibaba.com> Date: Wed, 1 Sep 2021 08:23:06 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <20210831193430.GL4353@worktop.programming.kicks-ass.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021/9/1 03:34, Peter Zijlstra wrote: > On Wed, Sep 01, 2021 at 01:50:06AM +0800, Lai Jiangshan wrote: >> From: Lai Jiangshan >> >> Some entry code will be implemented in traps.c. We need __entry_text >> to set them in .entry.text section. >> >> Signed-off-by: Lai Jiangshan >> --- >> arch/x86/entry/traps.c | 5 +++++ >> 1 file changed, 5 insertions(+) >> >> diff --git a/arch/x86/entry/traps.c b/arch/x86/entry/traps.c >> index f71db7934f90..ef07ae5fb3a0 100644 >> --- a/arch/x86/entry/traps.c >> +++ b/arch/x86/entry/traps.c >> @@ -69,6 +69,11 @@ >> extern unsigned char native_irq_return_iret[]; >> extern unsigned char asm_load_gs_index_gs_change[]; >> >> +/* Entry code written in C. Must be only used in traps.c */ >> +#define __entry_text \ >> + noinline notrace __attribute((__section__(".entry.text"))) \ >> + __no_kcsan __no_sanitize_address __no_profile __no_sanitize_coverage > > Urgh, that's bound to get out of sync with noinstr.. How about you make > noinstr something like: > > #define __noinstr_section(section) \ > noinline notrace __attribute((__section__(section))) \ > __no_kcsan __no_sanitize_address __no_profile __no_sanitize_coverage > > #define noinstr __noinstr_section(".noinstr.text") > > and then write the above like: > > #define __entry_text __noinstr_section(".entry.text") It is a good idea. There was no "__no_profile __no_sanitize_coverage" when I first made the patch several month ago. I added it after I recheck the definition of "noinstr" yesterday which means we really need __noinstr_section() to keep them sync. >