Skip to contentSkip to conversation

tick/broadcast: Remove redundant code in tick_check_new_device()

PATCH Superseded Zhenzhong Duan 2 participants 4 messages Nov 9, 2017 – Nov 14, 2017 Nohz, dynticks support

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tick/broadcast: Remove redundant code in tick_check_new_device()

There is no way a timer used as broadcast clockevent device is also used as percpu tick clockevent device currently.

It's better to put related code in tick_install_broadcast_device(), but I feel it's harmless to give it back to the clockevents layer. Pls correct me if I'm wrong.

---
 kernel/time/tick-common.c |    7 +------
 1 files changed, 1 insertions(+), 6 deletions(-)
kernel/time/tick-common.c +1 -6
index 49edc1c..9bcc866 100644
@@ -320,13 +320,8 @@ void tick_check_new_device(struct clock_event_device *newdev)
 
 	/*
 	 * Replace the eventually existing device by the new
-	 * device. If the current device is the broadcast device, do
-	 * not give it back to the clockevents layer !
+	 * device.
 	 */
-	if (tick_is_broadcast_device(curdev)) {
-		clockevents_shutdown(curdev);
-		curdev = NULL;
-	}
 	clockevents_exchange_device(curdev, newdev);
 	tick_setup_device(td, newdev, cpu, cpumask_of(cpu));
 	if (newdev->features & CLOCK_EVT_FEAT_ONESHOT)
Signature · 1 line
1.7.3
#1 lore raw
Quoted 2 lines · Zhenzhong Duan

There is no way a timer used as broadcast clockevent device is also used as percpu tick clockevent device currently.

Correct.

Quoted 3 lines

It's better to put related code in tick_install_broadcast_device(), but I feel it's harmless to give it back to the clockevents layer. Pls correct me if I'm wrong.

You already established, that it _cannot_ be the broadcast device and the per cpu device at the same time. So that condition can never be true. What do you want to put into tick_install_broadcast_device()? This second paragraph doesn't make sense, unless I'm missing something.

Thanks,

tglx

#2 lore raw
Quoted 6 lines · Thomas Gleixner
Quoted 2 lines · Zhenzhong Duan

There is no way a timer used as broadcast clockevent device is also used as percpu tick clockevent device currently.

Correct.

Quoted 7 lines
Quoted 3 lines

It's better to put related code in tick_install_broadcast_device(), but I feel it's harmless to give it back to the clockevents layer. Pls correct me if I'm wrong.

You already established, that it _cannot_ be the broadcast device and the per cpu device at the same time. So that condition can never be true. What do you want to put into tick_install_broadcast_device()? This second paragraph doesn't make sense, unless I'm missing something.

I didn't find the reason in long history logs while the comments saying 'If the current device is the broadcast device, do not give it back to the clockevents layer !'

If it does, tick_install_broadcast_device() is a proper place. If not, I can resend the patch with fresh description, pls confirm.

Signature · 2 lines
thanks
zduan
#3 lore raw
Quoted 14 lines · Zhenzhong Duan
Quoted 12 lines · Thomas Gleixner
Quoted 3 lines · Zhenzhong Duan

There is no way a timer used as broadcast clockevent device is also used as
percpu tick clockevent device currently.

Correct.

Quoted 5 lines

It's better to put related code in tick_install_broadcast_device(), but I feel
it's harmless to give it back to the clockevents layer. Pls correct me if I'm
wrong.

Quoted 8 lines
Quoted 4 lines

You already established, that it _cannot_ be the broadcast device and the per cpu device at the same time. So that condition can never be true. What do you want to put into tick_install_broadcast_device()? This second paragraph doesn't make sense, unless I'm missing something.

I didn't find the reason in long history logs while the comments saying 'If the current device is the broadcast device, do not give it back to the clockevents layer !'

To be honest I can't figure it out myself why this was put there, even if I wrote it myself. Fact is that this is wrong and cannot happen at all.

Thanks,

tglx