Skip to contentSkip to conversation

tc: pie: change maximum integer value of tc_pie_xstats->prob

PATCH Applied Leslie Monis 3 participants 6 messages Mar 5, 2020 – Mar 9, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tc: pie: change maximum integer value of tc_pie_xstats->prob

Kernel commit 105e808c1da2 ("pie: remove pie_vars->accu_prob_overflows"), changes the maximum value of tc_pie_xstats->prob from (2^64 - 1) to (2^56 - 1).

---
 tc/q_pie.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tc/q_pie.c +2 -2
index 709a78b4..e6939652 100644
@@ -223,9 +223,9 @@ static int pie_print_xstats(struct qdisc_util *qu, FILE *f,
 
 	st = RTA_DATA(xstats);
 
-	/* prob is returned as a fracion of maximum integer value */
+	/* prob is returned as a fracion of (2^56 - 1) */
 	print_float(PRINT_ANY, "prob", "  prob %lg",
-		    (double)st->prob / (double)UINT64_MAX);
+		    (double)st->prob / (double)(UINT64_MAX >> 8));
 	print_uint(PRINT_JSON, "delay", NULL, st->delay);
 	print_string(PRINT_FP, NULL, " delay %s", sprint_time(st->delay, b1));
 
Signature · 1 line
2.17.1
#2 lore raw
Quoted 13 lines · David Ahern
Quoted 11 lines · Leslie Monis

Kernel commit 105e808c1da2 ("pie: remove pie_vars->accu_prob_overflows"), changes the maximum value of tc_pie_xstats->prob from (2^64 - 1) to (2^56 - 1).

---
 tc/q_pie.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 3 lines

applied to iproute2-next. Thanks

This means that iproute2 is incompatible with old kernels.

commit 105e808c1da2 ("pie: remove pie_vars->accu_prob_overflows") was wrong, it should not have changed user ABI.

The rule is : iproute2 v-X should work with linux-<whatever-version>

Since pie MAX_PROB was implicitly in the user ABI, it can not be changed, at least from user point of view.

#3 lore raw
Quoted 22 lines · Eric Dumazet
Quoted 13 lines · David Ahern
Quoted 11 lines · Leslie Monis

Kernel commit 105e808c1da2 ("pie: remove pie_vars->accu_prob_overflows"), changes the maximum value of tc_pie_xstats->prob from (2^64 - 1) to (2^56 - 1).

---
 tc/q_pie.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 3 lines

applied to iproute2-next. Thanks

This means that iproute2 is incompatible with old kernels.

Quoted 8 lines

commit 105e808c1da2 ("pie: remove pie_vars->accu_prob_overflows") was wrong, it should not have changed user ABI.

The rule is : iproute2 v-X should work with linux-<whatever-version>

Since pie MAX_PROB was implicitly in the user ABI, it can not be changed, at least from user point of view.

So this kernel patch might be needed :

net/sched/sch_pie.c +1 -1
index f52442d39bf57a7cf7af2595638a277e9c1ecf60..c65077f0c0f39832ee97f4e89f25639306b19281 100644
@@ -493,7 +493,7 @@ static int pie_dump_stats(struct Qdisc *sch, struct gnet_dump *d)
 {
        struct pie_sched_data *q = qdisc_priv(sch);
        struct tc_pie_xstats st = {
-               .prob           = q->vars.prob,
+               .prob           = q->vars.prob << BITS_PER_BYTE,
                .delay          = ((u32)PSCHED_TICKS2NS(q->vars.qdelay)) /
                                   NSEC_PER_USEC,
                .packets_in     = q->stats.packets_in,
#4 lore raw
Quoted 10 lines · Eric Dumazet
Quoted 8 lines · Eric Dumazet

This means that iproute2 is incompatible with old kernels.

commit 105e808c1da2 ("pie: remove pie_vars->accu_prob_overflows") was wrong, it should not have changed user ABI.

The rule is : iproute2 v-X should work with linux-<whatever-version>

I'm apologize. I wasn't aware of this rule.

Quoted 3 lines
Quoted 3 lines

Since pie MAX_PROB was implicitly in the user ABI, it can not be changed, at least from user point of view.

You're right. It shouldn't have affected user space.
But I'm afraid the value of MAX_PROB in the kernel did change in v5.1. commit 3f7ae5f3dc52 ("net: sched: pie: add more cases to auto-tune alpha and beta")
introduced that change. I'm not sure what to do about this. How can I fix it?

Quoted 8 lines

So this kernel patch might be needed :

net/sched/sch_pie.c +0 -0
index f52442d39bf57a7cf7af2595638a277e9c1ecf60..c65077f0c0f39832ee97f4e89f25639306b19281 100644

net/sched/sch_pie.c static int pie_dump_stats(struct Qdisc *sch, struct gnet_dump *d) · line 499

Quoted 8 lines
net/sched/sch_pie.c +1 -1
@@ -493,7 +493,7 @@ static int pie_dump_stats(struct Qdisc *sch, struct gnet_dump *d)
 {
        struct pie_sched_data *q = qdisc_priv(sch);
        struct tc_pie_xstats st = {
-               .prob           = q->vars.prob,
+               .prob           = q->vars.prob << BITS_PER_BYTE,
                .delay          = ((u32)PSCHED_TICKS2NS(q->vars.qdelay)) /
                                   NSEC_PER_USEC,
                .packets_in     = q->stats.packets_in,

Thanks. This is a much better solution.
Should I go ahead and submit this to net-next?
I guess the applied patch (topic of this thread) has to be reverted.

#5 lore raw
Quoted 27 lines · Leslie Monis
Quoted 10 lines · Eric Dumazet
Quoted 8 lines · Eric Dumazet

This means that iproute2 is incompatible with old kernels.

commit 105e808c1da2 ("pie: remove pie_vars->accu_prob_overflows") was wrong, it should not have changed user ABI.

The rule is : iproute2 v-X should work with linux-<whatever-version>

I'm apologize. I wasn't aware of this rule.

Quoted 3 lines
Quoted 3 lines

Since pie MAX_PROB was implicitly in the user ABI, it can not be changed, at least from user point of view.

You're right. It shouldn't have affected user space.
But I'm afraid the value of MAX_PROB in the kernel did change in v5.1. commit 3f7ae5f3dc52 ("net: sched: pie: add more cases to auto-tune alpha and beta")
introduced that change. I'm not sure what to do about this. How can I fix it?

Quoted 3 lines

So this kernel patch might be needed :

Quoted 16 lines

net/sched/sch_pie.c static int pie_dump_stats(struct Qdisc *sch, struct gnet_dump *d) · line 499

Quoted 13 lines
net/sched/sch_pie.c +1 -1
index f52442d39bf57a7cf7af2595638a277e9c1ecf60..c65077f0c0f39832ee97f4e89f25639306b19281 100644
@@ -493,7 +493,7 @@ static int pie_dump_stats(struct Qdisc *sch, struct gnet_dump *d)
 {
        struct pie_sched_data *q = qdisc_priv(sch);
        struct tc_pie_xstats st = {
-               .prob           = q->vars.prob,
+               .prob           = q->vars.prob << BITS_PER_BYTE,
                .delay          = ((u32)PSCHED_TICKS2NS(q->vars.qdelay)) /
                                   NSEC_PER_USEC,
                .packets_in     = q->stats.packets_in,

Thanks. This is a much better solution.
Should I go ahead and submit this to net-next?

Sure, please go ahead !

Quoted 2 lines

I guess the applied patch (topic of this thread) has to be reverted.