From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752552AbbIGO1P (ORCPT ); Mon, 7 Sep 2015 10:27:15 -0400 Received: from mo4-p00-ob.smtp.rzone.de ([81.169.146.217]:36690 "EHLO mo4-p00-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752421AbbIGO1O (ORCPT ); Mon, 7 Sep 2015 10:27:14 -0400 X-RZG-AUTH: :P2EQZWCpfu+qG7CngxMFH1J+yackYocTD1iAi8x+OWi/zfN1cLnDYU0tRQWJl4Hh2o4ySGRMBlDHYMqccew1oDb73L4= X-RZG-CLASS-ID: mo00 From: Olaf Hering To: kys@microsoft.com, gregkh@linuxfoundation.org, haiyangz@microsoft.com Cc: linux-kernel@vger.kernel.org, devel@linuxdriverproject.org, Olaf Hering Subject: [PATCH 0/4] hv: utils: propagate state to interrupt thread Date: Mon, 7 Sep 2015 14:26:59 +0000 Message-Id: <1441636023-3704-1-git-send-email-olaf@aepfle.de> X-Mailer: git-send-email 2.5.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(-)