Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1092321rwd; Thu, 8 Jun 2023 12:00:51 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5rzxdu9yxjmhFSldaRJOIJcZ15288MbTR4o/Et0UgEt5diaNzBWns3TiDdrf2gZLuBfoXU X-Received: by 2002:a05:6a21:6da4:b0:10f:d1d4:40d4 with SMTP id wl36-20020a056a216da400b0010fd1d440d4mr8264074pzb.14.1686250851259; Thu, 08 Jun 2023 12:00:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686250851; cv=none; d=google.com; s=arc-20160816; b=fW00TeDCkj/PhldRQFpN7arOdlDi57PlXuxs7RSKncWhsJL52tmmp6YK0u+LveYn0F mzEQKvckC0qf3s1oH54MakUfDEsPGHSFhhOg1L2Tz9Jsc3/V+U/WqO5wgNM9ABXWTQy5 lQKK9EBUpW84/7Y524cccdPM3cRsUMdcaZP7rRRMZDCiITaeq7AJwXaKV9e2X3NoHgd/ u9h1n/axEyujB3QOhwOly9f8tN6Hjs/KEOeXO2raTz5lvkxkyK4WKIXDblTA8/43A1/4 0UC8UEzQ4/GMqDGPeYoQEgTou8KNLHsHcQaQoByAUUWDgq82SmDXcgpTWwgRTx1kuX6n 29fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=yt12+1+dARtKc3fRLQ7ivDg1sn89g+SY2IZ1KjaiaJs=; b=o7BmK+4TAcIJy+oKe0AcC/WKD88yqjzMsCWFP5E/jeIMTqyvdLKcIxWkkQ+rCsR9eT Fr05LxirHo0dyv5MH93o1pMb7irO9DHJEnD5uZAMcGiCXa/8gg8tTbGfBX/FhLd4H08r FOdcGQfXyPVkZH3Vs7tPYQOYBEQ0JLbVvnKd2o6ALThmYvjSg+ffbWcE1KquDP0xXi03 E3t4mZXUfuKwM3EcNtYXi8d3fbFWRJBbn9GkJkxsOY5Bm0WOt7t20rYdZRKBIAm/YssS WJOadgpTKlu3SUIC9lSch2F6z80Fksr7XU1+d1rXCqnMzXRu068XLfmGFVIkJwRBGqNu YH8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mojatatu-com.20221208.gappssmtp.com header.s=20221208 header.b=0sPZpYtC; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 7-20020a630107000000b00537d3adaa10si1341524pgb.597.2023.06.08.12.00.37; Thu, 08 Jun 2023 12:00:51 -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=@mojatatu-com.20221208.gappssmtp.com header.s=20221208 header.b=0sPZpYtC; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231308AbjFHSpB (ORCPT + 99 others); Thu, 8 Jun 2023 14:45:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230290AbjFHSpA (ORCPT ); Thu, 8 Jun 2023 14:45:00 -0400 Received: from mail-ot1-x331.google.com (mail-ot1-x331.google.com [IPv6:2607:f8b0:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B07D193 for ; Thu, 8 Jun 2023 11:44:58 -0700 (PDT) Received: by mail-ot1-x331.google.com with SMTP id 46e09a7af769-6b13e2af122so10855a34.2 for ; Thu, 08 Jun 2023 11:44:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mojatatu-com.20221208.gappssmtp.com; s=20221208; t=1686249898; x=1688841898; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=yt12+1+dARtKc3fRLQ7ivDg1sn89g+SY2IZ1KjaiaJs=; b=0sPZpYtCx2uIcWQN2SI/AEQ/WWZcXhOA/di7WAeDir9+IxajPlSiVl+Hm2Chzremmo dNc1GyBIQugOsTs0Op4y9GnHpYJA6Lk2SzxfAFqSh7gT18FVPy6ip84ibVOzTAH/UfUA ZvZjqPRxbDJ1qCdiplb3WeEslaA6HHFH8lOx/eE5silGncLGYYiL5xP/SkdO+VG6Dm5D 1eFQ20JbZf12nZYUu92bxsTJf6ot+K12YXjoCdFGJuDefST2cgBxazwwt2XthTgYPA/o sHIPKcuZ2bM83dfwq5rhxfjHleCZJVwihFvLBLGwll/oJeiCqDdp3ptsYVl+seJdxQ30 YSqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686249898; x=1688841898; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yt12+1+dARtKc3fRLQ7ivDg1sn89g+SY2IZ1KjaiaJs=; b=WBcHH96ylf5kB+2IH5Z9xmBMH17REBirvfVX5PYtlrufoYw0C+/Rtku/+VdbBkqYUf 2C/IePV1nKhJvylGdhFys9ETuVSVJqDW96dVUAjMFMu9ugjjgNxitcsWhzvw3rz/jKG8 E7twc5GIgFZXxos1jqAD6xn2KAi7dT9ZhVhpVmoifR28IYNFEL1unzx4swOhoOxT1J6X RqsfCw5E3BpavykhgiL0n8r/UGicv1GNaGUlUaiL952B5lfZWqmTqKzCTLO5Zq3JsvzQ yTuaAzf0Kj7ji0y4VP/KSsm5S1wflX/wxAJg2hDfpzpc/k8+clhhkx6YafU3HI6/XazS yxZQ== X-Gm-Message-State: AC+VfDxZE9F/t+/iMzIi43mTqVXJwd/rV9MfUnFBhFdQZy1FaUsCyFUX DCkPGAyPcdVB/7GxYMZgveC0U3OKX4qInZmM6Z/q6Q== X-Received: by 2002:a05:6359:a9b:b0:129:b9a9:7858 with SMTP id em27-20020a0563590a9b00b00129b9a97858mr3725483rwb.3.1686249897389; Thu, 08 Jun 2023 11:44:57 -0700 (PDT) MIME-Version: 1.0 References: <20230602103750.2290132-1-vladimir.oltean@nxp.com> <20230602103750.2290132-6-vladimir.oltean@nxp.com> In-Reply-To: <20230602103750.2290132-6-vladimir.oltean@nxp.com> From: Jamal Hadi Salim Date: Thu, 8 Jun 2023 14:44:46 -0400 Message-ID: Subject: Re: [PATCH RESEND net-next 5/5] net/sched: taprio: dump class stats for the actual q->qdiscs[] To: Vladimir Oltean Cc: netdev@vger.kernel.org, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Cong Wang , Jiri Pirko , Vinicius Costa Gomes , linux-kernel@vger.kernel.org, intel-wired-lan@lists.osuosl.org, Muhammad Husaini Zulkifli , Peilin Ye , Pedro Tammela Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 On Fri, Jun 2, 2023 at 6:38=E2=80=AFAM Vladimir Oltean wrote: > > This makes a difference for the software scheduling mode, where > dev_queue->qdisc_sleeping is the same as the taprio root Qdisc itself, > but when we're talking about what Qdisc and stats get reported for a > traffic class, the root taprio isn't what comes to mind, but q->qdiscs[] > is. > > To understand the difference, I've attempted to send 100 packets in > software mode through traffic class 0 (they are in the Qdisc's backlog), > and recorded the stats before and after the change. > Other than the refcount issue i think the approach looks reasonable to me. The stats before/after you are showing below though are interesting; are you showing a transient phase where packets are temporarily in the backlog. Typically the backlog is a transient phase which lasts a very short period. Maybe it works differently for taprio? I took a quick look at the code and do see to decrement the backlog in the dequeue, so if it is not transient then some code path is not being hit. Aside: I realize you are busy - but if you get time and provide some sample tc command lines for testing we could help create the tests for you, at least the first time. The advantage of putting these tests in tools/testing/selftests/tc-testing/ is that there are test tools out there that run these tests and so regressions are easier to catch sooner. cheers, jamal > Here is before: > > $ tc -s class show dev eth0 > class taprio 8001:1 root leaf 8001: > Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) > backlog 9400b 100p requeues 0 > Window drops: 0 > class taprio 8001:2 root leaf 8001: > Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) > backlog 9400b 100p requeues 0 > Window drops: 0 > class taprio 8001:3 root leaf 8001: > Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) > backlog 9400b 100p requeues 0 > Window drops: 0 > class taprio 8001:4 root leaf 8001: > Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) > backlog 9400b 100p requeues 0 > Window drops: 0 > class taprio 8001:5 root leaf 8001: > Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) > backlog 9400b 100p requeues 0 > Window drops: 0 > class taprio 8001:6 root leaf 8001: > Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) > backlog 9400b 100p requeues 0 > Window drops: 0 > class taprio 8001:7 root leaf 8001: > Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) > backlog 9400b 100p requeues 0 > Window drops: 0 > class taprio 8001:8 root leaf 8001: > Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) > backlog 9400b 100p requeues 0 > Window drops: 0 > > and here is after: > > class taprio 8001:1 root > Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) > backlog 9400b 100p requeues 0 > Window drops: 0 > class taprio 8001:2 root > Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) > backlog 0b 0p requeues 0 > Window drops: 0 > class taprio 8001:3 root > Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) > backlog 0b 0p requeues 0 > Window drops: 0 > class taprio 8001:4 root > Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) > backlog 0b 0p requeues 0 > Window drops: 0 > class taprio 8001:5 root > Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) > backlog 0b 0p requeues 0 > Window drops: 0 > class taprio 8001:6 root > Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) > backlog 0b 0p requeues 0 > Window drops: 0 > class taprio 8001:7 root leaf 8010: > Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) > backlog 0b 0p requeues 0 > Window drops: 0 > class taprio 8001:8 root > Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) > backlog 0b 0p requeues 0 > Window drops: 0 > > The most glaring (and expected) difference is that before, all class > stats reported the global stats, whereas now, they really report just > the counters for that traffic class. > > Signed-off-by: Vladimir Oltean > --- > net/sched/sch_taprio.c | 7 +++---- > 1 file changed, 3 insertions(+), 4 deletions(-) > > diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c > index cc7ff98e5e86..23b98c3af8b2 100644 > --- a/net/sched/sch_taprio.c > +++ b/net/sched/sch_taprio.c > @@ -2452,11 +2452,11 @@ static unsigned long taprio_find(struct Qdisc *sc= h, u32 classid) > static int taprio_dump_class(struct Qdisc *sch, unsigned long cl, > struct sk_buff *skb, struct tcmsg *tcm) > { > - struct netdev_queue *dev_queue =3D taprio_queue_get(sch, cl); > + struct Qdisc *child =3D taprio_leaf(sch, cl); > > tcm->tcm_parent =3D TC_H_ROOT; > tcm->tcm_handle |=3D TC_H_MIN(cl); > - tcm->tcm_info =3D dev_queue->qdisc_sleeping->handle; > + tcm->tcm_info =3D child->handle; > > return 0; > } > @@ -2466,8 +2466,7 @@ static int taprio_dump_class_stats(struct Qdisc *sc= h, unsigned long cl, > __releases(d->lock) > __acquires(d->lock) > { > - struct netdev_queue *dev_queue =3D taprio_queue_get(sch, cl); > - struct Qdisc *child =3D dev_queue->qdisc_sleeping; > + struct Qdisc *child =3D taprio_leaf(sch, cl); > struct tc_taprio_qopt_offload offload =3D { > .cmd =3D TAPRIO_CMD_TC_STATS, > .tc_stats =3D { > -- > 2.34.1 >