[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YULAuEeSSeLTcBM9@piliu.users.ipa.redhat.com>
Date: Thu, 16 Sep 2021 11:57:44 +0800
From: Pingfan Liu <piliu@...hat.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Pingfan Liu <kernelfans@...il.com>, linux-kernel@...r.kernel.org,
Petr Mladek <pmladek@...e.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Wang Qing <wangqing@...o.com>,
Santosh Sivaraj <santosh@...six.org>,
Sumit Garg <sumit.garg@...aro.org>,
Will Deacon <will@...nel.org>,
Mark Rutland <mark.rutland@....com>
Subject: Re: [PATCH 2/5] kernel/watchdog_hld: clarify the condition in
hardlockup_detector_event_create()
On Wed, Sep 15, 2021 at 03:45:06PM +0200, Peter Zijlstra wrote:
> On Wed, Sep 15, 2021 at 11:51:00AM +0800, Pingfan Liu wrote:
> > hardlockup_detector_event_create() indirectly calls
> > kmem_cache_alloc_node(), which is blockable.
> >
> > So here, the really planned context is is_percpu_thread().
> >
> > Signed-off-by: Pingfan Liu <kernelfans@...il.com>
> > Cc: Petr Mladek <pmladek@...e.com>
> > Cc: Andrew Morton <akpm@...ux-foundation.org>
> > Cc: Wang Qing <wangqing@...o.com>
> > Cc: "Peter Zijlstra (Intel)" <peterz@...radead.org>
> > Cc: Santosh Sivaraj <santosh@...six.org>
> > Cc: Sumit Garg <sumit.garg@...aro.org>
> > Cc: Will Deacon <will@...nel.org>
> > Cc: Mark Rutland <mark.rutland@....com>
> > To: linux-kernel@...r.kernel.org
> > ---
> > kernel/watchdog_hld.c | 5 ++++-
> > 1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/kernel/watchdog_hld.c b/kernel/watchdog_hld.c
> > index 247bf0b1582c..6876e796dbf5 100644
> > --- 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());
> > + cpu = raw_smp_processor_id();
> > wd_attr = &wd_hw_attr;
> > wd_attr->sample_period = hw_nmi_get_sample_period(watchdog_thresh);
>
> This patch makes no sense.
This patch aims to disable any attempt such as using get_cpu()/put_cpu() to
shut up the check_preemption_disabled().
But if anybody is familiar with the integration of watchdog_hld and
cpuhp, he should know the right way without this BUG_ON() or warn.
Do you still think it is pointless?
Thanks,
Pingfan
Powered by blists - more mailing lists