Skip to contentSkip to conversation

xfrm: Make xfrm_state timer monotonic

PATCH Superseded Fan Du 2 participants 7 messages Aug 6, 2013 – Aug 14, 2013

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Fan Du

author
#0 lore raw

PATCH 1/1 xfrm: Make xfrm_state timer monotonic

xfrm_state timer should be independent of system clock change, so switch to monotonic clock base.

---
 net/xfrm/xfrm_state.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/xfrm/xfrm_state.c +1 -1
index 78f66fa..e57ab07 100644
@@ -499,7 +499,7 @@ 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_MONOTONIC, 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
#1 lore raw
Quoted 3 lines · Fan Du

xfrm_state timer should be independent of system clock change, so switch to monotonic clock base.

I think a monotonic timer will reintroduce a bug on suspend/resume that was fixed by commit 9e0d57fd6
(xfrm: SAD entries do not expire correctly after suspend-resume)

Please make sure that this does not happen.

author
#2 lore raw

PATCH v2 1/1 xfrm: Make xfrm_state timer monotonic

Quoted 10 lines · Steffen Klassert
Quoted 3 lines · Fan Du

xfrm_state timer should be independent of system clock change, so switch to monotonic clock base.

I think a monotonic timer will reintroduce a bug on suspend/resume that was fixed by commit 9e0d57fd6
(xfrm: SAD entries do not expire correctly after suspend-resume)

Please make sure that this does not happen.

What about using CLOCK_BOOTTIME? it's monotonic, but includes suspend time as well.

From 1dae5a22c203224ee46e2a2f95b569a04b74117b Mon Sep 17 00:00:00 2001
From: Fan Du <[email protected]>
Date: Mon, 12 Aug 2013 13:33:45 +0800
Subject: [PATCHv2 net-next] 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.

---
 net/xfrm/xfrm_state.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/xfrm/xfrm_state.c +1 -1
index 78f66fa..1df4436 100644
@@ -499,7 +499,7 @@ 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
Quoted 5 lines

--
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 3 lines
浮沉随浪只记今朝笑

--fan
maintainer
#3 lore raw
Quoted 8 lines · Fan Du
Quoted 5 lines · Steffen Klassert
Quoted 3 lines · Fan Du

xfrm_state timer should be independent of system clock change, so switch to monotonic clock base.

Quoted 7 lines
Quoted 5 lines

I think a monotonic timer will reintroduce a bug on suspend/resume that was fixed by commit 9e0d57fd6
(xfrm: SAD entries do not expire correctly after suspend-resume)

Please make sure that this does not happen.

What about using CLOCK_BOOTTIME? it's monotonic, but includes suspend time as well.

As I said, I'm open to everything that fixes your problem and does not introduce a regression. I'll consider applying after some testing if noone else has objections.

Thanks!

author
#4 lore raw
Quoted 13 lines · Steffen Klassert
Quoted 12 lines · Fan Du
Quoted 9 lines · Steffen Klassert
Quoted 3 lines · Fan Du

xfrm_state timer should be independent of system clock change, so switch to monotonic clock base.

I think a monotonic timer will reintroduce a bug on suspend/resume that was fixed by commit 9e0d57fd6
(xfrm: SAD entries do not expire correctly after suspend-resume)

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Please make sure that this does not happen.

What about using CLOCK_BOOTTIME? it's monotonic, but includes suspend time as well.

As I said, I'm open to everything that fixes your problem and does not introduce a regression. I'll consider applying after some testing if noone else has objections.

Hi, Steffen

Thanks for your understanding! :)

I happened to bump into CLOCK_BOOTTIME several days ago, so apologize for eating my words earlier. Changing xfrm_state timer to monotonic does not solve the problem I've described earlier in:

http://www.spinics.net/lists/netdev/msg245019.html (*1*)

So is there any light of hope for the proposal in (*1*) by using CLOCK_BOOTTIME instead?

Quoted 3 lines

Thanks!

Signature · 3 lines
浮沉随浪只记今朝笑

--fan
maintainer
#5 lore raw
Quoted 28 lines · Fan Du
Quoted 13 lines · Steffen Klassert
Quoted 12 lines · Fan Du
Quoted 9 lines · Steffen Klassert
Quoted 3 lines · Fan Du

xfrm_state timer should be independent of system clock change, so switch to monotonic clock base.

I think a monotonic timer will reintroduce a bug on suspend/resume that was fixed by commit 9e0d57fd6
(xfrm: SAD entries do not expire correctly after suspend-resume)

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Please make sure that this does not happen.

What about using CLOCK_BOOTTIME? it's monotonic, but includes suspend time as well.

As I said, I'm open to everything that fixes your problem and does not introduce a regression. I'll consider applying after some testing if noone else has objections.

Hi, Steffen

Thanks for your understanding! :)

Quoted 9 lines

I happened to bump into CLOCK_BOOTTIME several days ago, so apologize for eating my words earlier. Changing xfrm_state timer to monotonic does not solve the problem I've described earlier in:

http://www.spinics.net/lists/netdev/msg245019.html (*1*)

So is there any light of hope for the proposal in (*1*) by using CLOCK_BOOTTIME instead?

Well, you have to convince David in the first place, as he is sitting upstream from me ;)

Also, I think he is right with his complaint. Why not following the clock_was_set approach you started with?

maintainer
#6 lore raw
In reply to Fan Du
Quoted 36 lines · Fan Du
Quoted 10 lines · Steffen Klassert
Quoted 3 lines · Fan Du

xfrm_state timer should be independent of system clock change, so switch to monotonic clock base.

I think a monotonic timer will reintroduce a bug on suspend/resume that was fixed by commit 9e0d57fd6
(xfrm: SAD entries do not expire correctly after suspend-resume)

Please make sure that this does not happen.

What about using CLOCK_BOOTTIME? it's monotonic, but includes suspend time as well.

From 1dae5a22c203224ee46e2a2f95b569a04b74117b Mon Sep 17 00:00:00 2001
From: Fan Du <[email protected]>
Date: Mon, 12 Aug 2013 13:33:45 +0800
Subject: [PATCHv2 net-next] 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.

---
 net/xfrm/xfrm_state.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/xfrm/xfrm_state.c +0 -0
index 78f66fa..1df4436 100644

net/xfrm/xfrm_state.c struct xfrm_state *xfrm_state_alloc(struct net *net) · line 505

Quoted 8 lines
net/xfrm/xfrm_state.c +1 -1
@@ -499,7 +499,7 @@ 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();

This does not apply to my tree, looks like your patch is whitespace damaged.