Skip to contentSkip to conversation

xfrm: Make xfrm_state timer monotonic

PATCH Applied Fan Du 3 participants 3 messages Aug 15, 2013 – Aug 16, 2013

Subsystems (3)
lore
Share & tools
lore

Fan Du

author
#0 lore raw

PATCH v2 1/1 xfrm: Make xfrm_state timer monotonic

xfrm_state timer should be independent of system clock change, so switch to CLOCK_BOOTTIME base which is not only monotonic but also counting suspend time.

Thus issue reported in commit: 9e0d57fd6dad37d72a3ca6db00ca8c76f2215454 ("xfrm: SAD entries do not expire correctly after suspend-resume") could ALSO be avoided.

v2: Use CLOCK_BOOTTIME to count suspend time, but still monotonic.

---
 net/xfrm/xfrm_state.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
net/xfrm/xfrm_state.c +2 -1
index 79bf9a0..0824679 100644
@@ -486,7 +486,8 @@ struct xfrm_state *xfrm_state_alloc(struct net *net)
 		INIT_HLIST_NODE(&x->bydst);
 		INIT_HLIST_NODE(&x->bysrc);
 		INIT_HLIST_NODE(&x->byspi);
-		tasklet_hrtimer_init(&x->mtimer, xfrm_timer_handler, CLOCK_REALTIME, HRTIMER_MODE_ABS);
+		tasklet_hrtimer_init(&x->mtimer, xfrm_timer_handler,
+					CLOCK_BOOTTIME, HRTIMER_MODE_ABS);
 		setup_timer(&x->rtimer, xfrm_replay_timer_handler,
 				(unsigned long)x);
 		x->curlft.add_time = get_seconds();
Signature · 1 line
1.7.9.5
maintainer Acked-by on v2 1/1
#1 lore raw

From: Fan Du <[email protected]>
Date: Thu, 15 Aug 2013 15:49:06 +0800

Quoted 11 lines

xfrm_state timer should be independent of system clock change, so switch to CLOCK_BOOTTIME base which is not only monotonic but also counting suspend time.

Thus issue reported in commit: 9e0d57fd6dad37d72a3ca6db00ca8c76f2215454 ("xfrm: SAD entries do not expire correctly after suspend-resume") could ALSO be avoided.

v2: Use CLOCK_BOOTTIME to count suspend time, but still monotonic.

This seems like a good fix:

maintainer Applied
#2 lore raw
Quoted 11 lines · David Miller

From: Fan Du <[email protected]>
Date: Thu, 15 Aug 2013 15:49:06 +0800

Quoted 8 lines

xfrm_state timer should be independent of system clock change, so switch to CLOCK_BOOTTIME base which is not only monotonic but also counting suspend time.

Thus issue reported in commit: 9e0d57fd6dad37d72a3ca6db00ca8c76f2215454 ("xfrm: SAD entries do not expire correctly after suspend-resume") could ALSO be avoided.

Quoted 7 lines
Quoted 3 lines

v2: Use CLOCK_BOOTTIME to count suspend time, but still monotonic.

This seems like a good fix:

Applied to ipsec-next, thanks!