The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Jack Wang <163wangjack@gmail.com>
To: vinicius.gomes@intel.com, jhs@mojatatu.com,
	xiyou.wangcong@gmail.com, jiri@resnulli.us, davem@davemloft.net,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com
Cc: horms@kernel.org, victor@mojatatu.com, mhm.dawod@gmail.com,
	esalomatkina@ispras.ru, andriy.shevchenko@linux.intel.com,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH net v5 0/2] net/sched: cbs: fix 32-bit rate conversions and slope tearing
Date: Sat,  5 Dec 2026 15:33:02 +0800	[thread overview]
Message-ID: <20261205073304.86227-1-163wangjack@gmail.com> (raw)

This series fixes two 32-bit issues in sch_cbs:

1. Perform BYTES_PER_KBIT rate/slope conversions in signed 64-bit
   arithmetic to restore software CBS shaping on ILP32 kernels.
2. Convert q->idleslope and q->sendslope to atomic64_t to prevent
   64-bit tearing on 32-bit kernels.

The separate 32-bit overflow in len * NSEC_PER_SEC in cbs_dequeue_soft()
is being addressed independently by Mohamed Dawod, and the pre-existing
watchdog busy-loop and timediff_to_credits() overflow will be handled in
a separate follow-up patch.

v5:
- Restore the problem description and user-visible regression details
  in patch 1, and scope its title to BYTES_PER_KBIT conversions.
- Split the atomic64_t conversion into patch 2 with its own Fixes: tag.

v4: https://lore.kernel.org/netdev/20261201085406.228-1-163wangjack@gmail.com/
- Drop the partial idleslope < 0 check (watchdog busy-loop will be
  fixed separately).
- Cast BYTES_PER_KBIT to s64 for signed 64-bit math on ILP32 and LP64.
- Convert idleslope/sendslope to atomic64_t to prevent 32-bit tearing.
- Update Fixes: tags, remove the blank line in the tag block, and drop
  v1 Acked-by due to the atomic64_t change.

v3: https://lore.kernel.org/netdev/20260813060256.28748-1-163wangjack@gmail.com/
- Reject only negative idleslope (keep 0 for tdc test 1820).
- Defer timediff_to_credits() overflow to a separate follow-up.

v2: https://lore.kernel.org/netdev/20260812080204.32373-1-163wangjack@gmail.com/
- Reject non-positive idleslope values.

v1: https://lore.kernel.org/netdev/20260806155253.50252-1-163wangjack@gmail.com/

Jack Wang (2):
  net/sched: cbs: use signed 64-bit math for BYTES_PER_KBIT conversions
  net/sched: cbs: use atomic64_t for idleslope and sendslope

 net/sched/sch_cbs.c | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)


base-commit: 7b53449540502cb21b32bca62a6258e22cd97bbe
-- 
2.53.0


             reply	other threads:[~2026-12-05  7:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-05  7:33 Jack Wang [this message]
2026-12-05  7:33 ` [PATCH net v5 1/2] net/sched: cbs: use signed 64-bit math for BYTES_PER_KBIT conversions Jack Wang
2026-12-05  7:33 ` [PATCH net v5 2/2] net/sched: cbs: use atomic64_t for idleslope and sendslope Jack Wang
2026-12-05  7:38 ` [PATCH net v5 0/2] net/sched: cbs: fix 32-bit rate conversions and slope tearing netdev-bot+sinfo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261205073304.86227-1-163wangjack@gmail.com \
    --to=163wangjack@gmail.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=esalomatkina@ispras.ru \
    --cc=horms@kernel.org \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhm.dawod@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=victor@mojatatu.com \
    --cc=vinicius.gomes@intel.com \
    --cc=xiyou.wangcong@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox