Commit 5e8bbb2c authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'timers-cleanups-2025-05-25' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull timer cleanups from Thomas Gleixner:
 "Another set of timer API cleanups:

    - Convert init_timer*(), try_to_del_timer_sync() and
      destroy_timer_on_stack() over to the canonical timer_*()
      namespace convention.

  There is another large conversion pending, which has not been included
  because it would have caused a gazillion of merge conflicts in next.
  The conversion scripts will be run towards the end of the merge window
  and a pull request sent once all conflict dependencies have been
  merged"

* tag 'timers-cleanups-2025-05-25' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  treewide, timers: Rename destroy_timer_on_stack() as timer_destroy_on_stack()
  treewide, timers: Rename try_to_del_timer_sync() as timer_delete_sync_try()
  timers: Rename init_timers() as timers_init()
  timers: Rename NEXT_TIMER_MAX_DELTA as TIMER_NEXT_MAX_DELTA
  timers: Rename __init_timer_on_stack() as __timer_init_on_stack()
  timers: Rename __init_timer() as __timer_init()
  timers: Rename init_timer_on_stack_key() as timer_init_key_on_stack()
  timers: Rename init_timer_key() as timer_init_key()
parents 44ed0f35 aad823aa
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -572,7 +572,7 @@ static int kvmppc_booke_irqprio_deliver(struct kvm_vcpu *vcpu,

/*
 * Return the number of jiffies until the next timeout.  If the timeout is
 * longer than the NEXT_TIMER_MAX_DELTA, then return NEXT_TIMER_MAX_DELTA
 * longer than the TIMER_NEXT_MAX_DELTA, then return TIMER_NEXT_MAX_DELTA
 * because the larger value can break the timer APIs.
 */
static unsigned long watchdog_next_timeout(struct kvm_vcpu *vcpu)
@@ -598,7 +598,7 @@ static unsigned long watchdog_next_timeout(struct kvm_vcpu *vcpu)
	if (do_div(nr_jiffies, tb_ticks_per_jiffy))
		nr_jiffies++;

	return min_t(unsigned long long, nr_jiffies, NEXT_TIMER_MAX_DELTA);
	return min_t(unsigned long long, nr_jiffies, TIMER_NEXT_MAX_DELTA);
}

static void arm_next_watchdog(struct kvm_vcpu *vcpu)
@@ -616,10 +616,10 @@ static void arm_next_watchdog(struct kvm_vcpu *vcpu)
	spin_lock_irqsave(&vcpu->arch.wdt_lock, flags);
	nr_jiffies = watchdog_next_timeout(vcpu);
	/*
	 * If the number of jiffies of watchdog timer >= NEXT_TIMER_MAX_DELTA
	 * If the number of jiffies of watchdog timer >= TIMER_NEXT_MAX_DELTA
	 * then do not run the watchdog timer as this can break timer APIs.
	 */
	if (nr_jiffies < NEXT_TIMER_MAX_DELTA)
	if (nr_jiffies < TIMER_NEXT_MAX_DELTA)
		mod_timer(&vcpu->arch.wdt_timer, jiffies + nr_jiffies);
	else
		timer_delete(&vcpu->arch.wdt_timer);
+1 −1
Original line number Diff line number Diff line
@@ -864,7 +864,7 @@ void lapic_offline(void)
	__vector_cleanup(cl, false);

	irq_matrix_offline(vector_matrix);
	WARN_ON_ONCE(try_to_del_timer_sync(&cl->timer) < 0);
	WARN_ON_ONCE(timer_delete_sync_try(&cl->timer) < 0);
	WARN_ON_ONCE(!hlist_empty(&cl->head));

	unlock_vector_lock();
+1 −1
Original line number Diff line number Diff line
@@ -560,7 +560,7 @@ static void dpm_watchdog_clear(struct dpm_watchdog *wd)
	struct timer_list *timer = &wd->timer;

	timer_delete_sync(timer);
	destroy_timer_on_stack(timer);
	timer_destroy_on_stack(timer);
}
#else
#define DECLARE_DPM_WATCHDOG_ON_STACK(wd)
+3 −3
Original line number Diff line number Diff line
@@ -1312,9 +1312,9 @@ static void __cold try_to_generate_entropy(void)
	while (!crng_ready() && !signal_pending(current)) {
		/*
		 * Check !timer_pending() and then ensure that any previous callback has finished
		 * executing by checking try_to_del_timer_sync(), before queueing the next one.
		 * executing by checking timer_delete_sync_try(), before queueing the next one.
		 */
		if (!timer_pending(&stack->timer) && try_to_del_timer_sync(&stack->timer) >= 0) {
		if (!timer_pending(&stack->timer) && timer_delete_sync_try(&stack->timer) >= 0) {
			struct cpumask timer_cpus;
			unsigned int num_cpus;

@@ -1354,7 +1354,7 @@ static void __cold try_to_generate_entropy(void)
	mix_pool_bytes(&stack->entropy, sizeof(stack->entropy));

	timer_delete_sync(&stack->timer);
	destroy_timer_on_stack(&stack->timer);
	timer_destroy_on_stack(&stack->timer);
}


+1 −1
Original line number Diff line number Diff line
@@ -413,7 +413,7 @@ static int test_wait_timeout(void *arg)
	err = 0;
err_free:
	timer_delete_sync(&wt.timer);
	destroy_timer_on_stack(&wt.timer);
	timer_destroy_on_stack(&wt.timer);
	dma_fence_signal(wt.f);
	dma_fence_put(wt.f);
	return err;
Loading