lkml.org 
[lkml]   [2015]   [Sep]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/4] hv: add helpers to handle hv_util device state
Date
The callbacks in kvp, vss and fcopy code are called the main thread and
also from interrupt context. If a state change is done by the main
thread it is not immediately seen by the interrupt. As a result the
state machine gets out of sync.

Force propagation of state changes via get/set helpers with a memory barrier.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
---
drivers/hv/hyperv_vmbus.h | 12 ++++++++++++
1 file changed, 12 insertions(+)

diff --git a/drivers/hv/hyperv_vmbus.h b/drivers/hv/hyperv_vmbus.h
index 3d70e36..6c03925 100644
--- a/drivers/hv/hyperv_vmbus.h
+++ b/drivers/hv/hyperv_vmbus.h
@@ -780,4 +780,16 @@ enum hvutil_device_state {
HVUTIL_DEVICE_DYING, /* driver unload is in progress */
};

+static inline void hvutil_device_set_state(enum hvutil_device_state *p, enum hvutil_device_state s)
+{
+ *p = s;
+ wmb();
+}
+
+static inline enum hvutil_device_state hvutil_device_get_state(enum hvutil_device_state *p)
+{
+ rmb();
+ return *p;
+}
+
#endif /* _HYPERV_VMBUS_H */

\
 
 \ /
  Last update: 2015-09-07 16:41    [W:0.066 / U:0.084 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site