From owner-svn-src-head@freebsd.org Fri Feb 24 15:29:09 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 262C8CEB0CD; Fri, 24 Feb 2017 15:29:09 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D93DE651; Fri, 24 Feb 2017 15:29:08 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.129.119]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 406CE1FE086; Fri, 24 Feb 2017 16:28:54 +0100 (CET) Subject: Re: svn commit: r314207 - head/sys/compat/linuxkpi/common/include/linux To: Mateusz Guzik References: <201702241440.v1OEeFJa095968@repo.freebsd.org> <20170224150628.GA19697@dft-labs.eu> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Hans Petter Selasky Message-ID: <7bdb0e95-9dcd-f015-6b59-525642d9f405@selasky.org> Date: Fri, 24 Feb 2017 16:28:21 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20170224150628.GA19697@dft-labs.eu> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Feb 2017 15:29:09 -0000 On 02/24/17 16:06, Mateusz Guzik wrote: > On Fri, Feb 24, 2017 at 02:40:15PM +0000, Hans Petter Selasky wrote: >> Author: hselasky >> Date: Fri Feb 24 14:40:15 2017 >> New Revision: 314207 >> URL: https://svnweb.freebsd.org/changeset/base/314207 >> >> Log: >> Implement srcu_dereference() macro in the LinuxKPI. >> >> MFC after: 1 week >> Sponsored by: Mellanox Technologies >> >> Modified: >> head/sys/compat/linuxkpi/common/include/linux/srcu.h >> >> Modified: head/sys/compat/linuxkpi/common/include/linux/srcu.h >> ============================================================================== >> --- head/sys/compat/linuxkpi/common/include/linux/srcu.h Fri Feb 24 14:37:55 2017 (r314206) >> +++ head/sys/compat/linuxkpi/common/include/linux/srcu.h Fri Feb 24 14:40:15 2017 (r314207) >> @@ -34,6 +34,8 @@ struct srcu_struct { >> struct ck_epoch_record *ss_epoch_record; >> }; >> >> +#define srcu_dereference(ptr,srcu) ((__typeof(*(ptr)) *)(ptr)) >> + > > Should not this cast to volatile and read through that? > Hi, This macro should only be used inside a srcu_read_lock() and srcu_read_unlock() section and then volatile is not part of the game I think. The srcu argument is passed so that checks can be added to assert this. --HPS