From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Howells Subject: Re: [PATCH v2 00/10] Rework READ_ONCE() to improve codegen Date: Fri, 31 Jan 2020 10:20:21 +0000 Message-ID: <7436.1580466021@warthog.procyon.org.uk> References: <20200123153341.19947-1-will@kernel.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Return-path: Received: from us-smtp-1.mimecast.com ([207.211.31.81]:39074 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728160AbgAaKUh (ORCPT ); Fri, 31 Jan 2020 05:20:37 -0500 In-Reply-To: Content-ID: <7435.1580466021.1@warthog.procyon.org.uk> Sender: linux-arch-owner@vger.kernel.org List-ID: 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 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