From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0286EA00C5 for ; Wed, 3 Aug 2022 11:51:27 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C8BBA40A7E; Wed, 3 Aug 2022 11:51:27 +0200 (CEST) Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by mails.dpdk.org (Postfix) with ESMTP id 7F09B40141 for ; Wed, 3 Aug 2022 11:51:26 +0200 (CEST) Received: from mail-lj1-f198.google.com (mail-lj1-f198.google.com [209.85.208.198]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 339C33F12B for ; Wed, 3 Aug 2022 09:51:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1659520286; bh=wkCZ0FgsuonjS94pzHmnBZoZ++V+UXuzQRcZEf9jiS8=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=sCPavPHeBBFSUOcQQZOXLy2/ohD5Bl7ZKa+dl5ZWpJcJe5cyxRZ0OspCTj0Av/YOL DY3bN6EFKOTJ7nmPLIEgiLC22SjV/XmXzYxdFXr/1uCg3waQ9LgwJjybCJNmQ2n33x NYba6CbdZeLrzcOet1trotmeKJFC107MDXzvxEWBG3zWvDxoF1XZVvpuEE4T1prweb oRlPGzG6ongav3HApIT90JUHrFs8/LHmeT3kIfydp2x4neHnsprorS51LKeDGvOptG oC93eb2iA4dR0ccqJ77UBQjmUzDAuyblTYMizQSvvDXWz0moZF+1sZ0tRF7+WpZOPJ pSaXahcAt2MPw== Received: by mail-lj1-f198.google.com with SMTP id j15-20020a2e850f000000b0025e6da69e18so231706lji.18 for ; Wed, 03 Aug 2022 02:51:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=wkCZ0FgsuonjS94pzHmnBZoZ++V+UXuzQRcZEf9jiS8=; b=URBuEbGpQy2O0heWzLwCVy+dp8EdHDLOrG5RpZnMhSy8QfW69QImr3RNTgPsa+smi7 wfEl5NtwnHB4R4GsXBtVOVkJ5+Q4Rx0i57Y3vXgXkxHOoF2wc5iJ+i3q6r3LSpGl2rnl Xq8NBqXYW/03r3/zUGc3MVVt9mdzjxBBRIy8H+j/FNJuQt1EkwvBFrO1uHuG7vWAetEh knFBOUvRZrqlTuudTJncEeigrYaZeW4Y2jtY3ikwrVOT+Z2IbHj7QMJ9OelKSB+i/m2J XJMUmg8oX8/fD+rqYBSl9NlTx7WS8y6cS2W+PYXZBrE8iFvLFqj7S5OjDutwyrM4T2pU QTmQ== X-Gm-Message-State: ACgBeo2k68sqJev/NYCYSf1U0mPEU6hRbsSMloEA+xZE5gqrYQNKjY3P tFkKU9+7SFzlkt9J8Myn3fEiC6kNnJ6W66WWM8v+PkyXORMCYsTHQNkTgCJ3ka0rIEj2xMc9QOa +yJWiXe4YEBOvCt9FY7CY5w0q5qaUAH5lqATSrBs4 X-Received: by 2002:a19:500b:0:b0:48b:208d:f723 with SMTP id e11-20020a19500b000000b0048b208df723mr765719lfb.150.1659520284135; Wed, 03 Aug 2022 02:51:24 -0700 (PDT) X-Google-Smtp-Source: AA6agR4u4ARlhPOgfZjylJSyaaQhAYAmzcUnC9iqgvIKIoXZ0217O5rMFx6LrkUz5mDaREilLeWlDtk7ZoSV+14dtJQ= X-Received: by 2002:a19:500b:0:b0:48b:208d:f723 with SMTP id e11-20020a19500b000000b0048b208df723mr765714lfb.150.1659520283905; Wed, 03 Aug 2022 02:51:23 -0700 (PDT) MIME-Version: 1.0 References: <20220714170958.554638-1-yuanx.wang@intel.com> In-Reply-To: <20220714170958.554638-1-yuanx.wang@intel.com> From: Christian Ehrhardt Date: Wed, 3 Aug 2022 11:50:57 +0200 Message-ID: Subject: Re: [PATCH 19.11] net/virtio-user: fix socket non-blocking mode To: Yuan Wang Cc: stable@dpdk.org, maxime.coquelin@redhat.com, chenbo.xia@intel.com, jiayu.hu@intel.com, cheng1.jiang@intel.com, qiming.yang@intel.com, Stephen Hemminger Content-Type: text/plain; charset="UTF-8" X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org On Thu, Jul 14, 2022 at 11:22 AM Yuan Wang wrote: > > [ upstream commit 41f9a1757ffc010cc3debaad9a56af8ad88d0c6d ] Thank you, your patch was in time, but sadly a few fell through the cracks on my side. (and many more just arrived too late). Your patch is applied to the WIP branch now, but currently testing of -rc1 is going on which I do not want to disrupt. If we need an -rc2 anyway or generally have the time to do an -rc2 without too much disruption it will be in 19.11.13, otherwise it is already queued for 19.11.14 > The virtio-user initialization requires unix socket to receive backend > messages in block mode. However, virtio_user_read_dev_config() sets > the same socket to nonblocking via fcntl, which affects all threads. > Enabling the rxq interrupt can causes both of these behaviors to occur > concurrently, with the result that the initialization may fail > because no messages are received in nonblocking socket. > > Fix that by replacing O_NONBLOCK with the recv per-call option > MSG_DONTWAIT. > > Fixes: ef53b6030039 ("net/virtio-user: support LSC") > > Signed-off-by: Yuan Wang > Acked-by: Stephen Hemminger > Reviewed-by: Chenbo Xia > --- > drivers/net/virtio/virtio_user_ethdev.c | 15 ++------------- > 1 file changed, 2 insertions(+), 13 deletions(-) > > diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c > index 2fccf9fce..1c07caeb5 100644 > --- a/drivers/net/virtio/virtio_user_ethdev.c > +++ b/drivers/net/virtio/virtio_user_ethdev.c > @@ -211,15 +211,9 @@ virtio_user_read_dev_config(struct virtio_hw *hw, size_t offset, > > if (dev->vhostfd >= 0) { > int r; > - int flags; > > - flags = fcntl(dev->vhostfd, F_GETFL); > - if (fcntl(dev->vhostfd, F_SETFL, > - flags | O_NONBLOCK) == -1) { > - PMD_DRV_LOG(ERR, "error setting O_NONBLOCK flag"); > - return; > - } > - r = recv(dev->vhostfd, buf, 128, MSG_PEEK); > + r = recv(dev->vhostfd, buf, 128, > + MSG_PEEK | MSG_DONTWAIT); > if (r == 0 || (r < 0 && errno != EAGAIN)) { > dev->net_status &= (~VIRTIO_NET_S_LINK_UP); > PMD_DRV_LOG(ERR, "virtio-user port %u is down", > @@ -235,11 +229,6 @@ virtio_user_read_dev_config(struct virtio_hw *hw, size_t offset, > } else { > dev->net_status |= VIRTIO_NET_S_LINK_UP; > } > - if (fcntl(dev->vhostfd, F_SETFL, > - flags & ~O_NONBLOCK) == -1) { > - PMD_DRV_LOG(ERR, "error clearing O_NONBLOCK flag"); > - return; > - } > } else if (dev->is_server) { > dev->net_status &= (~VIRTIO_NET_S_LINK_UP); > if (virtio_user_server_reconnect(dev) >= 0) > -- > 2.25.1 > -- Christian Ehrhardt Senior Staff Engineer, Ubuntu Server Canonical Ltd