Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp692760ybh; Sun, 12 Jul 2020 20:59:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzspnieuaK3cRMuCyXxaU2PNUv9YzNn8ULU4+mJF+J/mvep9Zge+fWq3iU8r223RZXj47FB X-Received: by 2002:a17:906:5909:: with SMTP id h9mr71174220ejq.501.1594612794474; Sun, 12 Jul 2020 20:59:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594612794; cv=none; d=google.com; s=arc-20160816; b=z6xUO+R3A78J8UuKTxd0wG/f9H8rA+uH4rJGpNhMWC2aT2pEKCamPMkajiVIECPMU2 HOOX8MN73T3+lwc0tcs43lB4qaWd6dudRA0hCAeE5AVqzglrQQzbOL3q5wjGpAZc1tkN WLfCG4TRHz+U5B83n7BedX3WqkvDZjwDBZPxgnrjlmHKpUS/23WQHuJZ2UKXXiT6FI+v ku7blOvl/AIcAcKWlJndO5klmjouq/FHGfQX7CkMq1BzMWkjs961ZgM3vp5vlLyhzrfJ xqqr9MxZcK/YFikYitagXfi5Lx64EVUzcGBUfG/Bxd9rlhif0POZH+rFQbYrznybhb/r 5ydQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:date:from :dkim-signature; bh=OS6lj7NOuRAN0ATW8vraVLjweCwqIGD2clKFwyyRfmk=; b=SUIskUkY2/kKHoDL2aCEjVgnPUSadJwISl0BBfCFYPS9al6mpFVwI3re+fbi3mbkk3 5kMc6BWRs1LadABgqbVLIii9lKsxxPgF7eM99Oa/4N5maTsBgbY5gE2FEqJ2SGVKgmV7 jo3q+AGsd0d5Eg4AhbyDtJdG0P2rSMjt9LaZdumlcW5U+wIDgtNcPW34iXaV66NRHyzf K6+mngYDr6nnu4Gq4c3OuXd0FrbdvlgAuGTErOsTggGG3VmFknxIAq2zhs3culQVe3NN /HHySjxMUUmBaES4+ZDk4JahcZl7tGlz2iiWKjRri2pkcNxRLtNHuRBMtb2mf/QRhUMt P0Dg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=RyUFAiLo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dp17si11195254ejc.285.2020.07.12.20.59.31; Sun, 12 Jul 2020 20:59:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=RyUFAiLo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728662AbgGMD51 (ORCPT + 99 others); Sun, 12 Jul 2020 23:57:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726465AbgGMD51 (ORCPT ); Sun, 12 Jul 2020 23:57:27 -0400 Received: from mail-qk1-x744.google.com (mail-qk1-x744.google.com [IPv6:2607:f8b0:4864:20::744]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53BE0C061794 for ; Sun, 12 Jul 2020 20:57:27 -0700 (PDT) Received: by mail-qk1-x744.google.com with SMTP id k18so11003604qke.4 for ; Sun, 12 Jul 2020 20:57:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:date:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=OS6lj7NOuRAN0ATW8vraVLjweCwqIGD2clKFwyyRfmk=; b=RyUFAiLoLz9jmksQ2ngCPPEL3c7YGMgAy1g0UxGB+6aT5rhTvwO4oknu28Vr7oxpYX R2Ihgkxufu13Oj23JrgqGsDB/FRhGOSBbjW3riqx4ai8dQOSd9dTtybnW+J9bLtql+m0 64vIK5/0oOFxzK1x6Kvy6j9MkWu6pFeTE9InA4a7TShX14YIxSOkSMLtpvJoemvLoh5I pAEFwItdxtR5UzofOyElQWvbriHWS4Llx6PSNqIOTBCwuZ1TkMAbGnuy0cN+CVxdYRbV wNUxHqnFdWddGt9CuBFYviys4ndO3Pg+8D8nwrPMa0ureshRA8mcy/w9GtslTj6CKnc0 WJHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:date:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=OS6lj7NOuRAN0ATW8vraVLjweCwqIGD2clKFwyyRfmk=; b=dzqNK9KsHJoehe678dR7NRILJPwHhwVKU6vj/a03hiA81IOIOwB5c5S+WdSLejYbl0 J69AWO1lHMTpfOYRyrxQYvUH+R1XpnofI0ftK/dXtqxM/9ZajtuHIMu6pBAS2M0yvK3B lWO1q3Ca/McxXpMTI3dAiDuAqZTlFUyNdwEVJOlwf09orauUU8xkXtPWCKSqii6ExfnM GPCEU/oPsulaZ59TjJK1iTzyRiiYJuOnCFYjWix1uui8sN/tgDyqpfQ57MAZE5Td2k8p 5DWn2Advahwb74FUkj1mIKm0nV5TsY3KeixYTQA6CYhpSTp98X6K3xkF0iC850LztJSi oKrw== X-Gm-Message-State: AOAM533Z8Qjhh60Rk5hg8Qp8Yr0hSi34JLoDT5vDBRFifr3B9aOBS5aP CwArXbi+qNMa/PBF4qdtxO8= X-Received: by 2002:ae9:ee06:: with SMTP id i6mr69626943qkg.132.1594612646351; Sun, 12 Jul 2020 20:57:26 -0700 (PDT) Received: from rani.riverdale.lan ([2001:470:1f07:5f3::b55f]) by smtp.gmail.com with ESMTPSA id z60sm17212288qtc.30.2020.07.12.20.57.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Jul 2020 20:57:25 -0700 (PDT) From: Arvind Sankar X-Google-Original-From: Arvind Sankar Date: Sun, 12 Jul 2020 23:57:23 -0400 To: Arvind Sankar Cc: Jian Cai , jiancai@google.com, ndesaulniers@google.com, manojgupta@google.com, sedat.dilek@gmail.com, Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" , Andy Lutomirski , Peter Zijlstra , Alexandre Chartre , linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com Subject: Re: [PATCH] x86/entry: add compatibility with IAS Message-ID: <20200713035723.GA874450@rani.riverdale.lan> References: <20200713012428.1039487-1-caij2003@gmail.com> <20200713025429.GA704795@rani.riverdale.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200713025429.GA704795@rani.riverdale.lan> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jul 12, 2020 at 10:54:29PM -0400, Arvind Sankar wrote: > On Sun, Jul 12, 2020 at 06:24:22PM -0700, Jian Cai wrote: > > Clang's integrated assembler does not allow symbols with non-absolute > > values to be reassigned. This patch allows the affected code to be > > compatible with IAS. > > > > Link: https://github.com/ClangBuiltLinux/linux/issues/1043 > > Reported-by: Nick Desaulniers > > Reported-by: Sedat Dilek > > Suggested-by: Nick Desaulniers > > Tested-by: Sedat Dilek > > Signed-off-by: Jian Cai > > --- > > arch/x86/include/asm/idtentry.h | 22 ++++++++++------------ > > 1 file changed, 10 insertions(+), 12 deletions(-) > > > > diff --git a/arch/x86/include/asm/idtentry.h b/arch/x86/include/asm/idtentry.h > > index f3d70830bf2a..77beed2cd6d9 100644 > > --- a/arch/x86/include/asm/idtentry.h > > +++ b/arch/x86/include/asm/idtentry.h > > @@ -468,34 +468,32 @@ __visible noinstr void func(struct pt_regs *regs, \ > > */ > > .align 8 > > SYM_CODE_START(irq_entries_start) > > - vector=FIRST_EXTERNAL_VECTOR > > - pos = . > > + i = 1 > > + pos1 = . > > .rept (FIRST_SYSTEM_VECTOR - FIRST_EXTERNAL_VECTOR) > > UNWIND_HINT_IRET_REGS > > - .byte 0x6a, vector > > + .byte 0x6a, FIRST_EXTERNAL_VECTOR + i - 1 > > jmp asm_common_interrupt > > nop > > /* Ensure that the above is 8 bytes max */ > > - . = pos + 8 > > - pos=pos+8 > > - vector=vector+1 > > + . = pos1 + 8 * i > > + i = i + 1 > > .endr > > SYM_CODE_END(irq_entries_start) > > I think it would be a little cleaner to initialize i to 0, and drop pos. > i.e. couldn't we do > i = 0 > ... > .byte 0x6a, FIRST_EXTERNAL_VECTOR + i > ... > i = i + 1 > . = irq_entries_start + 8 * i > Or maybe just: diff --git a/arch/x86/include/asm/idtentry.h b/arch/x86/include/asm/idtentry.h index eeac6dc2adaa..c774039d130b 100644 --- a/arch/x86/include/asm/idtentry.h +++ b/arch/x86/include/asm/idtentry.h @@ -469,15 +469,14 @@ __visible noinstr void func(struct pt_regs *regs, \ .align 8 SYM_CODE_START(irq_entries_start) vector=FIRST_EXTERNAL_VECTOR - pos = . .rept (FIRST_SYSTEM_VECTOR - FIRST_EXTERNAL_VECTOR) + 0: UNWIND_HINT_IRET_REGS .byte 0x6a, vector jmp asm_common_interrupt nop /* Ensure that the above is 8 bytes max */ - . = pos + 8 - pos=pos+8 + . = 0b + 8 vector=vector+1 .endr SYM_CODE_END(irq_entries_start) @@ -486,15 +485,14 @@ SYM_CODE_END(irq_entries_start) .align 8 SYM_CODE_START(spurious_entries_start) vector=FIRST_SYSTEM_VECTOR - pos = . .rept (NR_VECTORS - FIRST_SYSTEM_VECTOR) + 0: UNWIND_HINT_IRET_REGS .byte 0x6a, vector jmp asm_spurious_interrupt nop /* Ensure that the above is 8 bytes max */ - . = pos + 8 - pos=pos+8 + . = 0b + 8 vector=vector+1 .endr SYM_CODE_END(spurious_entries_start)