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=-16.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 CFE5FC433B4 for ; Thu, 13 May 2021 15:22:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AEBB2613BF for ; Thu, 13 May 2021 15:22:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234783AbhEMPXh (ORCPT ); Thu, 13 May 2021 11:23:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:39558 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232548AbhEMPXe (ORCPT ); Thu, 13 May 2021 11:23:34 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3684F61182; Thu, 13 May 2021 15:22:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1620919344; bh=/M7gWU9HaLG6QbJqmridKAEJyvcI1IJcmogeYbUoJ+U=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=iukByoWv+Aaq41EUuIYacG4iI7RjoJH+Dv+T3aIsAibxD6+BWgk/crbhd2LbCde7a lQJuVfSIJjjW+ha/iQ90zSXeJ24s6SuZdG4+KYs7mRYRuMVqUAw2zjZ5ddvv5ixI5c akmBnutSNwWueOUI9l5d+0c14qkd5ZK75Z2eJDUIDu/oI3G76zjdm5bL1QfZA+LvtR VwivSTFOzL3OanSzxBaJmVXsEPpXK87m5GbwriuVV7ClD48vvVyDjDXP5MsTCIfYli vV65c/PLopqhwV7E3xueEGqoiJ75yUY2i4tawdqBSK0g4AfKEVb6McH6ii7aXsRqLc +RBpqtIo2cf2w== Date: Thu, 13 May 2021 08:22:22 -0700 From: Jakub Kicinski To: Yunsheng Lin Cc: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: Re: [PATCH net v7 3/3] net: sched: fix tx action reschedule issue with stopped queue Message-ID: <20210513082222.3b23d3a3@kicinski-fedora-PC1C0HJN> In-Reply-To: <1620868260-32984-4-git-send-email-linyunsheng@huawei.com> References: <1620868260-32984-1-git-send-email-linyunsheng@huawei.com> <1620868260-32984-4-git-send-email-linyunsheng@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org On Thu, 13 May 2021 09:11:00 +0800 Yunsheng Lin wrote: > The netdev qeueue might be stopped when byte queue limit has > reached or tx hw ring is full, net_tx_action() may still be > rescheduled endlessly if STATE_MISSED is set, which consumes > a lot of cpu without dequeuing and transmiting any skb because > the netdev queue is stopped, see qdisc_run_end(). > > This patch fixes it by checking the netdev queue state before > calling qdisc_run() and clearing STATE_MISSED if netdev queue is > stopped during qdisc_run(), the net_tx_action() is recheduled > again when netdev qeueue is restarted, see netif_tx_wake_queue(). > > As there is time window betewwn netif_xmit_frozen_or_stopped() > checking and STATE_MISSED clearing, between which STATE_MISSED > is set by net_tx_action() scheduled by netif_tx_wake_queue(), > so set the STATE_MISSED again if netdev queue is restarted. > > Fixes: 6b3ba9146fe6 ("net: sched: allow qdiscs to handle locking") > Reported-by: Michal Kubecek > Signed-off-by: Yunsheng Lin > @@ -35,6 +35,25 @@ > const struct Qdisc_ops *default_qdisc_ops = &pfifo_fast_ops; > EXPORT_SYMBOL(default_qdisc_ops); > > +static void qdisc_maybe_stop_tx(struct Qdisc *q, nit: qdisc_maybe_clear_missed()?