Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp1990348ybj; Wed, 6 May 2020 08:44:49 -0700 (PDT) X-Google-Smtp-Source: APiQypJYSTZ1eISfjakfoRYNDrdhgrFH+wvaOiXwlrH4Ee4E+p/JrT5BYsy0pE7gSRKH+yFU9AUi X-Received: by 2002:a05:6402:8c9:: with SMTP id d9mr7339116edz.357.1588779889825; Wed, 06 May 2020 08:44:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588779889; cv=none; d=google.com; s=arc-20160816; b=W1U7pfkkZJC+svm1QRyAoGrR+DsNEcZLYJ529WBLkv69mLbVD5dd3vzQpCnzl9haKa ZHXc9AqylkUIgLLn3ye4V3V/FGD+KusRW9fZ3U9GUUzDagvc2fIIzMTSXXTEiAwzdqy4 dsSvVdKYQcyzp+vkc2vBCOmUf/GrIA+feHKFMRyw5iyuxmGiXwfb7qDSUgy2lTPQ3fw+ zMqhEswxJ8VNeQ4M6mY3YVqAdTpSHdrM3gsFYxofGvGhKyY4s0hHKiK8MKKyow6vkZS9 aSbSBWpXdInKyahOWjRAblhZurIsgHb5rkQxxzS79F8t6i5JOkFrHia9LkIh/+0EVnR1 3XwQ== 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:from:date :dkim-signature; bh=/4Bf7uYJizHHCHu/IYW7D03zmrwhqK6qEQ4Buf+txbw=; b=BM+lodJQSSXB0bHAvkNVKU+TNlGa/Lcb2hVpWkfyj1M/hyC7JXpM7X9zgMK1LTXmed XWw8uUmeSGf3eFMi11vzbSU2rXChNAiQZX39ldO6cURESFsu3ihOZd9KweNRxnBwYfpf kC4NkVzqIYw2UbwTxHmP42WIJQUv8bBP8xhcR+pnR0Ec4OMn96ISkGhjz+1RxT587gNH yQTSHhQFyMcWMsiCV6bDFy2lhIrhlW95SDbjqnxOdAnltVNGWH+1TJk87DgbhKQGy004 AZiEYWudzaxFLij859f/uOJxb1XZWWOhxYDBdqZnVNUVCuHY9HPDRdgXf3HoYCrtV67+ DdBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=O41+Bmx8; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dv11si1422504ejb.136.2020.05.06.08.44.26; Wed, 06 May 2020 08:44:49 -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=pass header.i=@gmail.com header.s=20161025 header.b=O41+Bmx8; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729758AbgEFPl6 (ORCPT + 99 others); Wed, 6 May 2020 11:41:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729668AbgEFPlw (ORCPT ); Wed, 6 May 2020 11:41:52 -0400 Received: from mail-ot1-x344.google.com (mail-ot1-x344.google.com [IPv6:2607:f8b0:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B828BC061A0F; Wed, 6 May 2020 08:41:51 -0700 (PDT) Received: by mail-ot1-x344.google.com with SMTP id e20so1695319otk.12; Wed, 06 May 2020 08:41:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=/4Bf7uYJizHHCHu/IYW7D03zmrwhqK6qEQ4Buf+txbw=; b=O41+Bmx8B9NB10qlOMxkKc0/Rv3M6Si5CS/dzS1zYHq3s3oh4P78J7myxdWBSa8y7s TD5F8clLMBWSS1ZLwUnEC80SEY2vxP/eG5egZesXB3oTOocuQV8YKmYGSHFexTzy0lQA x6c14L+ldRqF5Nd/eK3gLz7QSa2FI5PiEnU0D8seFKuPxVS/oBHGIha5cS/7p9Mouuqe THcE6aPAzEfYI65zy/Ffx4s5unLOIJsNqQTlboU+HHBE1Grx2Ouxkr8TIdBtuUd2PCjM 4f0tdzFCeGgvCPpfNRoGlgdhQY/+lGA6IoNjql+Ks0i2xqgQYonpZV09sQOuXW/qsynV NnqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=/4Bf7uYJizHHCHu/IYW7D03zmrwhqK6qEQ4Buf+txbw=; b=snOQJvCxRngpebz6HC0Kjk20I6iK1mEENBfM+7I0Xv/ZOP3lbGcEdUM6kv850bBhRe wHIMNFK3G8ZaQJQuxLUqWWtVhTCmnyt2Pu/mL0S+UUMOgZLpun3p4hXni5rGP7JoQMx+ gXexA82wr1Vn+/vaZNabk8RR3Zx2+iHLig8q8STf/lFqxIfkEczJCE8WhM0EG4NfOKkW d6R174ZVXwiWbhPsstmLxLa2/noMcxCcVhfMaVP9G7ZD8pxQwtXRGO8hq/50Z+tqtCbr y6AK4JT8uL/y8eaHh0fA2rE8qTCUOLkcxPNKXKDjb84IGMRrIJMTezD4rxxy+56TKORm sgSA== X-Gm-Message-State: AGi0Puay2YBpaucN9nnfhh0zgdkwwXKX0n0qEuc4d9XhGHzjtFsaJNyP wmLj9RWaTJzwTY+6rbzr5gk= X-Received: by 2002:a9d:569:: with SMTP id 96mr6710053otw.59.1588779710938; Wed, 06 May 2020 08:41:50 -0700 (PDT) Received: from ubuntu-s3-xlarge-x86 ([2604:1380:4111:8b00::1]) by smtp.gmail.com with ESMTPSA id k19sm655259oof.33.2020.05.06.08.41.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 May 2020 08:41:50 -0700 (PDT) Date: Wed, 6 May 2020 08:41:48 -0700 From: Nathan Chancellor To: Nick Desaulniers Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Sedat Dilek , stable@vger.kernel.org, Jesse Brandeburg , "kernelci . org bot" , Andy Shevchenko , Ilie Halip , x86@kernel.org, "H. Peter Anvin" , Marco Elver , "Paul E. McKenney" , "Peter Zijlstra (Intel)" , Daniel Axtens , Masahiro Yamada , Luc Van Oostenryck , linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com Subject: Re: [PATCH] x86: bitops: fix build regression Message-ID: <20200506154148.GC1213645@ubuntu-s3-xlarge-x86> References: <20200505174423.199985-1-ndesaulniers@google.com> <20200506043028.GA663805@ubuntu-s3-xlarge-x86> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200506043028.GA663805@ubuntu-s3-xlarge-x86> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 05, 2020 at 09:30:28PM -0700, Nathan Chancellor wrote: > On Tue, May 05, 2020 at 10:44:22AM -0700, 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.c > > long a(long b, long c) { > > asm("orb\t%1, %0" : "+q"(c): "r"(b)); > > return c; > > } > > $ gcc foo.c > > foo.c: Assembler messages: > > foo.c:2: Error: `%rax' not allowed with `orb' > > > > The "q" constraint only has meanting on -m32 otherwise is treated as > > "r". > > > > This is easily reproducible via Clang+CONFIG_STAGING=y+CONFIG_VT6656=m, > > or Clang+allyesconfig. > > For what it's worth, I don't see this with allyesconfig. > > > Keep the masking operation to appease sparse (`make C=1`), add back the > > cast in order to properly select the proper 8b register alias. > > > > [Nick: reworded] > > > > Cc: stable@vger.kernel.org > > The offending commit was added in 5.7-rc1; we shouldn't need to > Cc stable since this should be picked up as an -rc fix. > > > Cc: Jesse Brandeburg > > Link: https://github.com/ClangBuiltLinux/linux/issues/961 > > Link: https://lore.kernel.org/lkml/20200504193524.GA221287@google.com/ > > Fixes: 1651e700664b4 ("x86: Fix bitops.h warning with a moved cast") > > Reported-by: Sedat Dilek > > Reported-by: kernelci.org bot > > Suggested-by: Andy Shevchenko > > Suggested-by: Ilie Halip > > Not to split hairs but this is Ilie's diff, he should probably be the > author with Sedat's Reported-by/Tested-by. > > https://github.com/ClangBuiltLinux/linux/issues/961#issuecomment-608239458 > > But eh, it's all a team effort plus that can only happen with Ilie's > explicit consent for a Signed-off-by. > > I am currently doing a set of builds with clang-11 with this patch on > top of 5.7-rc4 to make sure that all of the cases I have found work. > Once that is done, I'll comment back with a tag. Reviewed-by: Nathan Chancellor Tested-by: Nathan Chancellor # build > > Tested-by: Sedat Dilek > > Signed-off-by: Sedat Dilek > > Signed-off-by: Nick Desaulniers > > --- > > arch/x86/include/asm/bitops.h | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/arch/x86/include/asm/bitops.h b/arch/x86/include/asm/bitops.h > > index b392571c1f1d..139122e5b25b 100644 > > --- a/arch/x86/include/asm/bitops.h > > +++ b/arch/x86/include/asm/bitops.h > > @@ -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)) > > : "memory"); > > } else { > > asm volatile(LOCK_PREFIX __ASM_SIZE(bts) " %1,%0" > > @@ -74,7 +74,7 @@ arch_clear_bit(long nr, volatile unsigned long *addr) > > if (__builtin_constant_p(nr)) { > > asm volatile(LOCK_PREFIX "andb %1,%0" > > : CONST_MASK_ADDR(nr, addr) > > - : "iq" (CONST_MASK(nr) ^ 0xff)); > > + : "iq" ((u8)(CONST_MASK(nr) ^ 0xff))); > > } else { > > asm volatile(LOCK_PREFIX __ASM_SIZE(btr) " %1,%0" > > : : RLONG_ADDR(addr), "Ir" (nr) : "memory"); > > -- > > 2.26.2.526.g744177e7f7-goog > > > > Cheers, > Nathan