Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1332827

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

From Vitaly Kuznetsov <vkuznets@redhat.com>
Newsgroups linux.kernel
Subject [PATCH 4/4] Drivers: hv: vmbus: avoid unneeded compiler optimizations in vmbus_wait_for_unload()
Date 2016-02-12 16:50 +0100
Message-ID <r1o8O-tk-39@gated-at.bofh.it> (permalink)
References <r1o8N-tk-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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@redhat.com>
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
---
 drivers/hv/channel_mgmt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c
index 1e43967..b10e8f74 100644
--- a/drivers/hv/channel_mgmt.c
+++ b/drivers/hv/channel_mgmt.c
@@ -520,7 +520,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;
 		}
-- 
2.5.0

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/4] Drivers: hv: vmbus: bugfix and improvements for message handling Vitaly Kuznetsov <vkuznets@redhat.com> - 2016-02-12 16:50 +0100
  [PATCH 1/4] Drivers: hv: vmbus: don't loose HVMSG_TIMER_EXPIRED messages Vitaly Kuznetsov <vkuznets@redhat.com> - 2016-02-12 16:50 +0100
    Re: [PATCH 1/4] Drivers: hv: vmbus: don't loose HVMSG_TIMER_EXPIRED  messages Radim Krcmar <rkrcmar@redhat.com> - 2016-02-15 22:00 +0100
  [PATCH 2/4] Drivers: hv: vmbus: avoid wait_for_completion() on crash Vitaly Kuznetsov <vkuznets@redhat.com> - 2016-02-12 16:50 +0100
    Re: [PATCH 2/4] Drivers: hv: vmbus: avoid wait_for_completion() on  crash Radim Krcmar <rkrcmar@redhat.com> - 2016-02-15 22:10 +0100
  [PATCH 3/4] Drivers: hv: vmbus: remove code duplication in message handling Vitaly Kuznetsov <vkuznets@redhat.com> - 2016-02-12 16:50 +0100
    Re: [PATCH 3/4] Drivers: hv: vmbus: remove code duplication in  message handling Radim Krcmar <rkrcmar@redhat.com> - 2016-02-15 22:10 +0100
  [PATCH 4/4] Drivers: hv: vmbus: avoid unneeded compiler optimizations in vmbus_wait_for_unload() Vitaly Kuznetsov <vkuznets@redhat.com> - 2016-02-12 16:50 +0100
    Re: [PATCH 4/4] Drivers: hv: vmbus: avoid unneeded compiler  optimizations in vmbus_wait_for_unload() Radim Krcmar <rkrcmar@redhat.com> - 2016-02-15 22:20 +0100

csiph-web