Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 24 Feb 2017 16:28:21 +0100
From:      Hans Petter Selasky <hps@selasky.org>
To:        Mateusz Guzik <mjguzik@gmail.com>
Cc:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r314207 - head/sys/compat/linuxkpi/common/include/linux
Message-ID:  <7bdb0e95-9dcd-f015-6b59-525642d9f405@selasky.org>
In-Reply-To: <20170224150628.GA19697@dft-labs.eu>
References:  <201702241440.v1OEeFJa095968@repo.freebsd.org> <20170224150628.GA19697@dft-labs.eu>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?7bdb0e95-9dcd-f015-6b59-525642d9f405>