Messages in this thread | | | Date | Fri, 13 Nov 2020 17:30:12 +0000 | From | Mark Rutland <> | 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;
That'd be great, thanks!
With that, feel free to add:
Acked-by: Mark Rutland <mark.rutland@arm.com>
Mark.
| |