Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp49957rwj; Wed, 21 Dec 2022 22:51:53 -0800 (PST) X-Google-Smtp-Source: AMrXdXtzckDjvX9qnoGXH4tYaaLeso2WemH7lunsHOU4zZ6UkAtxy0VHdtfDW3rAfZhBF3z1GSus X-Received: by 2002:a17:906:ccc7:b0:7c4:a773:4d72 with SMTP id ot7-20020a170906ccc700b007c4a7734d72mr3854773ejb.64.1671691912988; Wed, 21 Dec 2022 22:51:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671691912; cv=none; d=google.com; s=arc-20160816; b=vlxbbk5CAQP9fjmMuVcc0gXiP73JC661GXgxMfjzBTEBtvzbIw+xMNqodi6o1eJYPY oemxfgcQ7jFRjgE2dPxl6vO02aA2Sq6jXT9DdV0SeTOLRiawHVmHpwLL0ckt2KhvLAOs WitKKjPgkwlNjZhSBLjkIMRflFyEcQ6xJymu0Sg51c9Gke0v69maNEr3aEYID3PBXAxi Bbs1sIRFthLx3ssdqCeq0E5MV4PInA1k27edxeUz37SLxqg94MzOi93MIe84XURO4cEY Lp5D9BkPlqfkMLRlEt30aU5pKhLkJoqpOgSGNJP+B4mAK8uyPuBXyNQrrgIcLNcfDrA4 Zdqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=086dsIWiKVuDdE5qHTcupmnKCG4y2yzrnr4Huev2NRw=; b=QJqlISa8n4K7QK6zNFa7yymmIXGU0iUJeElQj0lKaJUZt/RYPc+JldghbTYfIpuQd+ WVok+hf2Apx3HrkCCw/cE6EJ9j5KSvcji0Npyr3DV59nQ0TSjoLrfr0+6SCpRB/q7WYK b9Ll9tq01r0buRt7hGHtXtUNk4PArSYD44pVvhDBYIH94G+6TiZ5BSjl3zj0do1Pyuh/ nt1Vp88VrB93KdtyjM8IexmFm/R7TtLdyt1QwKA9OmWCTH29unFsy1r/Xi+xRS2+mrt1 riWaOVmRqyJ7nyzUrkQoPH/quMzaDtuhVCDwZeYpTdEuXwwDE4pHP7Hw8avgN1uiW340 07Lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@solid-run-com.20210112.gappssmtp.com header.s=20210112 header.b=UtaOxFFL; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ds22-20020a170907725600b0073d5f9aa5e9si1055093ejc.327.2022.12.21.22.51.37; Wed, 21 Dec 2022 22:51:52 -0800 (PST) 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=@solid-run-com.20210112.gappssmtp.com header.s=20210112 header.b=UtaOxFFL; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234932AbiLVGox (ORCPT + 67 others); Thu, 22 Dec 2022 01:44:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229742AbiLVGow (ORCPT ); Thu, 22 Dec 2022 01:44:52 -0500 Received: from mail-pg1-x533.google.com (mail-pg1-x533.google.com [IPv6:2607:f8b0:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66CD52189C for ; Wed, 21 Dec 2022 22:44:51 -0800 (PST) Received: by mail-pg1-x533.google.com with SMTP id 7so745848pga.1 for ; Wed, 21 Dec 2022 22:44:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=solid-run-com.20210112.gappssmtp.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=086dsIWiKVuDdE5qHTcupmnKCG4y2yzrnr4Huev2NRw=; b=UtaOxFFLchWt5Jb/3Qqzm81/vYaqvIO89JpWehCUn/CUHFGzoM5mnpGGBFlYqQAoGd HNaC4hz9Wsd4cdrkLx4Nc3B37RZeAXNTTbWL+/LYmA84syobG+0riP0NUwuuMOLk0vM9 31gmckA5xEiwm+8UXywQe5qkGm3622bwgeIVe534hNeHlbnrHCysSoCqhjwrJwPlkRNH xmSbqkhkZGSyFCxhD8DJcIVlOqa5aOvOkcRUxPZKzzjMp46TLQ3zogc3AjHVRg2Hd/hE u7zVrjzMsbBqYzgul0riADWu8PTfE+0rGq7xHVnf0NatXFT2v3uTvvZPalPduYNE26Vg GhsQ== 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:subject:date:message-id :reply-to; bh=086dsIWiKVuDdE5qHTcupmnKCG4y2yzrnr4Huev2NRw=; b=c7ptD69GR4XzK1Htj8HngE9WA9JUaAFslTZpOQNC4Sup+chbNJ/th+U5PzKJlzdK/w lm47AlwNJlf9XkPQ9eGI3YU6twYKGNoFFsefDVGSXI9Um4S39exU+j5ovqom5Q6iEwTC gStXm9YA2bls8qKLpUdARZdic22IQTiXUx+DBOrebdE6iSrXY4DK6nY7HKUmH2j/rRtC du/x8JTVGVy0ZPqQAgUkDTbh3dMGhxEuFO0PAemrC4kSEwJQoPRykifmvPqlg5wMzebP MOc3KYqN9AvPmQfpEZ7Fy8x7snUnfPQkKBxuXgpQF/qw2buu4dY++OOMcmsgpIl1Gshp pPcA== X-Gm-Message-State: AFqh2kqkurQzAq1qpCP7FIvMqm7jbid7BiN+ZjowLenp9FPTqnuTJYZ0 VdW1CecWnonGvPjOPe9W/8nwGQ9QPg5EeUAHqTfBIQ== X-Received: by 2002:a65:45c8:0:b0:48c:5903:2f5b with SMTP id m8-20020a6545c8000000b0048c59032f5bmr224962pgr.504.1671691490591; Wed, 21 Dec 2022 22:44:50 -0800 (PST) MIME-Version: 1.0 References: <20221222060427.21626-1-jasowang@redhat.com> <20221222060427.21626-5-jasowang@redhat.com> In-Reply-To: <20221222060427.21626-5-jasowang@redhat.com> From: Alvaro Karsz Date: Thu, 22 Dec 2022 08:44:12 +0200 Message-ID: Subject: Re: [RFC PATCH 4/4] virtio-net: sleep instead of busy waiting for cvq command To: Jason Wang Cc: mst@redhat.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, maxime.coquelin@redhat.com, eperezma@redhat.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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, Adding timeout to the cvq is a great idea IMO. > - /* Spin for a response, the kick causes an ioport write, trapping > - * into the hypervisor, so the request should be handled immediately. > - */ > - while (!virtqueue_get_buf(vi->cvq, &tmp) && > - !virtqueue_is_broken(vi->cvq)) > - cpu_relax(); > + virtqueue_wait_for_used(vi->cvq, &tmp); Do you think that we should continue like nothing happened in case of a timeout? Shouldn't we reset the device? What happens if a device completes the control command after timeout? Thanks Alvaro