Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754902AbdCTXWJ (ORCPT ); Mon, 20 Mar 2017 19:22:09 -0400 Received: from mail-bl2nam02on0108.outbound.protection.outlook.com ([104.47.38.108]:33532 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753629AbdCTXWI (ORCPT ); Mon, 20 Mar 2017 19:22:08 -0400 From: Long Li To: Vitaly Kuznetsov CC: KY Srinivasan , Haiyang Zhang , Stephen Hemminger , "devel@linuxdriverproject.org" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH] HV: properly delay KVP packets when negotiation is in progress Thread-Topic: [PATCH] HV: properly delay KVP packets when negotiation is in progress Thread-Index: AdKejo2smNJhZO6kS/6mgEoV+RSuLAAqzTxyAHqsTaAAKWLc0A== Date: Mon, 20 Mar 2017 22:44:31 +0000 Message-ID: References: <87inn7c214.fsf@vitty.brq.redhat.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=none action=none header.from=microsoft.com; x-originating-ip: [2001:4898:80e8:b::735] x-microsoft-exchange-diagnostics: 1;BN3PR03MB1416;7:SGncfb0sqPAtwWmnu5Pm1IGxW9XV48HMERV7BM1UuG3KrCvdPhwKMhFuSiIK1Lo5zvOWx74EdNADmxL7ujxn7+w3scvIRiTo4lgBWJih9tsMl3YZwpZwBAZz5g+nXTAGeCNeTA41KrW6DFMn2+6AlKvzi6hbluEs3Y+fCTKyPN0SP9zTG4oiQA+Im4HUx0b0W7OAabo8m5jdxLK4KXb9CDsZcAVkNTq1viI/3Ttsy5nW4VrlwWqQP/mlkpu1zQBkWolb9RZdo+cItWP0tSXCUVLptc4pI76artA3+4teIS7Dj+dCw75KKqYdWyY77YedYVoG8+SFCPkbp8daXZGAt9r3G8IRgoca+cwm9zMGNxM= x-ms-office365-filtering-correlation-id: cbf79498-f688-487d-82c4-08d46fe2ac9f x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(2017030254075)(48565401081);SRVR:BN3PR03MB1416; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(9452136761055); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(61425038)(6040375)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6055026)(61426038)(61427038)(6041248)(20161123560025)(20161123562025)(20161123558025)(20161123555025)(20161123564025)(6072148);SRVR:BN3PR03MB1416;BCL:0;PCL:0;RULEID:;SRVR:BN3PR03MB1416; x-forefront-prvs: 02524402D6 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(979002)(6009001)(39840400002)(39450400003)(39410400002)(39850400002)(39860400002)(377454003)(13464003)(6116002)(4326008)(102836003)(50986999)(8676002)(8990500004)(2906002)(76176999)(86362001)(3280700002)(54356999)(3660700001)(7696004)(81166006)(25786008)(8936002)(81156014)(5005710100001)(10290500002)(10090500001)(2950100002)(6916009)(122556002)(305945005)(110136004)(38730400002)(74316002)(33656002)(9686003)(551934003)(189998001)(54906002)(53936002)(86612001)(77096006)(6506006)(6436002)(7736002)(2900100001)(6246003)(5660300001)(99286003)(229853002)(53546009)(55016002)(969003)(989001)(999001)(1009001)(1019001);DIR:OUT;SFP:1102;SCL:1;SRVR:BN3PR03MB1416;H:BN3PR03MB2227.namprd03.prod.outlook.com;FPR:;SPF:None;MLV:ovrnspm;PTR:InfoNoRecords;LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Mar 2017 22:44:31.3858 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR03MB1416 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mail.home.local id v2KNMDEr027036 Content-Length: 4239 Lines: 108 > -----Original Message----- > From: Long Li > Sent: Sunday, March 19, 2017 7:49 PM > To: 'Vitaly Kuznetsov' > Cc: KY Srinivasan ; Haiyang Zhang > ; Stephen Hemminger > ; devel@linuxdriverproject.org; linux- > kernel@vger.kernel.org > Subject: RE: [PATCH] HV: properly delay KVP packets when negotiation is in > progress > > > > > -----Original Message----- > > From: Vitaly Kuznetsov [mailto:vkuznets@redhat.com] > > Sent: Friday, March 17, 2017 9:16 AM > > To: Long Li > > Cc: KY Srinivasan ; Haiyang Zhang > > ; Stephen Hemminger > ; > > devel@linuxdriverproject.org; linux- kernel@vger.kernel.org > > Subject: Re: [PATCH] HV: properly delay KVP packets when negotiation > > is in progress > > > > Long Li writes: > > > > > The host may send multiple KVP packets before the negotiation with > > > daemon is finished. We need to keep those packets in ring buffer > > > until the daemon is negotiated and connected. > > > > The patch looks OK but previously we always presumed that this can't > > happen for util drivers and host will never send a new request before > > we answer to the previous one. If this is not true we may have more > > issues which need fixing as all three drivers we have are written in a > 'transaction' > > fashion. > > > > So my question would be: can the host send multiple (KVP) packets > > _after_ the negotiation with daemon is finished? > > Thanks Vitaly. I'm checking with Windows guys and will update soon. It's possible that hosts may send a number of staged KVP requests as soon as negotiation is done. The current KVP code can deal with a number of pending KVP requests, and respond to them one by one. To summarize the issue this patch tries to fix: 1. When host sends a negotiation request, and it times out, the host will send another negotiation request, and so on. 2. The guest can respond to all negotiation requests from the host. All subsequent response (except for the 1st response) are ignored by the host. 3. Before negotiation is done, the host may have staged a number of pending KVP requests. 4. As soon as negotiation is done, the host sends all KVP requests to guest. There is a corner case that if there is only one pending KVP request after the 2nd (or 3rd etc) negotiation, it may get lost. I'm testing the following code to address this condition: @@ -705,6 +706,7 @@ void hv_kvp_onchannelcallback(void *context) VM_PKT_DATA_INBAND, 0); host_negotiatied = NEGO_FINISHED; + hv_poll_channel(kvp_transaction.recv_channel, kvp_poll_wrapper); } } Please drop this patch. I'll send V2. > > > > > > > > > > > This patch is based on the work of Nick Meier > > > > > > > > > Signed-off-by: Long Li > > > --- > > > drivers/hv/hv_kvp.c | 9 +++++---- > > > 1 file changed, 5 insertions(+), 4 deletions(-) > > > > > > diff --git a/drivers/hv/hv_kvp.c b/drivers/hv/hv_kvp.c index > > > de26371..b9f928d 100644 > > > --- a/drivers/hv/hv_kvp.c > > > +++ b/drivers/hv/hv_kvp.c > > > @@ -628,16 +628,17 @@ void hv_kvp_onchannelcallback(void *context) > > > NEGO_IN_PROGRESS, > > > NEGO_FINISHED} host_negotiatied = > > NEGO_NOT_STARTED; > > > > > > - if (host_negotiatied == NEGO_NOT_STARTED && > > > - kvp_transaction.state < HVUTIL_READY) { > > > + if (kvp_transaction.state < HVUTIL_READY) { > > > /* > > > * If userspace daemon is not connected and host is asking > > > * us to negotiate we need to delay to not lose messages. > > > * This is important for Failover IP setting. > > > */ > > > - host_negotiatied = NEGO_IN_PROGRESS; > > > - schedule_delayed_work(&kvp_host_handshake_work, > > > + if (host_negotiatied == NEGO_NOT_STARTED) { > > > + host_negotiatied = NEGO_IN_PROGRESS; > > > + > > schedule_delayed_work(&kvp_host_handshake_work, > > > HV_UTIL_NEGO_TIMEOUT * HZ); > > > + } > > > return; > > > } > > > if (kvp_transaction.state > HVUTIL_READY) > > > > -- > > Vitaly