* [PATCH net] net_sched: gen_estimator: fix broken estimators based on percpu stats
@ 2018-02-23 3:36 Eric Dumazet
2018-02-23 3:40 ` Eric Dumazet
2018-02-23 3:45 ` [PATCH v2 " Eric Dumazet
0 siblings, 2 replies; 4+ messages in thread
From: Eric Dumazet @ 2018-02-23 3:36 UTC (permalink / raw)
To: David Miller
Cc: netdev, John Fastabend, Cong Wang, Jamal Hadi Salim, Jiri Pirko
From: Eric Dumazet <edumazet@google.com>
pfifo_fast got percpu stats lately, uncovering a bug I introduced last
year in linux-4.10.
I missed the fact that we have to clear our temporary storage
before calling __gnet_stats_copy_basic() in the case of percpu stats.
Without this fix, rate estimators (tc qd replace dev xxx root est 1sec
4sec pfifo_fast) are utterly broken.
Fixes: 1c0d32fde5bd ("net_sched: gen_estimator: complete rewrite of rate estimators")
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
net/core/gen_estimator.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/core/gen_estimator.c b/net/core/gen_estimator.c
index 0a3f88f08727f1f1217560407ff539c8a8c17496..f13ea3c1fa3eddc6be172df9eda8828da76045e7 100644
--- a/net/core/gen_estimator.c
+++ b/net/core/gen_estimator.c
@@ -79,7 +79,7 @@ static void est_fetch_counters(struct net_rate_estimator *e,
static void est_timer(struct timer_list *t)
{
struct net_rate_estimator *est = from_timer(est, t, timer);
- struct gnet_stats_basic_packed b;
+ struct gnet_stats_basic_packed b = {0};
u64 rate, brate;
est_fetch_counters(est, &b);
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net] net_sched: gen_estimator: fix broken estimators based on percpu stats
2018-02-23 3:36 [PATCH net] net_sched: gen_estimator: fix broken estimators based on percpu stats Eric Dumazet
@ 2018-02-23 3:40 ` Eric Dumazet
2018-02-23 3:45 ` [PATCH v2 " Eric Dumazet
1 sibling, 0 replies; 4+ messages in thread
From: Eric Dumazet @ 2018-02-23 3:40 UTC (permalink / raw)
To: David Miller
Cc: netdev, John Fastabend, Cong Wang, Jamal Hadi Salim, Jiri Pirko
On Thu, 2018-02-22 at 19:36 -0800, Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@google.com>
>
> pfifo_fast got percpu stats lately, uncovering a bug I introduced last
> year in linux-4.10.
>
> I missed the fact that we have to clear our temporary storage
> before calling __gnet_stats_copy_basic() in the case of percpu stats.
>
> Without this fix, rate estimators (tc qd replace dev xxx root est 1sec
> 4sec pfifo_fast) are utterly broken.
>
> Fixes: 1c0d32fde5bd ("net_sched: gen_estimator: complete rewrite of rate estimators")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> ---
> net/core/gen_estimator.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/core/gen_estimator.c b/net/core/gen_estimator.c
> index 0a3f88f08727f1f1217560407ff539c8a8c17496..f13ea3c1fa3eddc6be172df9eda8828da76045e7 100644
> --- a/net/core/gen_estimator.c
> +++ b/net/core/gen_estimator.c
> @@ -79,7 +79,7 @@ static void est_fetch_counters(struct net_rate_estimator *e,
> static void est_timer(struct timer_list *t)
> {
> struct net_rate_estimator *est = from_timer(est, t, timer);
> - struct gnet_stats_basic_packed b;
> + struct gnet_stats_basic_packed b = {0};
> u64 rate, brate;
>
> est_fetch_counters(est, &b);
Oh I sent the wrong version of the patch, sorry.
Will send a V2.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2 net] net_sched: gen_estimator: fix broken estimators based on percpu stats
2018-02-23 3:36 [PATCH net] net_sched: gen_estimator: fix broken estimators based on percpu stats Eric Dumazet
2018-02-23 3:40 ` Eric Dumazet
@ 2018-02-23 3:45 ` Eric Dumazet
2018-02-23 17:43 ` David Miller
1 sibling, 1 reply; 4+ messages in thread
From: Eric Dumazet @ 2018-02-23 3:45 UTC (permalink / raw)
To: David Miller
Cc: netdev, John Fastabend, Cong Wang, Jamal Hadi Salim, Jiri Pirko
From: Eric Dumazet <edumazet@google.com>
pfifo_fast got percpu stats lately, uncovering a bug I introduced last
year in linux-4.10.
I missed the fact that we have to clear our temporary storage
before calling __gnet_stats_copy_basic() in the case of percpu stats.
Without this fix, rate estimators (tc qd replace dev xxx root est 1sec
4sec pfifo_fast) are utterly broken.
Fixes: 1c0d32fde5bd ("net_sched: gen_estimator: complete rewrite of rate estimators")
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
v2: Perform the zeroing in est_fetch_counters() instead of caller(s)
net/core/gen_estimator.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/net/core/gen_estimator.c b/net/core/gen_estimator.c
index 0a3f88f08727f1f1217560407ff539c8a8c17496..98fd12721221e4aa26e4d11be9de6c0305fb6dd9 100644
--- a/net/core/gen_estimator.c
+++ b/net/core/gen_estimator.c
@@ -66,6 +66,7 @@ struct net_rate_estimator {
static void est_fetch_counters(struct net_rate_estimator *e,
struct gnet_stats_basic_packed *b)
{
+ memset(b, 0, sizeof(*b));
if (e->stats_lock)
spin_lock(e->stats_lock);
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2 net] net_sched: gen_estimator: fix broken estimators based on percpu stats
2018-02-23 3:45 ` [PATCH v2 " Eric Dumazet
@ 2018-02-23 17:43 ` David Miller
0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2018-02-23 17:43 UTC (permalink / raw)
To: eric.dumazet; +Cc: netdev, john.fastabend, xiyou.wangcong, jhs, jiri
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Thu, 22 Feb 2018 19:45:27 -0800
> From: Eric Dumazet <edumazet@google.com>
>
> pfifo_fast got percpu stats lately, uncovering a bug I introduced last
> year in linux-4.10.
>
> I missed the fact that we have to clear our temporary storage
> before calling __gnet_stats_copy_basic() in the case of percpu stats.
>
> Without this fix, rate estimators (tc qd replace dev xxx root est 1sec
> 4sec pfifo_fast) are utterly broken.
>
> Fixes: 1c0d32fde5bd ("net_sched: gen_estimator: complete rewrite of rate estimators")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> ---
> v2: Perform the zeroing in est_fetch_counters() instead of caller(s)
Applied and queued up for -stable.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-02-23 17:43 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-23 3:36 [PATCH net] net_sched: gen_estimator: fix broken estimators based on percpu stats Eric Dumazet
2018-02-23 3:40 ` Eric Dumazet
2018-02-23 3:45 ` [PATCH v2 " Eric Dumazet
2018-02-23 17:43 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).