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 71727A00C3 for ; Fri, 17 Jun 2022 05:05:15 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5CA89410FC; Fri, 17 Jun 2022 05:05:15 +0200 (CEST) Received: from mail-pg1-f171.google.com (mail-pg1-f171.google.com [209.85.215.171]) by mails.dpdk.org (Postfix) with ESMTP id 2468C40698 for ; Fri, 17 Jun 2022 05:05:13 +0200 (CEST) Received: by mail-pg1-f171.google.com with SMTP id s135so2915247pgs.10 for ; Thu, 16 Jun 2022 20:05:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=bbX8eaAvcorEtqwA82xqu+rmA1CUJCUhdvIgVL71UM0=; b=u1njxCy3q2YQvg7l7adhZ86I7sPVtN4+uln0cRkqbL3MREGoAgdybSIyYgqchzd6n/ 5FtxLV2E7TvXKgVyoDck8/iLBkpKCF/O94Yd7iZpJf1I528N83ukP2RnvntCXJI1AXt0 NBYzSCylmVLmrIAAlTGKuhNwNUhc0tZzwR6F8hDMTfSkeaIBPM6hdDfe0H7Sew90F/BJ eYhhhrvDCP+23jWadE8iQIq0QkgTTcI+PZ5FCgIeYn0Qb36yPkaplOHi+dSkMN6E/hU2 O3qnoE3+2sG+DvAaM+9AM7xJqJtJNZrO54Bjs2dC8aRjWK2g3FHmJq6qL5ORd4/L3g5V CuMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=bbX8eaAvcorEtqwA82xqu+rmA1CUJCUhdvIgVL71UM0=; b=orjL7w1DO5M1AvfIlWxYnBRzO3qlblMfhA6FKDNjYZ31senr4vknwAn9XJs/MmYVuZ WUNt182K6li1jHVjMRCh9pBqSWM/4E2KvEbbkUyRvCNEswWp3W6Qej464Pgm6I0/DS92 yFHAe2hds5UZVaLTF67qUl+58fNRM3M00S6c3Y97XHR/CntKnQ5ytZ9tgspKS/uunkxd LSWlS+8wJnQlNOcoDf4Q8zOjUg3Xo4zLvvxhlAd/4y+qqkzSbHvwijHL36535kCfXoIe HoSvzvbXjDW5b48HqoYa7aWLRsGZ8ndR9BR8nIvJKjG5+fw9Tq4nY9FtoGbXCUY7jk57 e/SQ== X-Gm-Message-State: AJIora/kpquUINvqjosq/CtUvDnopGGejUJdKCtWVxzF4V3seCOrYFtn KxDZZ5wpQWdkUxFYZNBuv+7pkw== X-Google-Smtp-Source: AGRyM1v09Tkuuz8UuwrOvroOhMJoCBdgV2L3ZN85A5l58cG+fvTt3wxTtWL23K8XD7SPWxI3qrvVig== X-Received: by 2002:a63:6b02:0:b0:3fb:da5e:42a1 with SMTP id g2-20020a636b02000000b003fbda5e42a1mr7252626pgc.273.1655435112230; Thu, 16 Jun 2022 20:05:12 -0700 (PDT) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id p14-20020a170902780e00b0016648412514sm2332938pll.188.2022.06.16.20.05.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jun 2022 20:05:11 -0700 (PDT) Date: Thu, 16 Jun 2022 20:05:09 -0700 From: Stephen Hemminger To: Yuan Wang Cc: maxime.coquelin@redhat.com, chenbo.xia@intel.com, dev@dpdk.org, jiayu.hu@intel.com, xingguang.he@intel.com, stable@dpdk.org Subject: Re: [PATCH] net/virtio: fix socket nonblocking mode affects initialization Message-ID: <20220616200509.111a9686@hermes.local> In-Reply-To: <20220617024229.706826-1-yuanx.wang@intel.com> References: <20220617024229.706826-1-yuanx.wang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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 Fri, 17 Jun 2022 10:42:29 +0800 Yuan Wang wrote: > The virtio-user initialization requires unix socket to receive backend > messages in block mode. However, vhost_user_update_link_state() 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. > > Thread 1: > virtio_init_device() > --> virtio_user_start_device() > --> vhost_user_set_memory_table() > --> vhost_user_check_reply_ack() > > Thread 2: > virtio_interrupt_handler() > --> vhost_user_update_link_state() > > Fix that by replacing O_NONBLOCK with the recv per-call option > MSG_DONTWAIT. > > Fixes: ef53b6030039 ("net/virtio-user: support LSC") > Cc: stable@dpdk.org > > Signed-off-by: Yuan Wang Looks good and saves a few system calls. Acked-by: Stephen Hemminger