Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2003896rwl; Wed, 12 Apr 2023 23:43:43 -0700 (PDT) X-Google-Smtp-Source: AKy350ZbDiKBq8agzpFrcJQFQmQAUjFigYltbq2Kw7s1UwZpPGfKQK75j/cYe3toOKFAJfmPVFjw X-Received: by 2002:a17:907:779a:b0:94a:514c:f1c8 with SMTP id ky26-20020a170907779a00b0094a514cf1c8mr1795628ejc.32.1681368222896; Wed, 12 Apr 2023 23:43:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681368222; cv=none; d=google.com; s=arc-20160816; b=gy5n/0N7vIIKSZwle+SqGFMjXhPNSYcrog4ZPsC4uG4QMG9yPCyBRJwvvp/H1YnU0f SPgivroUnA7Te9kjwhSOo/Fs1pi3upFFbw4Xnqd8swkVs0/jO4b2o/z8nzDuE4WI0Jq8 TIToE39GlrfxOT0JZ60XiyxGatF4n8cOj4oBZZ1UcMmYp5sK2WAjOlJ1PSwql4AsZx8H xb3jgZTIp74ULntktVRqwDewW9Ks+Ejs/vODGV+t0leMIQ5C0GHJwqIDTKasphpz5W0v ckOsUCyIuZuBOlgMSUzcCsyLME63+5Y5yFDmt9CfVAaj1sSQtUtjMjQ3N1XmLO4FHN1j 4nnQ== 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=poCHwQPZfHA/cky6cZa5Q/phSPW/9HqD6ZSWHiw/xOY=; b=G8H5GHo7MJg6Ljtd/W1k5d4esaSCJbC/QNJMvtW4pcoxbGcMvf1oPDjXMlFZScj7AI e9QFCDEwwQcVCWk+gFBPPRx1BbyAxtbGV//2qTyx597/MH7vXfv6f76Xvw7gTGsT7H+r IbDF+7DNe47yGLJlDUMX0xN103D1lEU2+nlxMPAba128cvxL5vwwvWf9+DSp82lMDddM o81a8LMA8OYG8KlS6kLMU6nIO+OifX3xjEFI1pDQ01IRwpuSBdJhHGWGLMJhG+zlvqNQ +WB2hBxlbqavfZVkygR0cBfy8tclq+RqUp4KTm3sLKv0NZ0mcY9YhwfA3DT7vn7XCDsx CRkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=YPfiK20M; 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 fw38-20020a170907502600b0094a8e8b282fsi1056390ejc.451.2023.04.12.23.43.18; Wed, 12 Apr 2023 23:43:42 -0700 (PDT) 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=YPfiK20M; 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 S229799AbjDMGl2 (ORCPT + 99 others); Thu, 13 Apr 2023 02:41:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229596AbjDMGl1 (ORCPT ); Thu, 13 Apr 2023 02:41:27 -0400 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 218806EA0 for ; Wed, 12 Apr 2023 23:40:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681368042; 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=poCHwQPZfHA/cky6cZa5Q/phSPW/9HqD6ZSWHiw/xOY=; b=YPfiK20M9lFRUiDi3p1tKVfASIFYB4QR/elCSB9keCmUp/7qnioOs9Ta6QOFmqpXscfRGz HwsYhAXSHz5ULdbmzAp6DFMs56BB6uDwXxQtl5Scka6GMJ8YwVVfWcLLQPznzBysQpf9Uf oIg3vros/krw25Lg9sZiLvcuzaTlh34= 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-643-SR5elh1kPmmD-MDY5VVb8A-1; Thu, 13 Apr 2023 02:40:36 -0400 X-MC-Unique: SR5elh1kPmmD-MDY5VVb8A-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 025223C025B3; Thu, 13 Apr 2023 06:40:36 +0000 (UTC) Received: from localhost.localdomain (ovpn-12-72.pek2.redhat.com [10.72.12.72]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5707640C6E70; Thu, 13 Apr 2023 06:40: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, linux-kernel@vger.kernel.org, maxime.coquelin@redhat.com, alvaro.karsz@solid-run.com, eperezma@redhat.com, xuanzhuo@linux.alibaba.com, david.marchand@redhat.com Subject: [PATCH net-next V2 0/2] virtio-net: don't busy poll for cvq command Date: Thu, 13 Apr 2023 14:40:25 +0800 Message-Id: <20230413064027.13267-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.2 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 instead of busy polling. In this version, I take a step back: the hardening part is not implemented and leave for future investigation. We use to aggree to use interruptible sleep but it doesn't work for a general workqueue. Please review. Thanks Changes since V1: - use RTNL to synchronize rx mode worker - use completion for simplicity - don't try to harden CVQ command Changes since RFC: - switch to use BAD_RING in virtio_break_device() - check virtqueue_is_broken() after being woken up - use more_used() instead of virtqueue_get_buf() to allow caller to get buffers afterwards - break the virtio-net device when timeout - get buffer manually since the virtio core check more_used() instead Jason Wang (2): virtio-net: convert rx mode setting to use workqueue virtio-net: sleep instead of busy waiting for cvq command drivers/net/virtio_net.c | 76 ++++++++++++++++++++++++++++++++++------ 1 file changed, 66 insertions(+), 10 deletions(-) -- 2.25.1