[PATCH 4/8] Drivers: hv: vmbus: avoid unneeded compiler optimizations in vmbus_wait_for_unload()

K. Y. Srinivasan kys at microsoft.com
Fri Feb 26 23:13:18 UTC 2016


From: Vitaly Kuznetsov <vkuznets at redhat.com>

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 <rkrcmar at redhat.com>
Signed-off-by: Vitaly Kuznetsov <vkuznets at redhat.com>
Reviewed-by: Radim Kr.má<rkrcmar at redhat.com>
Signed-off-by: K. Y. Srinivasan <kys at microsoft.com>
---
 drivers/hv/channel_mgmt.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c
index 73a17be..38b682ba 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;
 		}
-- 
1.7.4.1



More information about the devel mailing list