Message ID | TYSPR04MB7084FCAF74B4CFA30D386B698A2A2@TYSPR04MB7084.apcprd04.prod.outlook.com (mailing list archive) |
---|---|
State | Handled Elsewhere |
Headers | show |
Series | hrtimer:Add get_hrtimer_cpu_base() | expand |
On Wed, Mar 13 2024 at 05:30, Enlin Mu wrote: > From: Enlin Mu <enlin.mu@unisoc.com> > > On the Arm platform,arch_timer may occur irq strom, > By using the next_timer of hrtimer_cpu_base, it is > possible to quickly locate abnormal timers. > As it is an out of tree modules,the function needs > to be exproted. No. We are not exporting for out of tree code.
Thomas Gleixner <tglx@linutronix.de> 于2024年3月14日周四 18:22写道: > > On Wed, Mar 13 2024 at 05:30, Enlin Mu wrote: > > From: Enlin Mu <enlin.mu@unisoc.com> > > > > On the Arm platform,arch_timer may occur irq strom, > > By using the next_timer of hrtimer_cpu_base, it is > > possible to quickly locate abnormal timers. > > As it is an out of tree modules,the function needs > > to be exproted. > > No. We are not exporting for out of tree code. Can you explain it?
On Thu, Mar 14 2024 at 18:45, Enlin Mu wrote: > Thomas Gleixner <tglx@linutronix.de> 于2024年3月14日周四 18:22写道: >> >> On Wed, Mar 13 2024 at 05:30, Enlin Mu wrote: >> > From: Enlin Mu <enlin.mu@unisoc.com> >> > >> > On the Arm platform,arch_timer may occur irq strom, >> > By using the next_timer of hrtimer_cpu_base, it is >> > possible to quickly locate abnormal timers. >> > As it is an out of tree modules,the function needs >> > to be exproted. >> >> No. We are not exporting for out of tree code. > Can you explain it? Exporting functions or variables requires an in tree usecase.
Thomas Gleixner <tglx@linutronix.de> 于2024年3月14日周四 19:59写道: > > On Thu, Mar 14 2024 at 18:45, Enlin Mu wrote: > > Thomas Gleixner <tglx@linutronix.de> 于2024年3月14日周四 18:22写道: > >> > >> On Wed, Mar 13 2024 at 05:30, Enlin Mu wrote: > >> > From: Enlin Mu <enlin.mu@unisoc.com> > >> > > >> > On the Arm platform,arch_timer may occur irq strom, > >> > By using the next_timer of hrtimer_cpu_base, it is > >> > possible to quickly locate abnormal timers. > >> > As it is an out of tree modules,the function needs > >> > to be exproted. > >> > >> No. We are not exporting for out of tree code. > > Can you explain it? > > Exporting functions or variables requires an in tree usecase. > Thands, I got it. If patch is following: --- include/linux/hrtimer.h | 1 + kernel/time/hrtimer.c | 1 + kernel/time/tick-internal.h | 1 - kernel/time/timer_list.c | 1 + 4 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h index 2a37d2a8e808..a0eaed4a3edc 100644 --- a/include/linux/hrtimer.h +++ b/include/linux/hrtimer.h @@ -278,6 +278,7 @@ static inline void hrtimer_start(struct hrtimer *timer, ktime_t tim, extern int hrtimer_cancel(struct hrtimer *timer); extern int hrtimer_try_to_cancel(struct hrtimer *timer); extern struct hrtimer_cpu_base *get_hrtimer_cpu_base(int cpu); +DECLARE_PER_CPU(struct tick_device, tick_cpu_device); static inline void hrtimer_start_expires(struct hrtimer *timer, enum hrtimer_mode mode) diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c index f7cf7d48b91d..49024d07c61b 100644 --- a/kernel/time/hrtimer.c +++ b/kernel/time/hrtimer.c @@ -113,6 +113,7 @@ DEFINE_PER_CPU(struct hrtimer_cpu_base, hrtimer_bases) = }, } }; +EXPORT_PER_CPU_SYMBOL(hrtimer_bases); static const int hrtimer_clock_to_base_table[MAX_CLOCKS] = { /* Make sure we catch unsupported clockids */ diff --git a/kernel/time/tick-internal.h b/kernel/time/tick-internal.h index 5f2105e637bd..96df7d21506c 100644 --- a/kernel/time/tick-internal.h +++ b/kernel/time/tick-internal.h @@ -18,7 +18,6 @@ struct timer_events { # define TICK_DO_TIMER_NONE -1 # define TICK_DO_TIMER_BOOT -2 -DECLARE_PER_CPU(struct tick_device, tick_cpu_device); extern ktime_t tick_next_period; extern int tick_do_timer_cpu __read_mostly; diff --git a/kernel/time/timer_list.c b/kernel/time/timer_list.c index 1c311c46da50..b6fee42e3861 100644 --- a/kernel/time/timer_list.c +++ b/kernel/time/timer_list.c @@ -16,6 +16,7 @@ #include <linux/uaccess.h> #include "tick-internal.h" +#include <linux/hrtimer.h> struct timer_list_iter { int cpu; -- please review and comment. Thanks
Enlin Mu <enlinmu@gmail.com> 于2024年3月15日周五 10:07写道: > > Thomas Gleixner <tglx@linutronix.de> 于2024年3月14日周四 19:59写道: > > > > On Thu, Mar 14 2024 at 18:45, Enlin Mu wrote: > > > Thomas Gleixner <tglx@linutronix.de> 于2024年3月14日周四 18:22写道: > > >> > > >> On Wed, Mar 13 2024 at 05:30, Enlin Mu wrote: > > >> > From: Enlin Mu <enlin.mu@unisoc.com> > > >> > > > >> > On the Arm platform,arch_timer may occur irq strom, > > >> > By using the next_timer of hrtimer_cpu_base, it is > > >> > possible to quickly locate abnormal timers. > > >> > As it is an out of tree modules,the function needs > > >> > to be exproted. > > >> > > >> No. We are not exporting for out of tree code. > > > Can you explain it? > > > > Exporting functions or variables requires an in tree usecase. > > > Thands, I got it. > > If patch is following: > --- > include/linux/hrtimer.h | 1 + > kernel/time/hrtimer.c | 1 + > kernel/time/tick-internal.h | 1 - > kernel/time/timer_list.c | 1 + > 4 files changed, 3 insertions(+), 1 deletion(-) > > diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h > index 2a37d2a8e808..a0eaed4a3edc 100644 > --- a/include/linux/hrtimer.h > +++ b/include/linux/hrtimer.h > @@ -278,6 +278,7 @@ static inline void hrtimer_start(struct hrtimer > *timer, ktime_t tim, > extern int hrtimer_cancel(struct hrtimer *timer); > extern int hrtimer_try_to_cancel(struct hrtimer *timer); > extern struct hrtimer_cpu_base *get_hrtimer_cpu_base(int cpu); > +DECLARE_PER_CPU(struct tick_device, tick_cpu_device); > > static inline void hrtimer_start_expires(struct hrtimer *timer, > enum hrtimer_mode mode) > diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c > index f7cf7d48b91d..49024d07c61b 100644 > --- a/kernel/time/hrtimer.c > +++ b/kernel/time/hrtimer.c > @@ -113,6 +113,7 @@ DEFINE_PER_CPU(struct hrtimer_cpu_base, hrtimer_bases) = > }, > } > }; > +EXPORT_PER_CPU_SYMBOL(hrtimer_bases); > > static const int hrtimer_clock_to_base_table[MAX_CLOCKS] = { > /* Make sure we catch unsupported clockids */ > diff --git a/kernel/time/tick-internal.h b/kernel/time/tick-internal.h > index 5f2105e637bd..96df7d21506c 100644 > --- a/kernel/time/tick-internal.h > +++ b/kernel/time/tick-internal.h > @@ -18,7 +18,6 @@ struct timer_events { > # define TICK_DO_TIMER_NONE -1 > # define TICK_DO_TIMER_BOOT -2 > > -DECLARE_PER_CPU(struct tick_device, tick_cpu_device); > extern ktime_t tick_next_period; > extern int tick_do_timer_cpu __read_mostly; > > diff --git a/kernel/time/timer_list.c b/kernel/time/timer_list.c > index 1c311c46da50..b6fee42e3861 100644 > --- a/kernel/time/timer_list.c > +++ b/kernel/time/timer_list.c > @@ -16,6 +16,7 @@ > #include <linux/uaccess.h> > > #include "tick-internal.h" > +#include <linux/hrtimer.h> > > struct timer_list_iter { > int cpu; > -- > > please review and comment. > > Thanks Hi Thomas Sorry, I made a mistake Please ignore this comment
Thomas Gleixner <tglx@linutronix.de> 于2024年3月14日周四 19:59写道: > > On Thu, Mar 14 2024 at 18:45, Enlin Mu wrote: > > Thomas Gleixner <tglx@linutronix.de> 于2024年3月14日周四 18:22写道: > >> > >> On Wed, Mar 13 2024 at 05:30, Enlin Mu wrote: > >> > From: Enlin Mu <enlin.mu@unisoc.com> > >> > > >> > On the Arm platform,arch_timer may occur irq strom, > >> > By using the next_timer of hrtimer_cpu_base, it is > >> > possible to quickly locate abnormal timers. > >> > As it is an out of tree modules,the function needs > >> > to be exproted. > >> > >> No. We are not exporting for out of tree code. > > Can you explain it? > > Exporting functions or variables requires an in tree usecase. > OK, Thanks, I got it. If this pathc is following(exprot hrtimer_bases): --- include/linux/hrtimer.h | 1 + kernel/time/hrtimer.c | 1 + kernel/time/tick-internal.h | 1 - kernel/time/timer_list.c | 1 + 4 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h index 2a37d2a8e808..259462ad6e4a 100644 --- a/include/linux/hrtimer.h +++ b/include/linux/hrtimer.h @@ -278,6 +278,7 @@ static inline void hrtimer_start(struct hrtimer *timer, ktime_t tim, extern int hrtimer_cancel(struct hrtimer *timer); extern int hrtimer_try_to_cancel(struct hrtimer *timer); extern struct hrtimer_cpu_base *get_hrtimer_cpu_base(int cpu); +DECLARE_PER_CPU(struct hrtimer_cpu_base, hrtimer_bases); static inline void hrtimer_start_expires(struct hrtimer *timer, enum hrtimer_mode mode) diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c index f7cf7d48b91d..49024d07c61b 100644 --- a/kernel/time/hrtimer.c +++ b/kernel/time/hrtimer.c @@ -113,6 +113,7 @@ DEFINE_PER_CPU(struct hrtimer_cpu_base, hrtimer_bases) = }, } }; +EXPORT_PER_CPU_SYMBOL(hrtimer_bases); static const int hrtimer_clock_to_base_table[MAX_CLOCKS] = { /* Make sure we catch unsupported clockids */ diff --git a/kernel/time/tick-internal.h b/kernel/time/tick-internal.h index 5f2105e637bd..f649d3509060 100644 --- a/kernel/time/tick-internal.h +++ b/kernel/time/tick-internal.h @@ -175,7 +175,6 @@ static inline void timers_update_nohz(void) { } #define tick_nohz_active (0) #endif -DECLARE_PER_CPU(struct hrtimer_cpu_base, hrtimer_bases); extern u64 get_next_timer_interrupt(unsigned long basej, u64 basem); u64 timer_base_try_to_set_idle(unsigned long basej, u64 basem, bool *idle); diff --git a/kernel/time/timer_list.c b/kernel/time/timer_list.c index 1c311c46da50..877b9130cd64 100644 --- a/kernel/time/timer_list.c +++ b/kernel/time/timer_list.c @@ -14,6 +14,7 @@ #include <linux/nmi.h> #include <linux/uaccess.h> +#include <linux/hrtimer.h> #include "tick-internal.h" -- Please review and comment. Thanks.
On Fri, Mar 15 2024 at 11:12, Enlin Mu wrote: > Thomas Gleixner <tglx@linutronix.de> 于2024年3月14日周四 19:59写道: >> >> On Thu, Mar 14 2024 at 18:45, Enlin Mu wrote: >> > Thomas Gleixner <tglx@linutronix.de> 于2024年3月14日周四 18:22写道: >> >> >> >> On Wed, Mar 13 2024 at 05:30, Enlin Mu wrote: >> >> > From: Enlin Mu <enlin.mu@unisoc.com> >> >> > >> >> > On the Arm platform,arch_timer may occur irq strom, >> >> > By using the next_timer of hrtimer_cpu_base, it is >> >> > possible to quickly locate abnormal timers. >> >> > As it is an out of tree modules,the function needs >> >> > to be exproted. >> >> >> >> No. We are not exporting for out of tree code. >> > Can you explain it? >> >> Exporting functions or variables requires an in tree usecase. > > OK, Thanks, I got it. No, you did not get it at all. Q: Where is the actual in kernel use case which utilizes the exported symbol in a module? A: There is still none. For further clarification there will be none ever because you are violating all encapsulation rules of the kernel subsytems without providing at least an attempt of justification. Nothing outside of the timer core subsystem has any business to fiddle with this data structure ever. Period.
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h index aa1e65ccb615..2a37d2a8e808 100644 --- a/include/linux/hrtimer.h +++ b/include/linux/hrtimer.h @@ -277,6 +277,7 @@ static inline void hrtimer_start(struct hrtimer *timer, ktime_t tim, extern int hrtimer_cancel(struct hrtimer *timer); extern int hrtimer_try_to_cancel(struct hrtimer *timer); +extern struct hrtimer_cpu_base *get_hrtimer_cpu_base(int cpu); static inline void hrtimer_start_expires(struct hrtimer *timer, enum hrtimer_mode mode) diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c index 70625dff62ce..f7cf7d48b91d 100644 --- a/kernel/time/hrtimer.c +++ b/kernel/time/hrtimer.c @@ -1309,6 +1309,12 @@ void hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim, } EXPORT_SYMBOL_GPL(hrtimer_start_range_ns); +struct hrtimer_cpu_base *get_hrtimer_cpu_base(int cpu) +{ + return &per_cpu(hrtimer_bases, cpu); +} +EXPORT_SYMBOL_GPL(get_hrtimer_cpu_base); + /** * hrtimer_try_to_cancel - try to deactivate a timer * @timer: hrtimer to stop