Skip to content

hv: utils: propagate state to interrupt thread

Olaf Hering lkml 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4hv: add helpers to handle hv_util device statedrivers/hv/hyperv_vmbus.h+12 -00 replies
2/4hv: fcopy: use wrapper to propate statedrivers/hv/hv_fcopy.c+20 -160 replies
3/4hv: kvp: use wrapper to propate statedrivers/hv/hv_kvp.c+21 -170 replies
4/4hv: vss: use wrapper to propate statedrivers/hv/hv_snapshot.c+20 -170 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/4] hv: utils: propagate state to interrupt thread

The Copy-VMFile cmdlet on the host may fail because the guest fcopy driver state machine gets out of sync. This happens because the ->state and ->context variables are accessed by the main thread and from interrupt context. If an interrupt happens between fcopy_respond_to_host and hv_poll_channel in fcopy_write, then hv_fcopy_onchannelcallback called from that interrupt sees still state HVUTIL_USERSPACE_RECV. It updates the context, but fcopy_write will not notice that update and hv_poll_channel gets called with an empty context. As a result hv_fcopy_daemon gets no more data. After a timeout Copy-VMFile fails with timeout.

In my initial testing for a fix I put a "mb()" after the last .state change in fcopy_write. But this series implementes read/write memory barriers as needed. Let me know if this is overdoing things.

Olaf

Olaf Hering (4):
hv: add helpers to handle hv_util device state
hv: fcopy: use wrapper to propate state
hv: kvp: use wrapper to propate state
hv: vss: use wrapper to propate state

 drivers/hv/hv_fcopy.c     | 36 ++++++++++++++++++++----------------
 drivers/hv/hv_kvp.c       | 38 +++++++++++++++++++++-----------------
 drivers/hv/hv_snapshot.c  | 37 ++++++++++++++++++++-----------------
 drivers/hv/hyperv_vmbus.h | 12 ++++++++++++
 4 files changed, 73 insertions(+), 50 deletions(-)