@@ -2062,9 +2062,9 @@ print_bad_irq_dependency(struct task_struct *curr,
20622062 pr_warn ("-----------------------------------------------------\n" );
20632063 pr_warn ("%s/%d [HC%u[%lu]:SC%u[%lu]:HE%u:SE%u] is trying to acquire:\n" ,
20642064 curr -> comm , task_pid_nr (curr ),
2065- curr -> hardirq_context , hardirq_count () >> HARDIRQ_SHIFT ,
2065+ lockdep_hardirq_context ( curr ) , hardirq_count () >> HARDIRQ_SHIFT ,
20662066 curr -> softirq_context , softirq_count () >> SOFTIRQ_SHIFT ,
2067- curr -> hardirqs_enabled ,
2067+ lockdep_hardirqs_enabled ( curr ) ,
20682068 curr -> softirqs_enabled );
20692069 print_lock (next );
20702070
@@ -3658,7 +3658,7 @@ void lockdep_hardirqs_on_prepare(unsigned long ip)
36583658 if (unlikely (current -> lockdep_recursion & LOCKDEP_RECURSION_MASK ))
36593659 return ;
36603660
3661- if (unlikely (current -> hardirqs_enabled )) {
3661+ if (unlikely (lockdep_hardirqs_enabled ( current ) )) {
36623662 /*
36633663 * Neither irq nor preemption are disabled here
36643664 * so this is racy by nature but losing one hit
@@ -3686,7 +3686,7 @@ void lockdep_hardirqs_on_prepare(unsigned long ip)
36863686 * Can't allow enabling interrupts while in an interrupt handler,
36873687 * that's general bad form and such. Recursion, limited stack etc..
36883688 */
3689- if (DEBUG_LOCKS_WARN_ON (current -> hardirq_context ))
3689+ if (DEBUG_LOCKS_WARN_ON (lockdep_hardirq_context ( current ) ))
36903690 return ;
36913691
36923692 current -> hardirq_chain_key = current -> curr_chain_key ;
@@ -3724,7 +3724,7 @@ void noinstr lockdep_hardirqs_on(unsigned long ip)
37243724 if (unlikely (current -> lockdep_recursion & LOCKDEP_RECURSION_MASK ))
37253725 return ;
37263726
3727- if (curr -> hardirqs_enabled ) {
3727+ if (lockdep_hardirqs_enabled ( curr ) ) {
37283728 /*
37293729 * Neither irq nor preemption are disabled here
37303730 * so this is racy by nature but losing one hit
@@ -3751,7 +3751,7 @@ void noinstr lockdep_hardirqs_on(unsigned long ip)
37513751
37523752skip_checks :
37533753 /* we'll do an OFF -> ON transition: */
3754- curr -> hardirqs_enabled = 1 ;
3754+ this_cpu_write ( hardirqs_enabled , 1 ) ;
37553755 curr -> hardirq_enable_ip = ip ;
37563756 curr -> hardirq_enable_event = ++ curr -> irq_events ;
37573757 debug_atomic_inc (hardirqs_on_events );
@@ -3783,11 +3783,11 @@ void noinstr lockdep_hardirqs_off(unsigned long ip)
37833783 if (DEBUG_LOCKS_WARN_ON (!irqs_disabled ()))
37843784 return ;
37853785
3786- if (curr -> hardirqs_enabled ) {
3786+ if (lockdep_hardirqs_enabled ( curr ) ) {
37873787 /*
37883788 * We have done an ON -> OFF transition:
37893789 */
3790- curr -> hardirqs_enabled = 0 ;
3790+ this_cpu_write ( hardirqs_enabled , 0 ) ;
37913791 curr -> hardirq_disable_ip = ip ;
37923792 curr -> hardirq_disable_event = ++ curr -> irq_events ;
37933793 debug_atomic_inc (hardirqs_off_events );
@@ -3832,7 +3832,7 @@ void lockdep_softirqs_on(unsigned long ip)
38323832 * usage bit for all held locks, if hardirqs are
38333833 * enabled too:
38343834 */
3835- if (curr -> hardirqs_enabled )
3835+ if (lockdep_hardirqs_enabled ( curr ) )
38363836 mark_held_locks (curr , LOCK_ENABLED_SOFTIRQ );
38373837 lockdep_recursion_finish ();
38383838}
@@ -3881,7 +3881,7 @@ mark_usage(struct task_struct *curr, struct held_lock *hlock, int check)
38813881 */
38823882 if (!hlock -> trylock ) {
38833883 if (hlock -> read ) {
3884- if (curr -> hardirq_context )
3884+ if (lockdep_hardirq_context ( curr ) )
38853885 if (!mark_lock (curr , hlock ,
38863886 LOCK_USED_IN_HARDIRQ_READ ))
38873887 return 0 ;
@@ -3890,7 +3890,7 @@ mark_usage(struct task_struct *curr, struct held_lock *hlock, int check)
38903890 LOCK_USED_IN_SOFTIRQ_READ ))
38913891 return 0 ;
38923892 } else {
3893- if (curr -> hardirq_context )
3893+ if (lockdep_hardirq_context ( curr ) )
38943894 if (!mark_lock (curr , hlock , LOCK_USED_IN_HARDIRQ ))
38953895 return 0 ;
38963896 if (curr -> softirq_context )
@@ -3928,7 +3928,7 @@ mark_usage(struct task_struct *curr, struct held_lock *hlock, int check)
39283928
39293929static inline unsigned int task_irq_context (struct task_struct * task )
39303930{
3931- return LOCK_CHAIN_HARDIRQ_CONTEXT * !!task -> hardirq_context +
3931+ return LOCK_CHAIN_HARDIRQ_CONTEXT * !!lockdep_hardirq_context ( task ) +
39323932 LOCK_CHAIN_SOFTIRQ_CONTEXT * !!task -> softirq_context ;
39333933}
39343934
@@ -4021,7 +4021,7 @@ static inline short task_wait_context(struct task_struct *curr)
40214021 * Set appropriate wait type for the context; for IRQs we have to take
40224022 * into account force_irqthread as that is implied by PREEMPT_RT.
40234023 */
4024- if (curr -> hardirq_context ) {
4024+ if (lockdep_hardirq_context ( curr ) ) {
40254025 /*
40264026 * Check if force_irqthreads will run us threaded.
40274027 */
@@ -4864,11 +4864,11 @@ static void check_flags(unsigned long flags)
48644864 return ;
48654865
48664866 if (irqs_disabled_flags (flags )) {
4867- if (DEBUG_LOCKS_WARN_ON (current -> hardirqs_enabled )) {
4867+ if (DEBUG_LOCKS_WARN_ON (lockdep_hardirqs_enabled ( current ) )) {
48684868 printk ("possible reason: unannotated irqs-off.\n" );
48694869 }
48704870 } else {
4871- if (DEBUG_LOCKS_WARN_ON (!current -> hardirqs_enabled )) {
4871+ if (DEBUG_LOCKS_WARN_ON (!lockdep_hardirqs_enabled ( current ) )) {
48724872 printk ("possible reason: unannotated irqs-on.\n" );
48734873 }
48744874 }
0 commit comments