Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp474077ybl; Fri, 31 Jan 2020 02:21:47 -0800 (PST) X-Google-Smtp-Source: APXvYqyoxQ6FtwFQ9PWbn8r0MojnlgMADpcVQFAmK99XE4Z71N0bFn6btN5vi/0npGlhYgY0make X-Received: by 2002:a9d:4541:: with SMTP id p1mr7226938oti.199.1580466106983; Fri, 31 Jan 2020 02:21:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580466106; cv=none; d=google.com; s=arc-20160816; b=Nba5L9ZM0MlRuDEqnRdTI+9iroaV5hdRjUv6ixvovPbRaiAcN84PMJi82X6gaWBW9V BJI4Guhwn/wdltOswrCiUZ5A//77xVL3fL9JOgeNTLo1hO6AUJJr6vKdfvMObMj56XiM qN4rD0UPY0LFKhAWW1xlJpbHFQ/3pL108hy97nn99CTkuMxXeyarE3DvJsoTDSue/8X/ H+ROpmG2Q1Bx91JSBAUPMv1zszrPynWaHekknGggGuMPHCax32OpuF+9LTCgCzFDj8nf jLzXLoATCxVVp3bZILHiumoSe1HHyDIoxLZCnSf5i0QxQ0pOLvWjLAyf5gmgaAniAf+P kKeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:content-id:mime-version :subject:cc:to:references:in-reply-to:from:organization :dkim-signature; bh=9Rvip+9gEMjJ6H84OHoQUknXeHPGXzmy72y0DuVzxqY=; b=gwcCPrHnaMs5BruykW3P8UsbJtFAxg74dsJJ1obxOYcq9EsfeWY0L5D7p2m4w2Dted ETZ895HYF2JEE32Y0/C9ctVj4rHhbn7X1+H+r9fIZrsWt+gpDlIqs/C+YTVMqFv9xQyY Qg6078wNZGGfbra/aIWnR2Gpx3Pgv1vtD+pbBOcMa0zlssAoxibHpQWRQHoSh6cjOu9K zfEoCsbfVo1rBAbxaxH2rlFyoGQTFWSMjaPtzklg6Wt5/A+EjNRUA6zhBTEN/NAMkbIK Y/HMQa0yOOLgB9SgIJFimlN2RtC8z3HyC7DXfQ+UWJEuAA5WxgXcF/gws7dJHopZR4F0 mKGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=hdbfVVhb; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l15si3809296oic.220.2020.01.31.02.21.34; Fri, 31 Jan 2020 02:21:46 -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=@redhat.com header.s=mimecast20190719 header.b=hdbfVVhb; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728326AbgAaKUi (ORCPT + 99 others); Fri, 31 Jan 2020 05:20:38 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:47652 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728289AbgAaKUi (ORCPT ); Fri, 31 Jan 2020 05:20:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1580466037; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=9Rvip+9gEMjJ6H84OHoQUknXeHPGXzmy72y0DuVzxqY=; b=hdbfVVhbnrTdV/DBYBjxYhjjKXuzhKygdYWxtIUNy3nk4nagKbDH/DARq/r0rJGU6xNcC/ zUNltzFBdClP0pcXbVnY9/mRju29LmwjXY9MyUiZOb8yteXrg4dymhN9ypx+QiUSimWnoc T357e2fcnsjOQH2+55db1i1Nsd5srag= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-121-degvaMcmNIy88Nk77AIFyA-1; Fri, 31 Jan 2020 05:20:28 -0500 X-MC-Unique: degvaMcmNIy88Nk77AIFyA-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A1549107ACC4; Fri, 31 Jan 2020 10:20:25 +0000 (UTC) Received: from warthog.procyon.org.uk (ovpn-120-218.rdu2.redhat.com [10.10.120.218]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9E46F5DA75; Fri, 31 Jan 2020 10:20:22 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: References: <20200123153341.19947-1-will@kernel.org> To: Linus Torvalds Cc: dhowells@redhat.com, Will Deacon , Alexey Dobriyan , Linux Kernel Mailing List , linux-arch , Android Kernel Team , Michael Ellerman , Peter Zijlstra , Segher Boessenkool , Christian Borntraeger , Luc Van Oostenryck , Arnd Bergmann , Peter Oberparleiter , Masahiro Yamada , Nick Desaulniers Subject: Re: [PATCH v2 00/10] Rework READ_ONCE() to improve codegen MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <7435.1580466021.1@warthog.procyon.org.uk> Date: Fri, 31 Jan 2020 10:20:21 +0000 Message-ID: <7436.1580466021@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Of course, if you're feeling adventurous and willing to at least entertain the mere speculation of switching the kernel source to C++, we could then use inline template functions: template static inline T __READ_ONCE(T &var) { T val = *(const volatile T *)&var; return val; } template static inline T READ_ONCE(T &var) { T val; compiletime_assert_rwonce_type(var); val = __READ_ONCE(var); smp_read_barrier_depends(); return val; } Of course, that would mean using C++... David