RE: [PATCH 2/7] Drivers: hv: vmbus: Use READ_ONCE() to read variables that are volatile
From: KY Srinivasan
Date: Fri Apr 01 2016 - 18:02:49 EST
> -----Original Message-----
> From: Greg KH [mailto:gregkh@xxxxxxxxxxxxxxxxxxx]
> Sent: Thursday, March 31, 2016 5:01 PM
> To: KY Srinivasan <kys@xxxxxxxxxxxxx>
> Cc: linux-kernel@xxxxxxxxxxxxxxx; devel@xxxxxxxxxxxxxxxxxxxxxx;
> olaf@xxxxxxxxx; apw@xxxxxxxxxxxxx; vkuznets@xxxxxxxxxx;
> jasowang@xxxxxxxxxx
> Subject: Re: [PATCH 2/7] Drivers: hv: vmbus: Use READ_ONCE() to read
> variables that are volatile
>
> On Wed, Mar 23, 2016 at 05:53:52PM -0700, K. Y. Srinivasan wrote:
> > Use the READ_ONCE macro to access variabes that can change
> asynchronously.
>
> Why? What is this "fixing"?
This is to prevent the compiler optimizations and moving the code. This is the
recommended mechanism for reading volatile variables.
Regards,
K. Y
>
> thanks,
>
> greg k-h