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


Groups > linux.kernel > #1220212

[PATCH 1/4] hv: add helpers to handle hv_util device state

From Olaf Hering <olaf@aepfle.de>
Newsgroups linux.kernel
Subject [PATCH 1/4] hv: add helpers to handle hv_util device state
Date 2015-09-07 16:30 +0200
Message-ID <q65AK-88W-13@gated-at.bofh.it> (permalink)
References <q65AK-88W-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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 */
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

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


Thread

[PATCH 0/4] hv: utils: propagate state to interrupt thread Olaf Hering <olaf@aepfle.de> - 2015-09-07 16:30 +0200
  [PATCH 1/4] hv: add helpers to handle hv_util device state Olaf Hering <olaf@aepfle.de> - 2015-09-07 16:30 +0200
  [PATCH 4/4] hv: vss: use wrapper to propate state Olaf Hering <olaf@aepfle.de> - 2015-09-07 16:30 +0200
  [PATCH 2/4] hv: fcopy: use wrapper to propate state Olaf Hering <olaf@aepfle.de> - 2015-09-07 16:40 +0200

csiph-web