[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201113195532.GA20519@gaia>
Date: Fri, 13 Nov 2020 19:55:33 +0000
From: Catalin Marinas <catalin.marinas@....com>
To: Ionela Voinescu <ionela.voinescu@....com>
Cc: Mark Rutland <mark.rutland@....com>, sudeep.holla@....com,
will@...nel.org, morten.rasmussen@....com,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] arm64: abort counter_read_on_cpu() when irqs_disabled()
On Fri, Nov 13, 2020 at 04:58:43PM +0000, Ionela Voinescu wrote:
> On Friday 13 Nov 2020 at 16:02:34 (+0000), Mark Rutland wrote:
> > On Fri, Nov 13, 2020 at 03:53:28PM +0000, Ionela Voinescu wrote:
> > > Given that smp_call_function_single() can deadlock when interrupts are
> > > disabled, abort the SMP call if irqs_disabled(). This scenario is
> > > currently not possible given the function's uses, but safeguard this for
> > > potential future uses.
> >
> > Sorry to contradict earlier feedback, but I think this is preferable
> > as-is, since smp_call_function_single() will
> > WARN_ON_ONCE(irqs_disabled())), but this will silently mask any dodgy
> > usage.
>
> Probably it only contradicts the chosen implementation.
>
> > If we want a separate check here, I reckon we should wrap it with a
> > WARN_ON_ONCE(), and only relax that if/when we have a legitimate case
> > for calling this with IRQs disabled.
> >
>
> That's fair. I'll replace the condition below with:
>
> if (!cpu_has_amu_feat(cpu))
> return -EOPNOTSUPP;
>
> if (WARN_ON_ONCE(irqs_disabled())
> return -EPERM;
Works for me. Thanks.
--
Catalin
Powered by blists - more mailing lists