lkml.org 
[lkml]   [2020]   [Jun]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 4.19 10/95] net sched: fix reporting the first-time use timestamp
Hi!

On Mon 2020-06-01 19:53:10, Greg Kroah-Hartman wrote:
> From: Roman Mashak <mrv@mojatatu.com>
>
> [ Upstream commit b15e62631c5f19fea9895f7632dae9c1b27fe0cd ]
>
> When a new action is installed, firstuse field of 'tcf_t' is explicitly set
> to 0. Value of zero means "new action, not yet used"; as a packet hits the
> action, 'firstuse' is stamped with the current jiffies value.
>
> tcf_tm_dump() should return 0 for firstuse if action has not yet been hit.
>
> Fixes: 48d8ee1694dd ("net sched actions: aggregate dumping of actions timeinfo")

Jiffies start at small negative value (and are expected to overflow
periodically). This code will not work correctly in that case.

Best regards,
Pavel


> +++ b/include/net/act_api.h
> @@ -67,7 +67,8 @@ static inline void tcf_tm_dump(struct tc
> {
> dtm->install = jiffies_to_clock_t(jiffies - stm->install);
> dtm->lastuse = jiffies_to_clock_t(jiffies - stm->lastuse);
> - dtm->firstuse = jiffies_to_clock_t(jiffies - stm->firstuse);
> + dtm->firstuse = stm->firstuse ?
> + jiffies_to_clock_t(jiffies - stm->firstuse) : 0;
> dtm->expires = jiffies_to_clock_t(stm->expires);
> }
>
>

--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2020-06-01 23:00    [W:0.436 / U:0.248 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site