It is valid (albeit uncommon) to call local_irq_enable() without first having called local_irq_disable(). In this case we enter lockdep_hardirqs_on*() with IRQs enabled and trip a preemption warning for using __this_cpu_read(). Use this_cpu_read() instead to avoid the warning.
Unified · Split
| @@ -4057,7 +4057,7 @@ void lockdep_hardirqs_on_prepare(unsigned long ip) · 4056 unmodified lines | |||
| 4057 | if (unlikely(in_nmi())) | 4057 | if (unlikely(in_nmi())) |
| 4058 | return; | 4058 | return; |
| 4059 | 4059 | ||
| 4060 | if (unlikely(__this_cpu_read(lockdep_recursion))) | 4060 | if (unlikely(this_cpu_read(lockdep_recursion))) |
| 4061 | return; | 4061 | return; |
| 4062 | 4062 | ||
| 4063 | if (unlikely(lockdep_hardirqs_enabled())) { | 4063 | if (unlikely(lockdep_hardirqs_enabled())) { |
| @@ -4126,7 +4126,7 @@ void noinstr lockdep_hardirqs_on(unsigned long ip) · 62 unmodified lines | |||
| 4126 | goto skip_checks; | 4126 | goto skip_checks; |
| 4127 | } | 4127 | } |
| 4128 | 4128 | ||
| 4129 | if (unlikely(__this_cpu_read(lockdep_recursion))) | 4129 | if (unlikely(this_cpu_read(lockdep_recursion))) |
| 4130 | return; | 4130 | return; |
| 4131 | 4131 | ||
| 4132 | if (lockdep_hardirqs_enabled()) { | 4132 | if (lockdep_hardirqs_enabled()) { |