Received: by 10.223.176.5 with SMTP id f5csp8757wra; Thu, 1 Feb 2018 14:35:48 -0800 (PST) X-Google-Smtp-Source: AH8x224UBuxpDUhgbE5KW4+1/TxR5UCQgbJJ24tAF1e75XKYkmpSv31xTEfo38yw1mwzBmEnBvSp X-Received: by 2002:a17:902:d81:: with SMTP id 1-v6mr33908641plv.270.1517524548675; Thu, 01 Feb 2018 14:35:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517524548; cv=none; d=google.com; s=arc-20160816; b=BYR5o1iR8J32HaxW6Y9yyLLqmhVmgeBcx4MFzXOJp76iDZcXhIqoDBtRow1DAzpzoj eTewJyT3dD8Zkqt2u0lHjCv2TRb6J2LXpCZ3Jm8oyX3kPhEDEV9NM0ptP24QrnGosYUP 5GA3EQSQevSVs9dDKgfirfZZXvbAHo/Ro66CRXSji9zxbdp7DOsDVG/NRiPOJZmKDSyl qYCGT6xRiE8+xlSkULXzlRyAuiNutYdP4HJVO6N1qSwh+5WUQTldtTUZMlW+MOXzMUDj JjpfQ8s98+Jf//iDdE5r03nRMrw2uavt64TkRO/WLqRe1VX1FCpmDv2gztlM/+TKYuaf 11+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:date:cc:to:reply-to:from :subject:message-id:arc-authentication-results; bh=lwmZa7DsKHPA1Qy60EM/jZFhjzTJXJBSC1uD3W4reNQ=; b=Ut3OGWoBtkRMt1TwDcLVE/idc2Gsjo1dpD4HEfLGYW8TCN3LZSN54IlcFLf7Gif1h2 yXe/oJW1REv2BVnzA/ZB/Hdg5o18G1aW9RRr2NS89qAM+zQZK5Am0exVY2KBSelACxtb eLGOgBvEeR4G0RxruN5XpibNHwVrnymrr/bGF1CB9A/2HIeB6kGv+BIg3biM1Xb68sWK HBWtaMsJd9WF3cucJybQE0vhvIo2ZPC+W0P1aTUvai7gUdb2eHM/+ANw2Q2G/fZ9CYb3 gzI85sMiebdh4i7mP22owiugyN8JkhBDJsPhLFVq7IRnUOzHtF5C0BPrk9l8gco1EztP X7YQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s70si473823pfg.255.2018.02.01.14.35.25; Thu, 01 Feb 2018 14:35:48 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752052AbeBAWeQ (ORCPT + 99 others); Thu, 1 Feb 2018 17:34:16 -0500 Received: from mx1.redhat.com ([209.132.183.28]:58328 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751976AbeBAWeH (ORCPT ); Thu, 1 Feb 2018 17:34:07 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6EAEC4A6FF; Thu, 1 Feb 2018 22:34:07 +0000 (UTC) Received: from ovpn-204-19.brq.redhat.com (ovpn-204-19.brq.redhat.com [10.40.204.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7613087DC; Thu, 1 Feb 2018 22:34:02 +0000 (UTC) Message-ID: <1517524441.7076.2.camel@redhat.com> Subject: Re: [RFC PATCH 1/2] hv_netvsc: Split netvsc_revoke_buf() and netvsc_teardown_gpadl() From: Mohammed Gamal Reply-To: mgamal@redhat.com To: Stephen Hemminger Cc: netdev@vger.kernel.org, otubo@redhat.com, sthemmin@microsoft.com, haiyangz@microsoft.com, linux-kernel@vger.kernel.org, devel@linuxdriverproject.org, vkuznets@redhat.com Date: Thu, 01 Feb 2018 23:34:01 +0100 In-Reply-To: <1517474239.30443.2.camel@redhat.com> References: <1516700045-32142-1-git-send-email-mgamal@redhat.com> <1516700045-32142-2-git-send-email-mgamal@redhat.com> <20180130112926.53f3c166@xeon-e3> <1517397409.3452.7.camel@redhat.com> <20180131150137.58abee5b@xeon-e3> <1517474239.30443.2.camel@redhat.com> Organization: Red Hat Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 01 Feb 2018 22:34:07 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2018-02-01 at 09:37 +0100, Mohammed Gamal wrote: > On Wed, 2018-01-31 at 15:01 -0800, Stephen Hemminger wrote: > > On Wed, 31 Jan 2018 12:16:49 +0100 > > Mohammed Gamal wrote: > > > > > On Tue, 2018-01-30 at 11:29 -0800, Stephen Hemminger wrote: > > > > On Tue, 23 Jan 2018 10:34:04 +0100 > > > > Mohammed Gamal wrote: > > > >    > > > > > Split each of the functions into two for each of send/recv > > > > > buffers > > > > > > > > > > Signed-off-by: Mohammed Gamal    > > > > > > > > Splitting these functions is not necessary   > > > > > > How so? We need to send each message independently, and hence the > > > split > > > (see cover letter). Is there another way? > > > > This is all that is needed. > > > > > > Subject: [PATCH] hv_netvsc: work around for gpadl teardown on older > > windows > >  server > > > > On WS2012 the host ignores messages after vmbus channel is closed. > > Workaround this by doing what Windows does and send the teardown > > before close on older versions of NVSP protocol. > > > > Reported-by: Mohammed Gamal > > Fixes: 0cf737808ae7 ("hv_netvsc: netvsc_teardown_gpadl() split") > > Signed-off-by: Stephen Hemminger > > --- > >  drivers/net/hyperv/netvsc.c | 9 ++++++++- > >  1 file changed, 8 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/net/hyperv/netvsc.c > > b/drivers/net/hyperv/netvsc.c > > index 17e529af79dc..1a3df0eff42f 100644 > > --- a/drivers/net/hyperv/netvsc.c > > +++ b/drivers/net/hyperv/netvsc.c > > @@ -574,10 +574,17 @@ void netvsc_device_remove(struct hv_device > > *device) > >    */ > >   netdev_dbg(ndev, "net device safe to remove\n"); > >   > > + /* Workaround for older versions of Windows require that > > +  * buffer be revoked before channel is disabled > > +  */ > > + if (net_device->nvsp_version < NVSP_PROTOCOL_VERSION_4) > > + netvsc_teardown_gpadl(device, net_device); > > + > >   /* Now, we can close the channel safely */ > >   vmbus_close(device->channel); > >   > > - netvsc_teardown_gpadl(device, net_device); > > + if (net_device->nvsp_version >= NVSP_PROTOCOL_VERSION_4) > > + netvsc_teardown_gpadl(device, net_device); > >   > >   /* And dissassociate NAPI context from device */ > >   for (i = 0; i < net_device->num_chn; i++) > > I've tried a similar workaround before by calling > netvsc_teardown_gpadl() after netvsc_revoke_buf(), but before setting > net_device_ctx->nvdev to NULL and it caused the guest to hang when > trying to change MTU.  > > Let me try that change and see if it behaves differently. I tested the patch, but I've actually seen some unexpected behavior. First, net_device->nvsp_version is actually NVSP_PROTOCOL_VERSION_5 on both my Win2012 and Win2016 hosts that I tested on, so the condition is never executed. Second, when doing the check instead as if (vmbus_proto_version < VERSION_WIN10), I get the same behavior I described above where the guest hangs as the kernel waits indefinitely in vmbus_teardown_gpadl() for a completion to be signaled. This is actually what lead me to propose splitting netvsc_revoke_buf() and netvsc_teardown_gpadl() in my initial patchset so that we keep the same order of messages and avoid that indefinite wait.