From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751170AbdCQQPz (ORCPT ); Fri, 17 Mar 2017 12:15:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56372 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751047AbdCQQPy (ORCPT ); Fri, 17 Mar 2017 12:15:54 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 136BA437F50 Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=vkuznets@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 136BA437F50 From: Vitaly Kuznetsov 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 References: Date: Fri, 17 Mar 2017 17:15:51 +0100 In-Reply-To: (Long Li's message of "Thu, 16 Mar 2017 19:51:26 +0000") Message-ID: <87inn7c214.fsf@vitty.brq.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 17 Mar 2017 16:15:54 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? > > 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