All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Thomas Gleixner <tglx@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>, Calvin Owens <calvin@wbinvd.org>,
	Petr Mladek <pmladek@suse.com>,
	linux-kernel@vger.kernel.org, arighi@nvidia.com,
	yaozhenguo1@gmail.com, tj@kernel.org,
	feng.tang@linux.alibaba.com, lirongqing@baidu.com,
	realwujing@gmail.com, hu.shengming@zte.com.cn,
	dianders@chromium.org, joel.granados@kernel.org,
	Ingo Molnar <mingo@redhat.com>,
	Juri Lelli <juri.lelli@redhat.com>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
	Valentin Schneider <vschneid@redhat.com>,
	Frederic Weisbecker <frederic@kernel.org>,
	Anna-Maria Behnsen <anna-maria@linutronix.de>,
	x86@kernel.org
Subject: Re: [PATCH] clockevents: Prevent timer interrupt starvation
Date: Fri, 3 Apr 2026 23:01:45 +0200	[thread overview]
Message-ID: <20260403210145.GD2872@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <87341c6mt0.ffs@tglx>

On Fri, Apr 03, 2026 at 06:17:15PM +0200, Thomas Gleixner wrote:

> --- a/kernel/time/hrtimer.c
> +++ b/kernel/time/hrtimer.c
> @@ -1888,6 +1888,7 @@ void hrtimer_interrupt(struct clock_even
>  	BUG_ON(!cpu_base->hres_active);
>  	cpu_base->nr_events++;
>  	dev->next_event = KTIME_MAX;
> +	dev->next_event_forced = 0;
>  
>  	raw_spin_lock_irqsave(&cpu_base->lock, flags);
>  	entry_time = now = hrtimer_update_base(cpu_base);
> --- a/kernel/time/tick-common.c
> +++ b/kernel/time/tick-common.c
> @@ -110,6 +110,7 @@ void tick_handle_periodic(struct clock_e
>  	int cpu = smp_processor_id();
>  	ktime_t next = dev->next_event;
>  
> +	dev->next_event_forced = 0;
>  	tick_periodic(cpu);
>  
>  	/*
> --- a/kernel/time/tick-sched.c
> +++ b/kernel/time/tick-sched.c
> @@ -1513,6 +1513,7 @@ static void tick_nohz_lowres_handler(str
>  	struct tick_sched *ts = this_cpu_ptr(&tick_cpu_sched);
>  
>  	dev->next_event = KTIME_MAX;
> +	dev->next_event_forced = 0;
>  
>  	if (likely(tick_nohz_handler(&ts->sched_timer) == HRTIMER_RESTART))
>  		tick_program_event(hrtimer_get_expires(&ts->sched_timer), 1);

Doesn't that want to be something like this instead?


---
virtual patch

@@
expression E;
struct clock_event_device *ptr;
@@

- if (E->event_handler)
-    E->event_handler(E);
+ clockevent_handler(E);

@@
expression E;
struct clock_event_device *ptr;
@@

- E->event_handler(E);
+ clockevent_handler(E);

---
--- a/include/linux/clockchips.h
+++ b/include/linux/clockchips.h
@@ -159,6 +159,13 @@ static inline bool clockevent_state_ones
 	return dev->state_use_accessors == CLOCK_EVT_STATE_ONESHOT_STOPPED;
 }
 
+static inline void clockevent_handler(struct clock_event_device *dev)
+{
+	dev->next_event_forced = 0;
+	if (dev->event_handler)
+		dev->event_handler(dev);
+}
+
 /*
  * Calculate a multiplication factor for scaled math, which is used to convert
  * nanoseconds based values to clock ticks:

  reply	other threads:[~2026-04-03 21:02 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-24 23:32 [BUG] Random hard lockup with userspace %ip on 7.0-rc5 Calvin Owens
2026-03-25  9:03 ` Petr Mladek
2026-03-25 16:56   ` Thomas Gleixner
2026-04-01  1:58     ` Calvin Owens
2026-04-01 15:01       ` Thomas Gleixner
2026-04-01 15:12         ` Borislav Petkov
2026-04-01 16:34         ` Borislav Petkov
2026-04-02 17:07           ` [PATCH] clockevents: Prevent timer interrupt starvation Thomas Gleixner
2026-04-03  5:11             ` Calvin Owens
2026-04-03 14:41               ` Thomas Gleixner
2026-04-03 15:58                 ` Calvin Owens
2026-04-03 19:00                   ` Thomas Gleixner
2026-04-04  0:15                     ` Calvin Owens
2026-04-08  8:52                       ` Thomas Gleixner
2026-04-03 12:16             ` Peter Zijlstra
2026-04-03 14:43               ` Thomas Gleixner
2026-04-03 16:17               ` Thomas Gleixner
2026-04-03 21:01                 ` Peter Zijlstra [this message]
2026-04-03 21:24                   ` Thomas Gleixner
2026-04-03 22:14                     ` Thomas Gleixner
2026-04-03 22:21                       ` Peter Zijlstra
2026-03-27  1:36   ` [BUG] Random hard lockup with userspace %ip on 7.0-rc5 Feng Tang
2026-03-27 15:36     ` Calvin Owens

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260403210145.GD2872@noisy.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=anna-maria@linutronix.de \
    --cc=arighi@nvidia.com \
    --cc=bp@alien8.de \
    --cc=bsegall@google.com \
    --cc=calvin@wbinvd.org \
    --cc=dianders@chromium.org \
    --cc=dietmar.eggemann@arm.com \
    --cc=feng.tang@linux.alibaba.com \
    --cc=frederic@kernel.org \
    --cc=hu.shengming@zte.com.cn \
    --cc=joel.granados@kernel.org \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lirongqing@baidu.com \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=pmladek@suse.com \
    --cc=realwujing@gmail.com \
    --cc=rostedt@goodmis.org \
    --cc=tglx@kernel.org \
    --cc=tj@kernel.org \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@redhat.com \
    --cc=x86@kernel.org \
    --cc=yaozhenguo1@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.