Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp885610pxb; Wed, 27 Oct 2021 14:28:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwGS2dvvNyPWO58uw22PErdwQ47/UCowOg+vyf5JOfGwuRIb0KTfQQ9ObWo9Rhru/6OSBtE X-Received: by 2002:a17:907:939:: with SMTP id au25mr107637ejc.166.1635369967349; Wed, 27 Oct 2021 14:26:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635369967; cv=none; d=google.com; s=arc-20160816; b=wsfm6pi2PKXyKAipuzfpX/4ybz9TnelOb6h4I5LeSWhntiYC558UP4YDnwG6iQi4VG wHdwbhMUmTfSdE1NgZAf84Ykn7Xy0rB+FAnkLy4k+zPAl71h3uZI18agepnhVuS+c6cC NvmksoVySNAuKsec+kZExGB6Z6T88tSblrqw++m3IR37eZ+XEGCEx2GChaR4xlXMkoKJ gD41Sva5AXFsfQTURVvdu4uq7Aq/l9KlqjYBEtTa5fkD2tryrijsrXP4IyckKVRIWm6b kkMVYow8o9pQd4ECX1mt8BSFS99D1kHNL2R/X3wQ0Mjj2BCAUnTsZbWe65sUceRxjeIi yarA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=qiwDhiE5qZyUEx65yCwdeMlo4Osd1LcxqqP81yccako=; b=mxZ3qyS7RDWI3uDZmqJzeBr/Up5TpOpP5MJkWTTj8ME8MrXQTi29QkF1VlN+wqAnfP JXIOug6Pz5GHFSoFJhAXJBeaqauDR571afQCjRix2BN7+wkD4JacoYyiEdYj/zxJxjPv NCpLGilrkEF75JYnv/PT0RzT4FAJfdGz1aoIN4szGp7IJBvD2tSHon/7aKpgHMIncl7m wwRxRrsegr3x/6xk8RhAAQwJZSwBpV0ouhR8KFoxvHl8gYkBAZ41XPv2wy31aQlwR95Y LflllpmyAFk8bY2T9E0KFhcVOf/oMhbj03vpuaKfscuX9yP+RmTMHDdz/wQiZ7gN0rHa 8geg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=D2e4rp2f; 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 ka2si1265942ejc.6.2021.10.27.14.25.43; Wed, 27 Oct 2021 14:26:07 -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=@infradead.org header.s=desiato.20200630 header.b=D2e4rp2f; 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 S240223AbhJ0MhF (ORCPT + 97 others); Wed, 27 Oct 2021 08:37:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240142AbhJ0MhD (ORCPT ); Wed, 27 Oct 2021 08:37:03 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 31788C061570 for ; Wed, 27 Oct 2021 05:34:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Transfer-Encoding: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description; bh=qiwDhiE5qZyUEx65yCwdeMlo4Osd1LcxqqP81yccako=; b=D2e4rp2fhx8Stgk4puwwlpXhOm 0EzkX+nWYe4hi4T9XVf1sL9f6tfjMjGKkP+hd9bw3JaOPz2XVeR3HCcNAMApQtBLpF61e1W+Ewpr2 AK6sTazD4aNkw+Veg9JpXNyhDoxp4mvhIeFhBZv72KtGYC8n5+sGWf03ZGVRFPZU3T1vk1fYRtHbw 5xMlZefpKVY16VZXRJY6Cco9k6s0yxnvsoDIL4sS4ULKKVeUMXc3QMr5ybEyaFsUP7IvQr178G3Lx BMsX2rL8r6EKUJ0q3Wn3wh2IMdpPFFSjtzTlXBi6wsF6ZgkbeCibmtD26gZWb/WMBChdiTiZsw7dZ 9hVsImMg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=worktop.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1mfi8T-00CYQA-Oe; Wed, 27 Oct 2021 12:34:30 +0000 Received: by worktop.programming.kicks-ass.net (Postfix, from userid 1000) id 520A5981FD2; Wed, 27 Oct 2021 14:34:29 +0200 (CEST) Date: Wed, 27 Oct 2021 14:34:29 +0200 From: Peter Zijlstra To: Paul =?iso-8859-1?Q?Heidekr=FCger?= Cc: paulmck@kernel.org, will@kernel.org, boqun.feng@gmail.com, stern@rowland.harvard.edu, parri.andrea@gmail.com, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, elver@google.com, charalampos.mainas@gmail.com, pramod.bhatotia@in.tum.de Subject: Re: Potentially Broken Address Dependency via test_bit() When Compiling With Clang Message-ID: <20211027123429.GE174730@worktop.programming.kicks-ass.net> References: <20211027121747.GI174703@worktop.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20211027121747.GI174703@worktop.programming.kicks-ass.net> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 27, 2021 at 02:17:48PM +0200, Peter Zijlstra wrote: > On Wed, Oct 27, 2021 at 12:19:48PM +0200, Paul Heidekr?ger wrote: > I would personally not consider this a dependend load. The result > depends on two loads, but there is no actual ordering between them. > > r1 = *x > r2 = *y > b = 1 & (r1 >> r2); > > (more or less) melver pointed out on IRC that I missed the whole BIT_WORD(nr) thing. And with that restored this should indeed be an address dependency. Still, I wasn't actually expecting test_bit() to be one. Nice find.