Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp1007361ybj; Thu, 7 May 2020 12:33:02 -0700 (PDT) X-Google-Smtp-Source: APiQypLMBQ6bkGmksNMGMdGn6/CQ7VEh16dmkyvtv7lPwebxfW+JT7f2xuWhp5jNttVISnJ0fSqV X-Received: by 2002:aa7:d3cb:: with SMTP id o11mr13031795edr.194.1588879982177; Thu, 07 May 2020 12:33:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588879982; cv=none; d=google.com; s=arc-20160816; b=br7vvTYsszWvJJXcHfPykobHvG3U4LJHEM2NbfM3NZnIHvz5J+HpJgkk7/TBI6Y2zX fxPbv63b3rMrpXHIuWamRTT1Taip/yL1fmWxv63d1umsNFPnbZBxxzbrY549KdrYWjUk EE4+Hyp444HILlx1hKANzjhQtUtwcGLq1oeyva5aqoZDAQhfUvaSCbpzaqYzEy6i68vR EyxPJnfMJ+eaEoc123YBUuGg5eUCDg1Ke4bMvoqxNLcQdFWFYJGpvumb4UfXQqx1INu1 y0dmiyeHYAS8zZ8L7C121X88muxhj6aTP4MXB9XcWvEXPntA4thZaTnYl9/pUWlZzdWx 6l2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:from:cc:to:subject :content-transfer-encoding:mime-version:references:in-reply-to :user-agent:date:dkim-signature:dkim-filter; bh=m0lAyOHoGx1k4YzTje4D7KhG9i4zH9a+UIO21JynQkA=; b=ub9v8JOGnBlbUG90FHztXICs3sCBAHLce4lXFzDvnzJhOTm0WaV+Rzl1DoIX8PqarZ W4bOt4zt2hImhThm/cQTjKufQKgzFWuq8fdWLkwnoX0FJ+GPQrLUbLQybELjpEmti+NV 0pi+SWWt7roheirhaq/tTdh9O/EjzuJdWvkkvwYnvau9EZIeIrdTm+TCGUoLS46IRoc0 OIQhghHxOlu2YYyaaCkMsztD34Q+/MwGp66zgmwcdQxeIewLpgavJ/L2xoxwIovecIaV t7EbW9PG+ARlYeHH0NJ2i8Kzx03QbF1yM+0Ti+nLQxKacN1x5i/LJltJBBaLx//mBV6r Xjcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@zytor.com header.s=2020042201 header.b=Og3DqPf6; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=zytor.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d10si3578386edx.13.2020.05.07.12.32.37; Thu, 07 May 2020 12:33:02 -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=@zytor.com header.s=2020042201 header.b=Og3DqPf6; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=zytor.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728511AbgEGTa1 (ORCPT + 99 others); Thu, 7 May 2020 15:30:27 -0400 Received: from terminus.zytor.com ([198.137.202.136]:57983 "EHLO mail.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726515AbgEGTa1 (ORCPT ); Thu, 7 May 2020 15:30:27 -0400 Received: from [IPv6:2601:646:8600:3281:6547:66ee:1a90:d675] ([IPv6:2601:646:8600:3281:6547:66ee:1a90:d675]) (authenticated bits=0) by mail.zytor.com (8.15.2/8.15.2) with ESMTPSA id 047JU6CB3526329 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NO); Thu, 7 May 2020 12:30:06 -0700 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.zytor.com 047JU6CB3526329 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2020042201; t=1588879807; bh=m0lAyOHoGx1k4YzTje4D7KhG9i4zH9a+UIO21JynQkA=; h=Date:In-Reply-To:References:Subject:To:CC:From:From; b=Og3DqPf6l861xqxWuiyPyNuU4pi97NvvW9O0+D/WT2BoIFVMYVWnz+ksirKZqnx9g 1TXrnCYHc6OwJRSiHaXpY+AlkQvr7MlkCL/6LQrXhcYfLKiS88uvFgen5pF4/fTlIa Oss3swZ5yMiS4OJCw7ALcqpzXrqnAUS8JUkvQgdR6qNFr1v0TxWhv32pUBZ8rNvnPe xJiSNWqOhsEh53wdycUGZ2qghWGVWg8Qhh67MVnwsad0X93fcBscx5A50oR2Ckgl7b 68CAfCTJEufsK5zDjpF7/mT3S7+TMNvt9BFelv4+nACgez+19fb/cSanapAW7uHDr5 1x4WdJMkY/SNQ== Date: Thu, 07 May 2020 12:29:59 -0700 User-Agent: K-9 Mail for Android In-Reply-To: References: <20200505174423.199985-1-ndesaulniers@google.com> <6A99766A-59FB-42DF-9350-80EA671A42B0@zytor.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PATCH] x86: bitops: fix build regression To: Brian Gerst CC: Nick Desaulniers , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Sedat Dilek , stable , Jesse Brandeburg , "kernelci . org bot" , Andy Shevchenko , Ilie Halip , the arch/x86 maintainers , Marco Elver , "Paul E. McKenney" , "Peter Zijlstra (Intel)" , Daniel Axtens , Masahiro Yamada , Luc Van Oostenryck , Linux Kernel Mailing List , clang-built-linux@googlegroups.com From: hpa@zytor.com Message-ID: <4AC5875F-4CCD-44D0-9DF6-76A975EC480B@zytor.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On May 7, 2020 6:32:24 AM PDT, Brian Gerst wrote: >On Thu, May 7, 2020 at 3:02 AM wrote: >> >> On May 6, 2020 11:18:09 PM PDT, Brian Gerst >wrote: >> >On Tue, May 5, 2020 at 1:47 PM Nick Desaulniers >> > wrote: >> >> >> >> From: Sedat Dilek >> >> >> >> It turns out that if your config tickles __builtin_constant_p via >> >> differences in choices to inline or not, this now produces invalid >> >> assembly: >> >> >> >> $ cat foo=2Ec >> >> long a(long b, long c) { >> >> asm("orb\t%1, %0" : "+q"(c): "r"(b)); >> >> return c; >> >> } >> >> $ gcc foo=2Ec >> >> foo=2Ec: Assembler messages: >> >> foo=2Ec:2: Error: `%rax' not allowed with `orb' >> >> >> >> The "q" constraint only has meanting on -m32 otherwise is treated >as >> >> "r"=2E >> >> >> >> This is easily reproducible via >> >Clang+CONFIG_STAGING=3Dy+CONFIG_VT6656=3Dm, >> >> or Clang+allyesconfig=2E >> >> >> >> Keep the masking operation to appease sparse (`make C=3D1`), add >back >> >the >> >> cast in order to properly select the proper 8b register alias=2E >> >> >> >> [Nick: reworded] >> >> >> >> Cc: stable@vger=2Ekernel=2Eorg >> >> Cc: Jesse Brandeburg >> >> Link: https://github=2Ecom/ClangBuiltLinux/linux/issues/961 >> >> Link: >> >https://lore=2Ekernel=2Eorg/lkml/20200504193524=2EGA221287@google=2Eco= m/ >> >> Fixes: 1651e700664b4 ("x86: Fix bitops=2Eh warning with a moved >cast") >> >> Reported-by: Sedat Dilek >> >> Reported-by: kernelci=2Eorg bot >> >> Suggested-by: Andy Shevchenko >> >> Suggested-by: Ilie Halip >> >> Tested-by: Sedat Dilek >> >> Signed-off-by: Sedat Dilek >> >> Signed-off-by: Nick Desaulniers >> >> --- >> >> arch/x86/include/asm/bitops=2Eh | 4 ++-- >> >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> >> >> diff --git a/arch/x86/include/asm/bitops=2Eh >> >b/arch/x86/include/asm/bitops=2Eh >> >> index b392571c1f1d=2E=2E139122e5b25b 100644 >> >> --- a/arch/x86/include/asm/bitops=2Eh >> >> +++ b/arch/x86/include/asm/bitops=2Eh >> >> @@ -54,7 +54,7 @@ arch_set_bit(long nr, volatile unsigned long >*addr) >> >> if (__builtin_constant_p(nr)) { >> >> asm volatile(LOCK_PREFIX "orb %1,%0" >> >> : CONST_MASK_ADDR(nr, addr) >> >> - : "iq" (CONST_MASK(nr) & 0xff) >> >> + : "iq" ((u8)(CONST_MASK(nr) & 0xff)) >> > >> >I think a better fix would be to make CONST_MASK() return a u8 value >> >rather than have to cast on every use=2E >> > >> >Also I question the need for the "q" constraint=2E It was added in >> >commit 437a0a54 as a workaround for GCC 3=2E4=2E4=2E Now that the min= imum >> >GCC version is 4=2E6, is this still necessary? >> > >> >-- >> >Brian Gerst >> >> Yes, "q" is needed on i386=2E > >I think the bug this worked around was that the compiler didn't detect >that CONST_MASK(nr) was also constant and doesn't need to be put into >a register=2E The question is does that bug still exist on compiler >versions we care about? > >-- >Brian Gerst The compiler is free to do that, including for legit reasons (common subex= pression elimination, especially=2E) So yes=2E --=20 Sent from my Android device with K-9 Mail=2E Please excuse my brevity=2E