Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4049198ybl; Mon, 13 Jan 2020 07:03:34 -0800 (PST) X-Google-Smtp-Source: APXvYqw6m8HrR6Vw0rIyk1limb9svA1wn4ywe+eXpxN2YNtcxeb1rpY5n84fyOuJBi0eaIKIRkgj X-Received: by 2002:a05:6830:10d5:: with SMTP id z21mr14065335oto.30.1578927814014; Mon, 13 Jan 2020 07:03:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578927814; cv=none; d=google.com; s=arc-20160816; b=PuSUv/674RboC4ctZ9FqsXhhaFElhilA5P57jA/rQ9YiT+KyETE2iIcAx6LFgqjZBE UmVNcztYjmILU0q9hjWYfeRENIaeDWopePJmYmwk5oxdZqwnfmYE7QNPpnk/af1yC+Rh Iqbi4MCS/wRJrv1lobu3rftighq0eHFGll0FZ4dz3oxtJLtnZSmfnDKGsvBmRSRYJ1fc Ttjzfdp0I9ZPzGAgoPZtUOD6iWrDGNMvcylYAygBa4Vz9rFhqge+f75+5EGZHIzLe5xw xmBEpgHubQn2CdvZYyGdgMW1StWV/kDYoyJoPiFdnElKJP6zdxz9xLIrMIQ+2zdVeOpE +07g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=y2PhXnFKo8z4dcGmlk5GFPIWjK6wxsMEPvSHSZ/9I4U=; b=AeZvYqBmKPKhCFh61EGnpDE1ttQuBsqQRfIClQRWuEkhZVI/E9CRWPVG3FtQaXSn8k IaTu5k+nLO4fITATVwRwswEQOfP0BA9K/JzrDei1+JKYpBA0aybchYjKLbT5tLZTYTG8 qCvKVmk4nhDW+u/pZBHPftYD6sAE+rREaQFEMla5kVFJi5T+YD5w6DL8WFMCETUl51nE 7umSBNjujNX6tI2Uc8NpuLirCLXpVqlwfED4GYDYpvFr+5X8pn1ukbKfaOG7Ol3w7X3k 0EQ+T/L5lyjKuDkL6Mz7YYGt4Mj/IPaItA3TLN+Ju32U0CP7fwLYGKYDrUxW5IDwixuD /lsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=yil8Uwhm; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v12si7035815otn.193.2020.01.13.07.03.21; Mon, 13 Jan 2020 07:03:34 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=yil8Uwhm; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728885AbgAMPB5 (ORCPT + 99 others); Mon, 13 Jan 2020 10:01:57 -0500 Received: from mail.kernel.org ([198.145.29.99]:35962 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728512AbgAMPB5 (ORCPT ); Mon, 13 Jan 2020 10:01:57 -0500 Received: from willie-the-truck (236.31.169.217.in-addr.arpa [217.169.31.236]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 18E7F21556; Mon, 13 Jan 2020 15:01:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578927716; bh=IwFnZ0iS2TqcsY4ZJUrAuecFC99O9aKSSg5OWPi/iHY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=yil8UwhmgUW1I5DUpfw5Wf2O/odBx0QvZpNz4/fkshx9BKVq4jS2366ElerA4s2yz +AFTww45L2YrUS4PiG0Spnvcquaro7Ll9/UlM58xtWjbfBHCcoVGwYMuX+h97YQG5o 9i/iIqU+7TAIPFacWTIoj+p4e2aBsRPtm+I9VwSU= Date: Mon, 13 Jan 2020 15:01:52 +0000 From: Will Deacon To: Arnd Bergmann Cc: "linux-kernel@vger.kernel.org" , linux-arch , Android Kernel Team , Michael Ellerman , Peter Zijlstra , Linus Torvalds , Segher Boessenkool , Christian Borntraeger , Luc Van Oostenryck Subject: Re: [RFC PATCH 7/8] locking/barriers: Use '__unqual_scalar_typeof' for load-acquire macros Message-ID: <20200113150151.GC4458@willie-the-truck> References: <20200110165636.28035-1-will@kernel.org> <20200110165636.28035-8-will@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 10, 2020 at 08:42:37PM +0100, Arnd Bergmann wrote: > On Fri, Jan 10, 2020 at 5:57 PM Will Deacon wrote: > > > @@ -128,10 +128,10 @@ do { \ > > #ifndef __smp_load_acquire > > #define __smp_load_acquire(p) \ > > ({ \ > > - typeof(*p) ___p1 = READ_ONCE(*p); \ > > + __unqual_scalar_typeof(*p) ___p1 = READ_ONCE(*p); \ > > compiletime_assert_atomic_type(*p); \ > > __smp_mb(); \ > > - ___p1; \ > > + (typeof(*p))___p1; \ > > }) > > Doesn't that last (typeof(*p))___p1 mean you put the potential > 'volatile' back on the assignment after you went through the > effort of taking it out? Yes, but that's ok wrt codegen since the local variable isn't volatile, and I definitely ran into issues with 'const' if I returned the unqualified type here. Will