Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp5080536rwb; Sun, 22 Jan 2023 02:58:46 -0800 (PST) X-Google-Smtp-Source: AMrXdXs+aJp3GOXPAJlQsjxxpX8fUlJi6lVnrryyMvFbRJqy81NikMfxByeEX+bzG6K7u7O+EJCb X-Received: by 2002:a05:6402:221b:b0:493:a6eb:874f with SMTP id cq27-20020a056402221b00b00493a6eb874fmr21036204edb.7.1674385126357; Sun, 22 Jan 2023 02:58:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674385126; cv=none; d=google.com; s=arc-20160816; b=gSfTHuKk011TmM05lgJN4mmKahj0uguJk8fSmDRWFj4mlVpkJTUr7ElmkVfJ1O3Cxk Nig8XWsG59beUzGTpoovMWsJxBbL3LfykZXY2CT6lKhJU5yyTkNK/pyWpS0Msy2Ak/Ac VL9Ppei4ptghsRS3OSHdiBDWBSikn3uUbBgLvLbCMLmWHO1aU1pHk+dUyGzFn1AaS1Gj IOQ7koBkXc/SOX4+v5Q0D5iz4uHQfw3J0ZPeUZDKMrZb+UmvnFeCRSPBxP+/LlNvW7iB bmQ7N2q2fDPQnaptGqdBxUylh8nE+D3+oz8X6au9t47zfYznYVlQ3hlQFcw75YHptXl6 0p4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:ui-outboundreport:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=VgDqWiMM6KtRMPRMoSoimYKKvVxPzbRji529n4WiuOg=; b=WUHC68S6mY6YlyzydV5omnAjRIQBJo8UbU2MdeRS4C95s39Pu1SUedJI5eTJc0iqxf tVrxLP7+i9cP7mHh69Bn+oNtUH30eVa3p09MCIE3ATRYjkPoFWYc2Y0P60a8YE95y4Lm 1XsJlpZSwMG55rqL62Er8h0ybg4JS9ygKqP352NS0WYHQjfBe4rZK2qZFZs6pyH+zlj8 dP846D+fBdx0rzfHqyT6ihJ1WTZc45pEdgpX2/rK27FOnq0dQHZMkdQq/mcQGBvxMfh2 6yj4VbGC1YYfNcPNOVEXlXw7O58mIYW4LkU2VQkhvI7CuOXgyaxunAZOmOl5rr7pNItp CCoQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (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 wy10-20020a170906fe0a00b0084d37a7d9casi24989293ejb.187.2023.01.22.02.58.33; Sun, 22 Jan 2023 02:58:46 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229970AbjAVKMA (ORCPT + 50 others); Sun, 22 Jan 2023 05:12:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229966AbjAVKLw (ORCPT ); Sun, 22 Jan 2023 05:11:52 -0500 X-Greylist: delayed 318 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Sun, 22 Jan 2023 02:11:03 PST Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C109C1D90F; Sun, 22 Jan 2023 02:11:03 -0800 (PST) Received: from lenovo-t14s.redhat.com ([82.142.8.70]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MqINP-1oy0341K9z-00nPdI; Sun, 22 Jan 2023 11:05:33 +0100 From: Laurent Vivier To: linux-kernel@vger.kernel.org Cc: "Michael S. Tsirkin" , Parav Pandit , virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, Eli Cohen , Jason Wang , Gautam Dawar , Cindy Lu , "David S. Miller" , =?UTF-8?q?Eugenio=20P=C3=A9rez?= Subject: [PATCH 4/4] virtio_net: fix virtnet_send_command() with vdpa_sim_net Date: Sun, 22 Jan 2023 11:05:26 +0100 Message-Id: <20230122100526.2302556-5-lvivier@redhat.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230122100526.2302556-1-lvivier@redhat.com> References: <20230122100526.2302556-1-lvivier@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K1:YTjFLU1lj+k8vApmSwkjqxN3EBr0drRgQSUre+RfcDGSw4uTA+0 fpObHvWK8k3li6YWyS80RiUZHOX8MywdgaDytn/6t8T+DiaynYAOSnUv/FWk1HaQEOmrj5S KrovGMPtwrXHOQlFb5ZB7KBF2sy6BQdtTORgHlq35jPyVn4D7dbru2lBJVeYHfpcThtGErb +Fr/sA0/vvb/ZKDcaf4ag== UI-OutboundReport: notjunk:1;M01:P0:W/8CbaMJfHI=;CztS2YeNk03sPaZQmk0pcBJ6L43 XcTq3jVYTR1mPvip15m9kRcm4gx/fCYvZXXAiserRgQ9GFMVi/1LZ0b4jQkbYecKpXXQ+1YOU rBpVaXPROlsifSO1bNiEiHYAbudG2KcSeHDa4oueEPlBlJpIcVfy5U+3ZlKYLxT5ZRzdg50Qs g/IdVtnBO6yU19WOFGc0dYdOtjbIpFy66HsEykChNF0WWHZQhrOOJ2WhiAuzsvuBRJTgO05cc GLWOboaYKXGeWF74daHubX+BlE1K7ZZS9qZ6sIRQ2qMZO+rA8owLFae2Y/cg3W80pIRcNgW47 jkd67qMPk0vZjxCO9UrPIK3Tls1BKbZ2u91VxEMWay+YYAE1RqV/NhWBUjZ85vf/Jua4dzf9u UzzD3cflGJ9vqwlR003dHr1chEHCC6R+ff7po0WY+C8azbOlMMlJlx4lV5ntjVsWQkQgVzihl cgg+JKelqfGLSQlRJBSx6aNgedhV/zvuqXKnNPGdNSttYep61gKReoyF4gEDLnVmvpkLkjVzM nlV+b2ig0YvJfYiuFp4QMmD4FiCpy5+9MDcBhXTpaiIDFvMhaMsPdgwPCARDGRKYR8/7oPQku F5Nzmv3rfaax47qfuviRX2Dq8X+FsMmh0fbGYELuiT9zFEea8uCwaEwaW4BsNrsCbbzen8UtB xzMSe0bE+Kdl8LxR2gO5YF/TUzIUv4hfj3/YxuuEzA== X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,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 virtnet_send_command() sends a command to the control virtqueue by adding the command to the virtqueue, kicking the queue and waiting in a loop. The vdpa simulator simulates the control virqueue using a work queue: the virqueue_kick() calls schedule_work() to start the queue processing. But as virtnet_send_command() uses a loop, the scheduler cannot schedule the workqueue and the virtqueue is never processed (and the command never executed). To fix that, replace in the loop the cpu_relax() by a schedule(). Signed-off-by: Laurent Vivier --- drivers/net/virtio_net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 29b3cc72082d..546c0b2baaca 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -2011,7 +2011,7 @@ static bool virtnet_send_command(struct virtnet_info *vi, u8 class, u8 cmd, while (!virtqueue_get_buf(vi->cvq, &tmp) && !virtqueue_is_broken(vi->cvq) && !time_after(jiffies, timeout)) - cpu_relax(); + schedule(); return vi->ctrl->status == VIRTIO_NET_OK; } -- 2.39.0