From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5BB1E17730 for ; Mon, 15 May 2023 18:04:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A1094C433D2; Mon, 15 May 2023 18:04:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1684173897; bh=nQORE5W4ginFr1jU/UwbyPYMhs+f07NBBLHya7FjedA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c4rvml0d1A0yc83Q8DIqUYDN6KLwHBtfieNNFWNMhpkxyDF10ErRR7EfqH6UOGcgf SA75KAkWXtnItTotlzholy0X1VBWuOSPKkLNmvm72uXSEFYc6rsIGO9WRuN2n1zOyf ak6WJkcERIba15y7vX3FCUOZ9ELpHaQCz9Qng0zU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Wenliang Wang , "Michael S. Tsirkin" , "David S. Miller" , Sasha Levin Subject: [PATCH 5.4 234/282] virtio_net: suppress cpu stall when free_unused_bufs Date: Mon, 15 May 2023 18:30:12 +0200 Message-Id: <20230515161729.238567164@linuxfoundation.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230515161722.146344674@linuxfoundation.org> References: <20230515161722.146344674@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Wenliang Wang [ Upstream commit f8bb5104394560e29017c25bcade4c6b7aabd108 ] For multi-queue and large ring-size use case, the following error occurred when free_unused_bufs: rcu: INFO: rcu_sched self-detected stall on CPU. Fixes: 986a4f4d452d ("virtio_net: multiqueue support") Signed-off-by: Wenliang Wang Acked-by: Michael S. Tsirkin Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/virtio_net.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index b77181f04b119..7922e833620e8 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -2822,12 +2822,14 @@ static void free_unused_bufs(struct virtnet_info *vi) struct virtqueue *vq = vi->sq[i].vq; while ((buf = virtqueue_detach_unused_buf(vq)) != NULL) virtnet_sq_free_unused_buf(vq, buf); + cond_resched(); } for (i = 0; i < vi->max_queue_pairs; i++) { struct virtqueue *vq = vi->rq[i].vq; while ((buf = virtqueue_detach_unused_buf(vq)) != NULL) virtnet_rq_free_unused_buf(vq, buf); + cond_resched(); } } -- 2.39.2