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 C8B00FBF6 for ; Mon, 15 May 2023 17:50:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 257F9C433D2; Mon, 15 May 2023 17:50:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1684173056; bh=0NafhIwVhWKyk/E6RD3DBPo4TZc+fKicmxkNU6aoy5Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PZ86B2k8mCLZMJoi/2ZXjeQJunNqRrm5iSWHuvmmhSRIcbGKc1t8t29OQhgjUUsvd litlWHzZXzK8PNJK00mBiZDCh0eH2FCOsQ3brUsA5xkqW6fU8AJrpVzPR7No60EHWK HCeEaCP0hujNXiuUCW9dmxvNHL7xc341TOGqqTIU= 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.10 326/381] virtio_net: suppress cpu stall when free_unused_bufs Date: Mon, 15 May 2023 18:29:37 +0200 Message-Id: <20230515161751.526906244@linuxfoundation.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230515161736.775969473@linuxfoundation.org> References: <20230515161736.775969473@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 75219c8f4a63e..119a32f34b539 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -2777,12 +2777,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