From: Vitaly Kuznetsov Date: Fri, 26 Feb 2016 23:13:18 +0000 (-0800) Subject: Drivers: hv: vmbus: avoid unneeded compiler optimizations in vmbus_wait_for_unload() X-Git-Tag: Ubuntu-snapdragon-4.4.0-1029.32~2783 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=9ab3d057309d72111d54043de842d1f5a576befa;p=mirror_ubuntu-zesty-kernel.git Drivers: hv: vmbus: avoid unneeded compiler optimizations in vmbus_wait_for_unload() BugLink: http://bugs.launchpad.net/bugs/1541585 Message header is modified by the hypervisor and we read it in a loop, we need to prevent compilers from optimizing accesses. There are no such optimizations at this moment, this is just a future proof. Suggested-by: Radim Krcmar Signed-off-by: Vitaly Kuznetsov Reviewed-by: Radim Kr.má Signed-off-by: K. Y. Srinivasan Signed-off-by: Greg Kroah-Hartman (cherry picked from commit d452ab7b4c65dfcaee88a0d6866eeeb98a3d1884) Signed-off-by: Tim Gardner --- diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c index 73a17be1f340..38b682bab85a 100644 --- a/drivers/hv/channel_mgmt.c +++ b/drivers/hv/channel_mgmt.c @@ -605,7 +605,7 @@ static void vmbus_wait_for_unload(void) bool unloaded = false; while (1) { - if (msg->header.message_type == HVMSG_NONE) { + if (READ_ONCE(msg->header.message_type) == HVMSG_NONE) { mdelay(10); continue; }