Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp38359rwj; Wed, 21 Dec 2022 22:37:38 -0800 (PST) X-Google-Smtp-Source: AMrXdXvNEuXU+edF5XlbkSFtv4B14Es4usRZ5WPRmP2gD2oieirGBTIHTGEwLoJSqNosLzEsdMa/ X-Received: by 2002:a17:906:414c:b0:7c0:d606:c570 with SMTP id l12-20020a170906414c00b007c0d606c570mr8085044ejk.61.1671691058265; Wed, 21 Dec 2022 22:37:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671691058; cv=none; d=google.com; s=arc-20160816; b=hInHirJTeLk02LjJG6qD87Gy49STfxU+72xf/9TifCwP3R4y9nE5+XpDM8IG7kEtD1 XBI5xxltTIWuGnu/7Js85W5LnKcg0YJtnwATRiRmIqSJWNHUDK6MAhh8D/mS4plar9fH mbQD1JByD7u+fEkWu5qj1swb06mQwl2VztvrXva0Wv3GsN/KJAk/48qwagreTaTU/YAN d/B7fz1jYXQJOBuGGZjFUK75IKkKG4uC5HDEin1f+3dKVdwUVFV/vwMXClDjCWwtttwN FlfbxBVI/yblnbUS1uf3VNooY6Xayy1f72Sd0nO5udImwwU8Cm+qLwO+Tfg5jl9vfs4Z QoMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=xrsqGz7chPZ2KmKpMG8QR1W3lTlHGgi0D+G+V4JZPLQ=; b=dR2yrD0XOkm674Yc91QRStarUJcTaL+sQCxNpqBxJQIwlbcSeQpdpZjD2DO+hQzhQG RkPJzSl5yVsS9/gK3fvUT2jyeujdDkC2OghSJr5hzOUWQzjbceTF1D/hKVFGOlIGUHM0 Lo+Xyh3vbA1gWCZhwnWFhTyqygLzd6hCQS5GJ4qN2YDy4s1ZJyqiAxk3qa3blhXeatTd Cegb/CbtNODLGeWJ0yLhSGWph08hcMQE8NNe6BBaG4APJCB/nNeXAKn46t4g8MuzczWn pVoP2zWZGERUPi6dLnclCgoA4Ly8/5MURwZCoyLaVQ76/SGpY0P5M/fEorDPZIzarbVg nJzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=iImIyes7; 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 hs14-20020a1709073e8e00b0080b2de32a22si12651374ejc.454.2022.12.21.22.37.22; Wed, 21 Dec 2022 22:37:38 -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=@redhat.com header.s=mimecast20190719 header.b=iImIyes7; 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 S235033AbiLVGFa (ORCPT + 67 others); Thu, 22 Dec 2022 01:05:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231892AbiLVGF1 (ORCPT ); Thu, 22 Dec 2022 01:05:27 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4119612D36 for ; Wed, 21 Dec 2022 22:04:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1671689080; 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; bh=xrsqGz7chPZ2KmKpMG8QR1W3lTlHGgi0D+G+V4JZPLQ=; b=iImIyes7xYAVCGxbwG5lv3vho/bTH2+VkThpxSV6CQQjwInQ4NM+DVttPfb1ooajaUGepS Rchkt1AEphWmp+GHiy7xigoxD2FpKbThgVQcn4GMJLCckC42QjkiZOWaA5EPQc7tZYTmvf FauQtTVWsJtAfYB8Q8daPZK4vplrcP0= 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-563-WY9h8Mx9PDWA6rvdtnC63g-1; Thu, 22 Dec 2022 01:04:37 -0500 X-MC-Unique: WY9h8Mx9PDWA6rvdtnC63g-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5F8C91C0514F; Thu, 22 Dec 2022 06:04:36 +0000 (UTC) Received: from localhost.localdomain (ovpn-13-179.pek2.redhat.com [10.72.13.179]) by smtp.corp.redhat.com (Postfix) with ESMTP id 89948112132C; Thu, 22 Dec 2022 06:04:29 +0000 (UTC) From: Jason Wang To: mst@redhat.com, jasowang@redhat.com Cc: 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, alvaro.karsz@solid-run.com, eperezma@redhat.com Subject: [RFC PATCH 0/4] virtio-net: don't busy poll for cvq command Date: Thu, 22 Dec 2022 14:04:23 +0800 Message-Id: <20221222060427.21626-1-jasowang@redhat.com> MIME-Version: 1.0 Content-type: text/plain Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 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 + timeout instead of busy polling. Please review. Thanks Jason Wang (4): virtio-net: convert rx mode setting to use workqueue virtio_ring: switch to use BAD_RING() virtio_ring: introduce a per virtqueue waitqueue virtio-net: sleep instead of busy waiting for cvq command drivers/net/virtio_net.c | 79 +++++++++++++++++++++++++++++++----- drivers/virtio/virtio_ring.c | 33 ++++++++++++++- include/linux/virtio.h | 4 ++ 3 files changed, 105 insertions(+), 11 deletions(-) -- 2.25.1