Re: [PATCH 1/3] powerpc: Add __hard_irqs_disabled()
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Date: 2017-05-16 11:22:13
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Date: 2017-05-16 11:22:13
On Tue, 2017-05-16 at 14:56 +0530, Aneesh Kumar K.V wrote:
+static inline bool __hard_irqs_disabled(void)
+{
+ unsigned long flags = mfmsr();
+ return (flags & MSR_EE) == 0;
+}
+Reading the MSR has a cost. Can't we rely on paca->irq_happened being non-0 ? (If you are paranoid, add a test of msr as well and warn if there's a mismatch ...) Cheers, Ben.