From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754034AbcBVKIR (ORCPT ); Mon, 22 Feb 2016 05:08:17 -0500 Received: from szxga01-in.huawei.com ([58.251.152.64]:37131 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753558AbcBVKIO (ORCPT ); Mon, 22 Feb 2016 05:08:14 -0500 From: Wang Yufen To: , , CC: , , Wang Yufen , Ma Jun Subject: [PATCH] trace/irq: fix WARNING in check_flags while CONFIG_TRACE_IRQFLAGS opened Date: Mon, 22 Feb 2016 18:06:45 +0800 Message-ID: <1456135605-8888-1-git-send-email-wangyufen@huawei.com> X-Mailer: git-send-email 1.8.1.msysgit.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.177.25.132] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020205.56CADDC5.0113,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-06-18 04:22:30, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: df66506463a8f5798856bc7e94bd7a16 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org if CONFIG_TRACE_IRQFLAGS opened, we got that warning: [ 214.078880] ------------[ cut here ]------------ [ 214.083521] WARNING: CPU: 4 PID: 1 at kernel/locking/lockdep.c:3557 check_flags.part.40+0x1c0/0x1d0() [ 214.092778] DEBUG_LOCKS_WARN_ON(current->hardirqs_enabled) [ 214.098110] Modules linked in: [ 214.101373] CPU: 4 PID: 1 Comm: systemd Tainted: G W 4.1.15+ #15 [ 214.108537] Hardware name: Hisilicon Hi1610 16core Pangea Board (DT) [ 214.114916] Call trace: [ 214.117373] [] dump_backtrace+0x0/0x1a0 [ 214.122794] [] show_stack+0x20/0x30 [ 214.127867] [] dump_stack+0x8c/0xb8 [ 214.132939] [] warn_slowpath_common+0xa8/0xe0 [ 214.138882] [] warn_slowpath_fmt+0x74/0xa0 [ 214.144563] [] check_flags.part.40+0x1c0/0x1d0 [ 214.150594] [] lock_is_held+0x80/0xa0 [ 214.155839] [] rcu_note_context_switch+0x3dc/0x410 [ 214.162219] [] __schedule+0x5c/0xb00 [ 214.167377] [] schedule+0x40/0xa0 [ 214.172272] ---[ end trace 2d1dc460f8460cd7 ]--- [ 214.176906] possible reason: unannotated irqs-off. It's because irqflags is not the same as current->hardirqs_enabled, I think maybe use local_irq_XXX to instead raw_local_irq_XXX can fix that warning Signed-off-by: Wang Yufen Signed-off-by: Ma Jun --- kernel/locking/lockdep.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c index 716547f..1ed8b35 100644 --- a/kernel/locking/lockdep.c +++ b/kernel/locking/lockdep.c @@ -3620,13 +3620,13 @@ int lock_is_held(struct lockdep_map *lock) if (unlikely(current->lockdep_recursion)) return 1; /* avoid false negative lockdep_assert_held() */ - raw_local_irq_save(flags); + local_irq_save(flags); check_flags(flags); current->lockdep_recursion = 1; ret = __lock_is_held(lock); current->lockdep_recursion = 0; - raw_local_irq_restore(flags); + local_irq_restore(flags); return ret; } -- 1.7.1