Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp757955ybj; Thu, 7 May 2020 07:02:40 -0700 (PDT) X-Google-Smtp-Source: APiQypLD8j6oCrWbpzip7zFg4htt2OHHWNTvjJ89FsYcr9PoeI7twzBWd0uUuhhth7BOQxvEk+nT X-Received: by 2002:a05:600c:2284:: with SMTP id 4mr9994348wmf.97.1588860160726; Thu, 07 May 2020 07:02:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588860160; cv=none; d=google.com; s=arc-20160816; b=Ix7nVGUVU2yTK62EjcKn4vpSIy4QMx0h7+1NDN4mLcZs2NPZTohIKQyBYkyThYH0lf SZ/8gVYOs66131JoTjNtQkKLvVeDWYhOwm+YB46dmM4k/BmVPIPq19mNSgTDzC/K6wkW aGvchxeV3yOiqya+jT3yhyUSOCDQuhXEeY4cjHuhMnGxM+8HQ1ShnXHjZekgM8wWAoQH +TGMzbFt8oPG3sSN9V7zIRRW0Nu7QFf2EP2gjo03+yckC1UuVMLk6EDIQpbuiOELZ9T2 MxQFEhTIdYNVlMzezo0nRKrPm9wGNbutOOxxTD8Z+G4ANdQpyTvjCSPbBw0RyyAOyog2 zbCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=qCROg/3G32jM70VIbenT2kiJn/D6JsTc3S4qZv2ZxH8=; b=iCrS3jdur9G2uvLmNL+ZHajOP6yNcmNra1Gj62ZVStNpVs4NrGiz0AWbNT/xyHEaHp Je+qnQOXCwaTi5I1pKI1S5+VgR5nJ3vKA1p+NIFpvVUn/zIgr/IqKu362XK14+QPBkpE 3gWWZngY9VV3iie9f3QY/qk/2JhS44Yyp7NfYFXqhIqZexooBNcE+DOKnVwY7GS1KNrp ws3j7aCsjZCnD272IMduuVZXk4mTldax19Ur0yBpU0xIuEM3wGue6JEuhLeEpSxZZZ6g wr0dO+nCgGuFn2euwvKNViPMC+amYYrwaNF4kw2g9csvjnBRcFhFo1PGoViux6vNiPAM JuJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=JC3IYpfp; 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 o17si3234024edv.44.2020.05.07.07.02.12; Thu, 07 May 2020 07:02:40 -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=JC3IYpfp; 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 S1726518AbgEGOA2 (ORCPT + 99 others); Thu, 7 May 2020 10:00:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725947AbgEGOA2 (ORCPT ); Thu, 7 May 2020 10:00:28 -0400 Received: from mail-io1-xd42.google.com (mail-io1-xd42.google.com [IPv6:2607:f8b0:4864:20::d42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2125EC05BD43; Thu, 7 May 2020 07:00:28 -0700 (PDT) Received: by mail-io1-xd42.google.com with SMTP id 19so552928ioz.10; Thu, 07 May 2020 07:00:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=qCROg/3G32jM70VIbenT2kiJn/D6JsTc3S4qZv2ZxH8=; b=JC3IYpfpubvJXlRItx/zmIvRRqwTzlqF/cOmXZ/39Q+O7RJzOJ9fvlLax/MlV9RWgK ObH+uqTxqr6B0vhElIBX7EN7KCL87xUdIED9r4OQpGaQ2bFe3i9FDcRoITmVgNM9cF4Y 8+W2fjWtOs95m/giIJ7gjcdHVZz/rQKk68kY+Q23Q86w46tEPDRQE3SN/ekxvf6ybcah 3QFwghREZ+vHDgQcWWdF4aou0SAS0BAckUOQ8anWppBNm04IJj6WyZECXA1JgwpwwyP3 63GaU9YpWFw8BGqQd+4GJrNdKO8lf2dz/Xp9aDsC0CnDhhTZU8id5hr8JtCnr+uWIXmk jJEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=qCROg/3G32jM70VIbenT2kiJn/D6JsTc3S4qZv2ZxH8=; b=PalSGVpu/MizOWSE4yQ+GwAw+39KysNPbpF5MUjr8Nq2mReHgSrND8EkSmSu221c2I AcBpN63jJwx0lMrAWYFIXAXtzB2ytL6bsVxVA/KsSRbUEFePiwHVU+sBQxK494w3BUwO YxatGr6+bkrb0nVY2tL+/3sqFbEDKhy7DupZ93Cw416IYY/ERoDvM2cE2aemLa2mFD6O hQGlMdLo6f6MWltTDku/jPW5lMj/4L0Na2a6R+aVskzTlFhv4fy+He2V6xZWTJBn0gpG MdiHbfOXcD5FZeLAAfma0+M7I4/51gqdVxtVLEgX3IznhvMzviHFXHUrE1xHlfnz1jRZ UdJA== X-Gm-Message-State: AGi0PubJUIWRaAzcC7eQAOLEnNHVWpmSRM2Q4Ijs8PaWiKeCbj7o48xe WpIPMyEVLetzcyDId/2pez5BTAArhorQ5TmZEw== X-Received: by 2002:a05:6638:f0f:: with SMTP id h15mr14465368jas.142.1588860027498; Thu, 07 May 2020 07:00:27 -0700 (PDT) MIME-Version: 1.0 References: <20200505174423.199985-1-ndesaulniers@google.com> <8A776DBC-03AF-485B-9AA6-5920E3C4ACB2@zytor.com> <20200507113422.GA3762@hirez.programming.kicks-ass.net> In-Reply-To: <20200507113422.GA3762@hirez.programming.kicks-ass.net> From: Brian Gerst Date: Thu, 7 May 2020 10:00:16 -0400 Message-ID: Subject: Re: [PATCH] x86: bitops: fix build regression To: Peter Zijlstra Cc: "H. Peter Anvin" , 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" , Daniel Axtens , Masahiro Yamada , Luc Van Oostenryck , Linux Kernel Mailing List , clang-built-linux@googlegroups.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 7, 2020 at 7:38 AM Peter Zijlstra wrote: > > On Tue, May 05, 2020 at 11:07:24AM -0700, hpa@zytor.com wrote: > > On May 5, 2020 10:44:22 AM PDT, Nick Desaulniers wrote: > > > >@@ -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"); > > > > Drop & 0xff and change ^ 0xff to ~. > > But then we're back to sparse being unhappy, no? The thing with ~ is > that it will set high bits which will be truncated, which makes sparse > sad. This change will make sparse happy and allow these cleanups: #define CONST_MASK(nr) ((u8)1 << ((nr) & 7)) Tested with GCC 9.3.1. -- Brian Gerst