Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp1305036lqe; Mon, 8 Apr 2024 05:29:16 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUDKz6e6MzGFM6hHqMCwBt1T3W0i7l44wqvsHuVvtx1XEOhtEyi0NeZ4k1l3lSFIgN68rgwwBf0grrI5izUSNou8VG3b+zZUR2ALsw2CA== X-Google-Smtp-Source: AGHT+IGmANNjWnGe++4kCYVRDPD25RQCEpRQspWW+39DA0HuokD0lFR7Z5eIsVPJKp8ur+y/lcFe X-Received: by 2002:a05:6a20:842a:b0:1a3:a89b:a70a with SMTP id c42-20020a056a20842a00b001a3a89ba70amr8026019pzd.37.1712579356581; Mon, 08 Apr 2024 05:29:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712579356; cv=pass; d=google.com; s=arc-20160816; b=YColFrR8dvKdtM4sM4v1sto+NlvQIaTNNa30IDWpEkLQ6k/3q9Fp5+XlnlVvFqIoT+ Nxnn84BiYg+8HzPmEDL8aGwVFUC03hbiZgH4b1PD0LGuMJN+TfUbYyEuE9e8cUawwKrv KOwW8cTMXO1sC8qei9NoThzzf0f16qZ3vHxm4dt6lnJQpIgjPgrC5XdWDiAA+Bik5sPj XKGngx46W6cfklgiYMkxcOOK8FmPvklnYFzGR9KoWXsvO+Md8tm7/JpRXv6sPcPRZjXE U/yXz4MatraWC90dBmCNd2O1X2TnjUpfwGjhMxW7KA5ytfGw3ZTRRfITnVKGcscrgWxl ckiQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=4XFLlTZ7sqAhr2evVqUObGZY1eq6DtCDJp2B93uw0To=; fh=qN2EPOghN1OLZXOXxpLgsGY+FQaX8cxr5z6FdWNnd9o=; b=oXKwdMPd8iNoEnOpxcNJ4uWnStFUi3R6e2otSsS7yDeXHStGAMWGAi54TW2GTAe87G IgdJmzRuuzGHUqC8P8rQncTCz9t9JDp3fZvawEnlJqU4YPmsR/SuSQENDfCA25Ytc6a1 hjgoPTafnDvsdFdVv507fUAYfSk7+xB9i/ZHCC3mMHM8I68mOfMd2QY2g1bNmj1OAYAg tn1/xoaMbDXxjnqRwNd/1yuFB8YDvvrO4B1QIfEpEohSLUDkGbQRDk2tQM8lQ+PJVWsq bPFN5n5a3Z3dqwguXzvWd3LBmcrSXGy2LUObcJQ9L39sT95smovPwEkKhke0m/+gDE+V rcgA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=QJF7JzJY; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-135080-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-135080-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id g18-20020a631112000000b005dc8372021bsi6454932pgl.464.2024.04.08.05.29.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Apr 2024 05:29:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-135080-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=QJF7JzJY; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-135080-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-135080-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 490D0281F7E for ; Mon, 8 Apr 2024 08:50:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3BD773A1B5; Mon, 8 Apr 2024 08:49:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="QJF7JzJY" Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CA9C84D9E2 for ; Mon, 8 Apr 2024 08:49:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.92.199 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712566185; cv=none; b=A1Xs+9padG82GjGlrypD9J6lACZuSbLYWNrfMn48xHIVL+Vs/VGrq1jNiWOprOaDhC9nWe3eu6VNXfaddbLxZQuri8Fy3da0BpMxdmQ0JG7Bx8Fd724C0WE8+5Q94kBv2TDooYf/iGnIWbcq0ycuoYGq88Itq+XB+G9nWU+/igs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712566185; c=relaxed/simple; bh=ksS9V6rjZbcOz0BAzPb9ZhWVdP5vQ7O1mBkSHOoIEJ4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=JOOTo2vDvSuFrXvX5q/UkBS9L4Eoj0GKfgEnwvVH8DGkAnt56tyqe/Dzh52os0mmnsScQx+PL94vHZi4Owr4a/TCeHBNp9Yx2xiR4GFapSWx8Bfa1V2+Pl7/6DFGr0o/k1VqSs/ylaG14wkxlUTdZRo9F1NaLLZieOMkcBgkd98= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=QJF7JzJY; arc=none smtp.client-ip=90.155.92.199 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=4XFLlTZ7sqAhr2evVqUObGZY1eq6DtCDJp2B93uw0To=; b=QJF7JzJYRoCmIOdwpsHFwguU7+ uwDm0S8nc6q4Asmah0DIA31uiqxKfRN/Dl2hZpPuKGSr9gbFCmb8ey5VdV2uOdYW0ww1Qj4rb0hTX kzgwQAd529Bq+fa2L9ecRoSHtGdsTw++ybt9Bb8rywa7v70ioE2QElAcdoeI0/crQQ1L5QaODQZKW RQ0WIo77twnDnWk50iY6tx9RfE2mg5ElDf3dlM3g+feSO1Vyayxfogf6OdzjxhcszEfZ3r+LGR5/f gFl+GPv6yH4HXiWDnnfmvvXvRzSRiA8gfCL5jcNMBEwPHupXUbvgSEaH8KzhAPvG1p9Os9ieyjmTO vOtG/V1Q==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rtkh4-000000073Nx-2VnA; Mon, 08 Apr 2024 08:49:36 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 40C203002A6; Mon, 8 Apr 2024 10:49:34 +0200 (CEST) Date: Mon, 8 Apr 2024 10:49:34 +0200 From: Peter Zijlstra To: Linus Torvalds Cc: Ingo Molnar , Thomas Gleixner , Peter Anvin , the arch/x86 maintainers , Linux Kernel Mailing List Subject: Re: More annoying code generation by clang Message-ID: <20240408084934.GC21904@noisy.programming.kicks-ass.net> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Thu, Apr 04, 2024 at 03:53:49PM -0700, Linus Torvalds wrote: > diff --git a/arch/x86/include/asm/barrier.h b/arch/x86/include/asm/barrier.h > index 66e57c010392..6159d2cbbfde 100644 > --- a/arch/x86/include/asm/barrier.h > +++ b/arch/x86/include/asm/barrier.h > @@ -33,20 +33,15 @@ > * Returns: > * 0 - (index < size) > */ > +#define array_index_mask_nospec(idx,sz) ({ \ > + typeof((idx)+(sz)) __idx = (idx); \ > + typeof(__idx) __sz = (sz); \ > + typeof(__idx) __mask; \ > + asm volatile ("cmp %1,%2; sbb %0,%0" \ > + :"=r" (__mask) \ > + :"ir"(__sz),"r" (__idx) \ > + :"cc"); \ > + __mask; }) Should this not carry a comment about the "ir" constraint wanting to be "g" except for clang being daft? (I really wish clang would go fix this, it keeps coming up time and again). > > /* Prevent speculative execution past this barrier. */ > #define barrier_nospec() asm volatile("lfence":::"memory")