Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1036257ybl; Fri, 10 Jan 2020 10:57:21 -0800 (PST) X-Google-Smtp-Source: APXvYqzsBBgpBxyopeBAVcVv07MTnN+UmfgEyfqs5bWxgqit/WyouUk3QH5FSNCdfJzKUhqQSVOw X-Received: by 2002:a05:6808:6c5:: with SMTP id m5mr3183758oih.106.1578682641675; Fri, 10 Jan 2020 10:57:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578682641; cv=none; d=google.com; s=arc-20160816; b=sXa9tCStfYMt2V1WxL9aMTm7U+R4Q4sZTRa0pepfQjtd8dI4Z3Jc4c4iy3WyD4E9ov dK7wmJPuV1LkZtnx6UOLwsOcRASecWtSa+DUXY4AhocNJMyKlEAEP6q+1/sh9I8MAfTr dWwmV9XujyfwBX9e129hDpY/ch7vG162UX0ASR/tdGbNLAdC3D8cyWsLTPBVCxueZ15h vqYf5JJzxg/S0i83/E35uGPvWqi9YwyujzhNlnr92h0htBchxsPX3QNUke3y9pqAzwen iwrHDjKui5cSXQisKKAjdiVw8Ula/n903wN8sl8X6EB4celHISs2s//lf0mlvDXEhrrU 6Pfg== 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=j1vUATzUBpIGtELb+vItTo1wkE0Sy8cpDXXVV9tUxg4=; b=v9wqz5AXJgF0smRmSFbOq6qnJhGrXcP27h2p6vGbPTn6/iwFCNpMev2Km6hhEYORng hF1WSt71NETAti4mrbDBiOq48gJorxKN89ZRsUJQGQvqpCJ/I08c8ek0c+f/BcGTXW9b P0EypSauy7PjaihSoG+wyDiFe0OKc2CqZx5kRTrugHgE20+/aKlmpLEhqZw1q24pG+Ce +PVFUxC7uw6yx8+zUy2IzkqAUVXWx4EBxw/hiaZ4uY5FHgFlJgv7q5HsIfgQYDmCviC/ rYzuHvCEgQ+mQd5t7pmyuGGUdK0Ki+BOHGnN1eKD1Dj5e23bHkQnXNbiiDaqpff8eiPT JH6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=Asi+Td2S; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n8si1831022otr.102.2020.01.10.10.57.09; Fri, 10 Jan 2020 10:57:21 -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=@linux-foundation.org header.s=google header.b=Asi+Td2S; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728652AbgAJSyt (ORCPT + 99 others); Fri, 10 Jan 2020 13:54:49 -0500 Received: from mail-lf1-f68.google.com ([209.85.167.68]:36896 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728617AbgAJSyt (ORCPT ); Fri, 10 Jan 2020 13:54:49 -0500 Received: by mail-lf1-f68.google.com with SMTP id b15so2253564lfc.4 for ; Fri, 10 Jan 2020 10:54:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=j1vUATzUBpIGtELb+vItTo1wkE0Sy8cpDXXVV9tUxg4=; b=Asi+Td2STF/mUZRXQIv70X1R92yzc9QNkF0hyVHvxy/vDF3BWUUgKG+s5bhHF8lXm1 pmZ9SkxNAja2H57ghybZjnyXwh47Lcye5VyMq5jcdrYG12Nfwt5EvKEWCQIqZHBmZpkZ bLFLUI7/QsOh+k0bjEkN1VWI8BcVEG5fhLMlc= 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=j1vUATzUBpIGtELb+vItTo1wkE0Sy8cpDXXVV9tUxg4=; b=UufJ/E7GO/57OF/XbGKILxBykOR1u1ECE0wx88GkbeqvZQ7UPtn71wRv6nKDocsdKw 18slpLj2LoAnJUqH3IP+tiLV41+hv4rJn0G/nuLyOTVp3HZ+EXm2G3nv6l5hpScQwY6B nTO/ocTCEdJzngSbQ26shl7x8fDuiSDv3kx1HyrBxf0WPv6BkErvi/8X4sCoGfEulcVW i/Lpq3eo+aKTV/GfYN26lxY5xfgtR2TDMoZqvOhtcvqulg67IR+8XZdWCoCEny3agflM Kf42tFlBmsdCMd44jcMzQEXOga0waw/hHMHPI21uxdU52xtyjqldm+FYJVYcDo8l4ptY qAZQ== X-Gm-Message-State: APjAAAXvPZT4780J+6Ps6mUuKbZ+M+So//KLI+yHDid36CsYPVlaJgKA W3gJ96yPdn0X+tjRngF4cZaaZJd1fFo= X-Received: by 2002:a19:84d:: with SMTP id 74mr3200730lfi.122.1578682486144; Fri, 10 Jan 2020 10:54:46 -0800 (PST) Received: from mail-lj1-f169.google.com (mail-lj1-f169.google.com. [209.85.208.169]) by smtp.gmail.com with ESMTPSA id s13sm1441633lje.35.2020.01.10.10.54.43 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 10 Jan 2020 10:54:44 -0800 (PST) Received: by mail-lj1-f169.google.com with SMTP id o13so3184157ljg.4 for ; Fri, 10 Jan 2020 10:54:43 -0800 (PST) X-Received: by 2002:a05:651c:282:: with SMTP id b2mr3531333ljo.41.1578682483466; Fri, 10 Jan 2020 10:54:43 -0800 (PST) MIME-Version: 1.0 References: <20200110165636.28035-1-will@kernel.org> <20200110165636.28035-7-will@kernel.org> In-Reply-To: <20200110165636.28035-7-will@kernel.org> From: Linus Torvalds Date: Fri, 10 Jan 2020 10:54:27 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC PATCH 6/8] READ_ONCE: Drop pointer qualifiers when reading from scalar types To: Will Deacon Cc: Linux Kernel Mailing List , linux-arch , Android Kernel Team , Michael Ellerman , Peter Zijlstra , Segher Boessenkool , Christian Borntraeger , Luc Van Oostenryck , Arnd Bergmann Content-Type: multipart/mixed; boundary="000000000000a42d9d059bcda82d" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --000000000000a42d9d059bcda82d Content-Type: text/plain; charset="UTF-8" On Fri, Jan 10, 2020 at 8:56 AM Will Deacon wrote: > > +/* Declare an unqualified scalar type. Leaves non-scalar types unchanged. */ > +#define __unqual_scalar_typeof(x) typeof( \ Ugh. My eyes. That's horrendous. I can't see any better alternatives, but it does make me go "Eww". Well, I do see one possible alternative: just re-write the bitop implementations in terms of "atomic_long_t", and just avoid the issue entirely. IOW, do something like the attached (but fleshed out and tested - this patch has not seen a compiler, much less any thought at all). Linus --000000000000a42d9d059bcda82d Content-Type: text/x-patch; charset="US-ASCII"; name="patch.diff" Content-Disposition: attachment; filename="patch.diff" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_k58is1210 IGluY2x1ZGUvYXNtLWdlbmVyaWMvYml0b3BzL2xvY2suaCB8IDEyICsrKysrKysrKy0tLQogMSBm aWxlIGNoYW5nZWQsIDkgaW5zZXJ0aW9ucygrKSwgMyBkZWxldGlvbnMoLSkKCmRpZmYgLS1naXQg YS9pbmNsdWRlL2FzbS1nZW5lcmljL2JpdG9wcy9sb2NrLmggYi9pbmNsdWRlL2FzbS1nZW5lcmlj L2JpdG9wcy9sb2NrLmgKaW5kZXggM2FlMDIxMzY4ZjQ4Li4wNzFkOGJmZDg2ZTUgMTAwNjQ0Ci0t LSBhL2luY2x1ZGUvYXNtLWd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