NetBSD Problem Report #56319

From ozaki-r@netbsd.org  Wed Jul 21 05:11:40 2021
Return-Path: <ozaki-r@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id ED8BA1A923E
	for <gnats-bugs@gnats.NetBSD.org>; Wed, 21 Jul 2021 05:11:39 +0000 (UTC)
Message-Id: <20210721051138.3CBA61A923F@mollari.NetBSD.org>
Date: Wed, 21 Jul 2021 05:11:38 +0000 (UTC)
From: ozaki-r@netbsd.org
Reply-To: ozaki-r@netbsd.org
To: gnats-bugs@NetBSD.org
Subject: CBQ: high bandwidths are inaccurate
X-Send-Pr-Version: 3.95

>Number:         56319
>Category:       kern
>Synopsis:       CBQ: high bandwidths are inaccurate
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jul 21 05:15:00 +0000 2021
>Last-Modified:  Wed Jul 21 06:50:04 +0000 2021
>Originator:     Ryota Ozaki
>Release:        current
>Organization:
>Environment:
NetBSD kvm 9.99.86 NetBSD 9.99.86 (KVM) #83: Wed Jul 21 12:14:19 JST 2021  (hidden) amd64
>Description:
For example even if you specify 750 Mbps to a class, it is treated as 800 Mbps
internally.

This happens because CBQ represents a bandwidth as nanosecond per byte
and an integer in the kernel.  So bandwidths from 730 Mbps to 800 Mbps
are all rounded to 800 Mbps. 

>How-To-Repeat:
# cat /etc/altq.conf
interface vioif1 bandwidth 1000M cbq no-control
class cbq vioif1 root NULL pbandwidth 100
class cbq vioif1 0: root pbandwidth 75 default
# altqd
# altqstat -c 1
altqstat: cbq on interface vioif1
Class 1 on Interface vioif1: root
        priority: 0 depth: 1 offtime: 1 [us] wrr_allot: 1500 bytes
        nsPerByte: 8    (1000.00Mbps),  Measured: 90711.30M [bps]
        pkts: 0,        bytes: 0
        overs: 0,       overactions: 0
        borrows: 0,     delays: 0
        drops: 0,       drop_bytes: 0
        QCount: 0,      (qmax: 30)
        AvgIdle: 0 [us],        (maxidle: 0 minidle: -12 [us])
Class 2 on Interface vioif1: 0:
        priority: 1 depth: 0 offtime: 7 [us] wrr_allot: 1500 bytes
        nsPerByte: 10   (800.00Mbps)
        pkts: 0,        bytes: 0
        overs: 0,       overactions: 0
        borrows: 0,     delays: 0
        drops: 0,       drop_bytes: 0
        QCount: 0,      (qmax: 30)
        AvgIdle: 2 [us],        (maxidle: 2 minidle: -15 [us])

>Fix:
Treat bandwidths as picosecond per byte in the kernel.

>Audit-Trail:
From: "Ryota Ozaki" <ozaki-r@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/56319 CVS commit: src/sys/altq
Date: Wed, 21 Jul 2021 06:33:30 +0000

 Module Name:	src
 Committed By:	ozaki-r
 Date:		Wed Jul 21 06:33:30 UTC 2021

 Modified Files:
 	src/sys/altq: altq_cbq.c altq_cbq.h altq_rmclass.c altq_rmclass.h

 Log Message:
 altq, cbq: convert ns_per_byte to ps_per_byte

 Also the type of variables of it is changed to u_long from int.

 This change provides fine-grain resolution of bandwidth.  For example
 750 Mbps was treated as 800 Mbps internally because bandwidth was
 represented as nanoseconds per byte.  Converting the representation
 to picoseconds per byte enables to treat 750 Mbps as-is.

 PR kern/56319


 To generate a diff of this commit:
 cvs rdiff -u -r1.34 -r1.35 src/sys/altq/altq_cbq.c
 cvs rdiff -u -r1.8 -r1.9 src/sys/altq/altq_cbq.h
 cvs rdiff -u -r1.24 -r1.25 src/sys/altq/altq_rmclass.c
 cvs rdiff -u -r1.9 -r1.10 src/sys/altq/altq_rmclass.h

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Ryota Ozaki" <ozaki-r@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/56319 CVS commit: src/usr.sbin/altq/libaltq
Date: Wed, 21 Jul 2021 06:36:33 +0000

 Module Name:	src
 Committed By:	ozaki-r
 Date:		Wed Jul 21 06:36:33 UTC 2021

 Modified Files:
 	src/usr.sbin/altq/libaltq: qop_cbq.c qop_cbq.h

 Log Message:
 libaltq, cbq: convert ns_per_byte to ps_per_byte

 PR kern/56319


 To generate a diff of this commit:
 cvs rdiff -u -r1.11 -r1.12 src/usr.sbin/altq/libaltq/qop_cbq.c
 cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/altq/libaltq/qop_cbq.h

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Ryota Ozaki" <ozaki-r@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/56319 CVS commit: src/usr.sbin/altq/altqstat
Date: Wed, 21 Jul 2021 06:38:57 +0000

 Module Name:	src
 Committed By:	ozaki-r
 Date:		Wed Jul 21 06:38:57 UTC 2021

 Modified Files:
 	src/usr.sbin/altq/altqstat: qdisc_cbq.c

 Log Message:
 altqstat: adopt ps_per_byte

 PR kern/56319


 To generate a diff of this commit:
 cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/altq/altqstat/qdisc_cbq.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Ryota Ozaki" <ozaki-r@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/56319 CVS commit: src/usr.sbin/altq/altqstat
Date: Wed, 21 Jul 2021 06:45:10 +0000

 Module Name:	src
 Committed By:	ozaki-r
 Date:		Wed Jul 21 06:45:10 UTC 2021

 Modified Files:
 	src/usr.sbin/altq/altqstat: qdisc_cbq.c

 Log Message:
 altqstat: follow changes of types of variables

 PR kern/56319


 To generate a diff of this commit:
 cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/altq/altqstat/qdisc_cbq.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Ryota Ozaki" <ozaki-r@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/56319 CVS commit: src/sys/altq
Date: Wed, 21 Jul 2021 06:47:33 +0000

 Module Name:	src
 Committed By:	ozaki-r
 Date:		Wed Jul 21 06:47:33 UTC 2021

 Modified Files:
 	src/sys/altq: altq_cbq.h altq_rmclass.c altq_rmclass.h

 Log Message:
 altq, cbq: change long to uint64_t for ILP32 archs

 PR kern/56319


 To generate a diff of this commit:
 cvs rdiff -u -r1.10 -r1.11 src/sys/altq/altq_cbq.h
 cvs rdiff -u -r1.26 -r1.27 src/sys/altq/altq_rmclass.c
 cvs rdiff -u -r1.11 -r1.12 src/sys/altq/altq_rmclass.h

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Ryota Ozaki" <ozaki-r@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/56319 CVS commit: src/usr.sbin/altq/altqstat
Date: Wed, 21 Jul 2021 06:48:28 +0000

 Module Name:	src
 Committed By:	ozaki-r
 Date:		Wed Jul 21 06:48:28 UTC 2021

 Modified Files:
 	src/usr.sbin/altq/altqstat: qdisc_cbq.c

 Log Message:
 altqstat, cbq: follow uint64_t changes

 PR kern/56319


 To generate a diff of this commit:
 cvs rdiff -u -r1.10 -r1.11 src/usr.sbin/altq/altqstat/qdisc_cbq.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.