Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2401028rwl; Thu, 13 Apr 2023 06:07:31 -0700 (PDT) X-Google-Smtp-Source: AKy350bVuDu7AY32vXVG6nqr8JB11KTOyb2I+fQAGXhOcq5UhoRJM5ted/dNbxZi7t6+qJFFsZ4I X-Received: by 2002:a05:6102:34f7:b0:42e:2d7e:4ab8 with SMTP id bi23-20020a05610234f700b0042e2d7e4ab8mr377340vsb.17.1681391250915; Thu, 13 Apr 2023 06:07:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681391250; cv=none; d=google.com; s=arc-20160816; b=fWP1KnfHuMjaES3fp3tlmldPcwxikYk4JEZDWSIRrRzRnWiej+mH6dqlhNKZIkZnxw uwOGs19U73sMOvhd+TtIqvbHWC3xFjDCdMUjUk3bLE1MbHqTxNag1nk3VOzGrWElgqGB cLb/7InzWVWh78P2AHN0Sk3e4HeX7/JLL7x7EIJE9hQNaWtbw8dRu+T/a+eFxOALs/fA IGHdLzuggOs22jhsHTb1Ojhi6wXn2Zo9L5PLwPkIh6342cq95s8sV3mF4tZP3SAyXz8h xAN3HY3BCfmzrngdFr5fff/7vtSiLQjn8pOLJwoUG5l5pCWjUkyKyseQ/FKnnjAj1ONY 1TzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:subject :from:references:cc:to:content-language:user-agent:mime-version:date :message-id:dkim-signature; bh=8Cu6EyWN8LOMXD9CXL7Crx6QPnPfI2MeMTBJ/W0AwsE=; b=d9+97RpXpPPEM9J5yGvp4UYB1De5wjAYy5YmS89gRM8xeg/JOlpIFJnB4UJQXMLXKv ulF124Ym3kRikyN+kaVU+pQLuO20R6E0+m/BSUsiDYa99P3cXMehZcJgz7sMTRU2PpqC NLcsadExJ7SImQ5jRUIr4/XkVJHu5KKfYGH070NazeNJ+pnAlzxNcIBrj8MfyllXFaP0 OVypjzNIVzoyzM7y8jRWuNuFEf1Q2tlEdnZrBhpCi63ATUETv7u55LjruCJ/JK1q81HE 4AIEMAOEX4616Jo8sgfd+t22uxajCxhIQfgELv1x+54t2AEmtzgTa5JyfWzbpelbmWE6 WO4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=KbM8KgN9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m25-20020a67f299000000b0042c379b7615si352408vsk.303.2023.04.13.06.07.14; Thu, 13 Apr 2023 06:07:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=KbM8KgN9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229820AbjDMNEE (ORCPT + 99 others); Thu, 13 Apr 2023 09:04:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229685AbjDMNEC (ORCPT ); Thu, 13 Apr 2023 09:04:02 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 61B2A1704 for ; Thu, 13 Apr 2023 06:03:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681390994; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8Cu6EyWN8LOMXD9CXL7Crx6QPnPfI2MeMTBJ/W0AwsE=; b=KbM8KgN9sanLpgHfB28jH2uQKpn9z2KbExdOu0PLisnWOXK4KBUcVII1fRf0DH6cA++Dxk /IPxkYsQIfK1TSmec+rNCT3HlEoUTNCt2xgvQrfLCdzFO18d0CI9B7jAoqNSMuABcy6xtB eKeKPNVRAuKRqEB6wU/MymNoDUsm2HU= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-340-4XAPXDlqP0Wi9xKF4IlQTQ-1; Thu, 13 Apr 2023 09:03:12 -0400 X-MC-Unique: 4XAPXDlqP0Wi9xKF4IlQTQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 32EE23C16E95; Thu, 13 Apr 2023 13:03:07 +0000 (UTC) Received: from [10.39.208.7] (unknown [10.39.208.7]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0D45C4042AD8; Thu, 13 Apr 2023 13:02:48 +0000 (UTC) Message-ID: Date: Thu, 13 Apr 2023 15:02:47 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Content-Language: en-US To: Jason Wang , mst@redhat.com Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org, alvaro.karsz@solid-run.com, eperezma@redhat.com, xuanzhuo@linux.alibaba.com, david.marchand@redhat.com References: <20230413064027.13267-1-jasowang@redhat.com> From: Maxime Coquelin Subject: Re: [PATCH net-next V2 0/2] virtio-net: don't busy poll for cvq command In-Reply-To: <20230413064027.13267-1-jasowang@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Spam-Status: No, score=-3.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jason, On 4/13/23 08:40, Jason Wang wrote: > Hi all: > > The code used to busy poll for cvq command which turns out to have > several side effects: > > 1) infinite poll for buggy devices > 2) bad interaction with scheduler > > So this series tries to use sleep instead of busy polling. In this > version, I take a step back: the hardening part is not implemented and > leave for future investigation. We use to aggree to use interruptible > sleep but it doesn't work for a general workqueue. > > Please review. Thanks for working on this. My DPDK VDUSE RFC missed to set the interrupt, as Xuan Zhou highlighted it makes the vdpa dev add/del commands to freeze: [<0>] device_del+0x37/0x3d0 [<0>] device_unregister+0x13/0x60 [<0>] unregister_virtio_device+0x11/0x20 [<0>] device_release_driver_internal+0x193/0x200 [<0>] bus_remove_device+0xbf/0x130 [<0>] device_del+0x174/0x3d0 [<0>] device_unregister+0x13/0x60 [<0>] vdpa_nl_cmd_dev_del_set_doit+0x66/0xe0 [vdpa] [<0>] genl_family_rcv_msg_doit.isra.0+0xb8/0x100 [<0>] genl_rcv_msg+0x151/0x290 [<0>] netlink_rcv_skb+0x54/0x100 [<0>] genl_rcv+0x24/0x40 [<0>] netlink_unicast+0x217/0x340 [<0>] netlink_sendmsg+0x23e/0x4a0 [<0>] sock_sendmsg+0x8f/0xa0 [<0>] __sys_sendto+0xfc/0x170 [<0>] __x64_sys_sendto+0x20/0x30 [<0>] do_syscall_64+0x59/0x90 [<0>] entry_SYSCALL_64_after_hwframe+0x72/0xdc Once fixed on DPDK side (you can use my vduse_v1 branch [0] for testing), it works fine: Tested-by: Maxime Coquelin For the potential missing interrupt with non-compliant devices, I guess it could be handled with the hardening work as same thing could happen if the VDUSE application crashed for example. Regards, Maxime [0]: > Thanks > > Changes since V1: > - use RTNL to synchronize rx mode worker > - use completion for simplicity > - don't try to harden CVQ command > > Changes since RFC: > > - switch to use BAD_RING in virtio_break_device() > - check virtqueue_is_broken() after being woken up > - use more_used() instead of virtqueue_get_buf() to allow caller to > get buffers afterwards > - break the virtio-net device when timeout > - get buffer manually since the virtio core check more_used() instead > > Jason Wang (2): > virtio-net: convert rx mode setting to use workqueue > virtio-net: sleep instead of busy waiting for cvq command > > drivers/net/virtio_net.c | 76 ++++++++++++++++++++++++++++++++++------ > 1 file changed, 66 insertions(+), 10 deletions(-) >