From: Olaf Hering <olaf@aepfle.de>
To: kys@microsoft.com, gregkh@linuxfoundation.org, haiyangz@microsoft.com
Cc: linux-kernel@vger.kernel.org, devel@linuxdriverproject.org,
Olaf Hering <olaf@aepfle.de>
Subject: [PATCH 1/4] hv: add helpers to handle hv_util device state
Date: Mon, 7 Sep 2015 14:27:00 +0000 [thread overview]
Message-ID: <1441636023-3704-2-git-send-email-olaf@aepfle.de> (raw)
In-Reply-To: <1441636023-3704-1-git-send-email-olaf@aepfle.de>
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 */
next prev parent reply other threads:[~2015-09-07 14:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-07 14:26 [PATCH 0/4] hv: utils: propagate state to interrupt thread Olaf Hering
2015-09-07 14:27 ` Olaf Hering [this message]
2015-09-07 14:27 ` [PATCH 2/4] hv: fcopy: use wrapper to propate state Olaf Hering
2015-09-07 14:27 ` [PATCH 3/4] hv: kvp: " Olaf Hering
2015-09-07 14:27 ` [PATCH 4/4] hv: vss: " Olaf Hering
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1441636023-3704-2-git-send-email-olaf@aepfle.de \
--to=olaf@aepfle.de \
--cc=devel@linuxdriverproject.org \
--cc=gregkh@linuxfoundation.org \
--cc=haiyangz@microsoft.com \
--cc=kys@microsoft.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®