Skip to content

Commit 4c424d6

Browse files
committed
Merge: sched: tick and timer updates and fixes
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/4112 JIRA: https://issues.redhat.com/browse/RHEL-33787 Series and prerequisites from v6.8 to update and provide some fixes for scheduler tick and timer related code. This addresses some false positive softirq pending traces and some potential nohz_full tick issues. Signed-off-by: Phil Auld <pauld@redhat.com> Approved-by: Tony Camuso <tcamuso@redhat.com> Approved-by: Waiman Long <longman@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: Lucas Zampieri <lzampier@redhat.com>
2 parents f493d0c + 34aefd2 commit 4c424d6

File tree

11 files changed

+396
-277
lines changed

11 files changed

+396
-277
lines changed

MAINTAINERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13693,7 +13693,7 @@ F: include/uapi/linux/nitro_enclaves.h
1369313693
F: samples/nitro_enclaves/
1369413694

1369513695
NOHZ, DYNTICKS SUPPORT
13696-
M: Frederic Weisbecker <fweisbec@gmail.com>
13696+
M: Frederic Weisbecker <frederic@kernel.org>
1369713697
M: Thomas Gleixner <tglx@linutronix.de>
1369813698
M: Ingo Molnar <mingo@kernel.org>
1369913699
L: linux-kernel@vger.kernel.org

drivers/base/cpu.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,8 @@ static const struct attribute_group *cpu_root_attr_groups[] = {
506506
bool cpu_is_hotpluggable(unsigned int cpu)
507507
{
508508
struct device *dev = get_cpu_device(cpu);
509-
return dev && container_of(dev, struct cpu, dev)->hotpluggable;
509+
return dev && container_of(dev, struct cpu, dev)->hotpluggable
510+
&& tick_nohz_cpu_hotpluggable(cpu);
510511
}
511512
EXPORT_SYMBOL_GPL(cpu_is_hotpluggable);
512513

include/linux/tick.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ extern void tick_nohz_dep_set_signal(struct task_struct *tsk,
206206
enum tick_dep_bits bit);
207207
extern void tick_nohz_dep_clear_signal(struct signal_struct *signal,
208208
enum tick_dep_bits bit);
209+
extern bool tick_nohz_cpu_hotpluggable(unsigned int cpu);
209210

210211
/*
211212
* The below are tick_nohz_[set,clear]_dep() wrappers that optimize off-cases
@@ -270,6 +271,7 @@ static inline void tick_nohz_full_add_cpus_to(struct cpumask *mask) { }
270271

271272
static inline void tick_nohz_dep_set_cpu(int cpu, enum tick_dep_bits bit) { }
272273
static inline void tick_nohz_dep_clear_cpu(int cpu, enum tick_dep_bits bit) { }
274+
static inline bool tick_nohz_cpu_hotpluggable(unsigned int cpu) { return true; }
273275

274276
static inline void tick_dep_set(enum tick_dep_bits bit) { }
275277
static inline void tick_dep_clear(enum tick_dep_bits bit) { }

include/trace/events/timer.h

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,44 +46,46 @@ DEFINE_EVENT(timer_class, timer_init,
4646

4747
/**
4848
* timer_start - called when the timer is started
49-
* @timer: pointer to struct timer_list
50-
* @expires: the timers expiry time
49+
* @timer: pointer to struct timer_list
50+
* @bucket_expiry: the bucket expiry time
5151
*/
5252
TRACE_EVENT(timer_start,
5353

5454
TP_PROTO(struct timer_list *timer,
55-
unsigned long expires,
56-
unsigned int flags),
55+
unsigned long bucket_expiry),
5756

58-
TP_ARGS(timer, expires, flags),
57+
TP_ARGS(timer, bucket_expiry),
5958

6059
TP_STRUCT__entry(
6160
__field( void *, timer )
6261
__field( void *, function )
6362
__field( unsigned long, expires )
63+
__field( unsigned long, bucket_expiry )
6464
__field( unsigned long, now )
6565
__field( unsigned int, flags )
6666
),
6767

6868
TP_fast_assign(
6969
__entry->timer = timer;
7070
__entry->function = timer->function;
71-
__entry->expires = expires;
71+
__entry->expires = timer->expires;
72+
__entry->bucket_expiry = bucket_expiry;
7273
__entry->now = jiffies;
73-
__entry->flags = flags;
74+
__entry->flags = timer->flags;
7475
),
7576

76-
TP_printk("timer=%p function=%ps expires=%lu [timeout=%ld] cpu=%u idx=%u flags=%s",
77+
TP_printk("timer=%p function=%ps expires=%lu [timeout=%ld] bucket_expiry=%lu cpu=%u idx=%u flags=%s",
7778
__entry->timer, __entry->function, __entry->expires,
7879
(long)__entry->expires - __entry->now,
79-
__entry->flags & TIMER_CPUMASK,
80+
__entry->bucket_expiry, __entry->flags & TIMER_CPUMASK,
8081
__entry->flags >> TIMER_ARRAYSHIFT,
8182
decode_timer_flags(__entry->flags & TIMER_TRACE_FLAGMASK))
8283
);
8384

8485
/**
8586
* timer_expire_entry - called immediately before the timer callback
8687
* @timer: pointer to struct timer_list
88+
* @baseclk: value of timer_base::clk when timer expires
8789
*
8890
* Allows to determine the timer latency.
8991
*/
@@ -140,6 +142,26 @@ DEFINE_EVENT(timer_class, timer_cancel,
140142
TP_ARGS(timer)
141143
);
142144

145+
TRACE_EVENT(timer_base_idle,
146+
147+
TP_PROTO(bool is_idle, unsigned int cpu),
148+
149+
TP_ARGS(is_idle, cpu),
150+
151+
TP_STRUCT__entry(
152+
__field( bool, is_idle )
153+
__field( unsigned int, cpu )
154+
),
155+
156+
TP_fast_assign(
157+
__entry->is_idle = is_idle;
158+
__entry->cpu = cpu;
159+
),
160+
161+
TP_printk("is_idle=%d cpu=%d",
162+
__entry->is_idle, __entry->cpu)
163+
);
164+
143165
#define decode_clockid(type) \
144166
__print_symbolic(type, \
145167
{ CLOCK_REALTIME, "CLOCK_REALTIME" }, \
@@ -190,7 +212,8 @@ TRACE_EVENT(hrtimer_init,
190212

191213
/**
192214
* hrtimer_start - called when the hrtimer is started
193-
* @hrtimer: pointer to struct hrtimer
215+
* @hrtimer: pointer to struct hrtimer
216+
* @mode: the hrtimers mode
194217
*/
195218
TRACE_EVENT(hrtimer_start,
196219

kernel/time/tick-common.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,6 @@ static void tick_setup_device(struct tick_device *td,
219219
*/
220220
if (tick_do_timer_cpu == TICK_DO_TIMER_BOOT) {
221221
tick_do_timer_cpu = cpu;
222-
223222
tick_next_period = ktime_get();
224223
#ifdef CONFIG_NO_HZ_FULL
225224
/*

0 commit comments

Comments
 (0)