lkml.org 
[lkml]   [2021]   [Sep]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/5] kernel/watchdog_hld: clarify the condition in hardlockup_detector_event_create()
On Wed, 15 Sep 2021 11:51:00 +0800 Pingfan Liu <kernelfans@gmail.com> wrote:

> hardlockup_detector_event_create() indirectly calls
> kmem_cache_alloc_node(), which is blockable.
>
> So here, the really planned context is is_percpu_thread().
>
> ...
>
> --- a/kernel/watchdog_hld.c
> +++ b/kernel/watchdog_hld.c
> @@ -165,10 +165,13 @@ static void watchdog_overflow_callback(struct perf_event *event,
>
> static int hardlockup_detector_event_create(void)
> {
> - unsigned int cpu = smp_processor_id();
> + unsigned int cpu;
> struct perf_event_attr *wd_attr;
> struct perf_event *evt;
>
> + /* This function plans to execute in cpu bound kthread */
> + BUG_ON(!is_percpu_thread());

Can we avoid adding the BUG()? Find a way to emit a WARNing and then
permit the kernel to continue?

> + cpu = raw_smp_processor_id();
> wd_attr = &wd_hw_attr;
> wd_attr->sample_period = hw_nmi_get_sample_period(watchdog_thresh);

\
 
 \ /
  Last update: 2021-09-15 06:07    [W:0.123 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site