From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4E6E2C43460 for ; Tue, 13 Apr 2021 08:53:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3142C6135C for ; Tue, 13 Apr 2021 08:53:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230004AbhDMIyN (ORCPT ); Tue, 13 Apr 2021 04:54:13 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:35251 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243812AbhDMIyE (ORCPT ); Tue, 13 Apr 2021 04:54:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618304025; 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: in-reply-to:in-reply-to:references:references; bh=LDhoSh21yQrWIxiZzfscdfh5hO+ef3/ijfa5Lxrgzu8=; b=IyIxUIslQmFm7Ti9NSAMWRUvyFDMBVF1eU8j+yoZsRodihxh31/H8duSKi3rkphwNOYGXX l1q9ESRtoF8/8JU7X+tbAIDqRBMPhA5jhycXfAKPUmhjEd2dJLkp4lj4JWscZbjTwekqW1 AebpzkuGZtIEqo01adRfeZDoURQbDdY= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-435-ucyBEUMsMZS0xJSAi2JD3Q-1; Tue, 13 Apr 2021 04:53:41 -0400 X-MC-Unique: ucyBEUMsMZS0xJSAi2JD3Q-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0D7B010054F6; Tue, 13 Apr 2021 08:53:40 +0000 (UTC) Received: from wangxiaodeMacBook-Air.local (ovpn-13-128.pek2.redhat.com [10.72.13.128]) by smtp.corp.redhat.com (Postfix) with ESMTP id 37A2D1C952; Tue, 13 Apr 2021 08:53:33 +0000 (UTC) Subject: Re: [PATCH RFC v2 2/4] virtio_net: disable cb aggressively To: "Michael S. Tsirkin" , linux-kernel@vger.kernel.org Cc: Jakub Kicinski , Wei Wang , David Miller , netdev@vger.kernel.org, Willem de Bruijn , virtualization@lists.linux-foundation.org References: <20210413054733.36363-1-mst@redhat.com> <20210413054733.36363-3-mst@redhat.com> From: Jason Wang Message-ID: <43db5c1e-9908-55bb-6d1a-c6c8d71e2315@redhat.com> Date: Tue, 13 Apr 2021 16:53:32 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.9.1 MIME-Version: 1.0 In-Reply-To: <20210413054733.36363-3-mst@redhat.com> Content-Type: text/plain; charset=gbk; format=flowed Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ÔÚ 2021/4/13 ÏÂÎç1:47, Michael S. Tsirkin дµÀ: > There are currently two cases where we poll TX vq not in response to a > callback: start xmit and rx napi. We currently do this with callbacks > enabled which can cause extra interrupts from the card. Used not to be > a big issue as we run with interrupts disabled but that is no longer the > case, and in some cases the rate of spurious interrupts is so high > linux detects this and actually kills the interrupt. > > Fix up by disabling the callbacks before polling the tx vq. > > Signed-off-by: Michael S. Tsirkin > --- > 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 82e520d2cb12..16d5abed582c 100644 > --- a/drivers/net/virtio_net.c > +++ b/drivers/net/virtio_net.c > @@ -1429,6 +1429,7 @@ static void virtnet_poll_cleantx(struct receive_queue *rq) > return; > > if (__netif_tx_trylock(txq)) { > + virtqueue_disable_cb(sq->vq); > free_old_xmit_skbs(sq, true); > __netif_tx_unlock(txq); Any reason that we don't need to enable the cb here? And as we discussed in the past, it's probably the time to have a single NAPI for both tx and rx? Thanks > } > @@ -1582,6 +1583,7 @@ static netdev_tx_t start_xmit(struct sk_buff *skb, struct net_device *dev) > bool use_napi = sq->napi.weight; > > /* Free up any pending old buffers before queueing new ones. */ > + virtqueue_disable_cb(sq->vq); > free_old_xmit_skbs(sq, false); > > if (use_napi && kick)