From patchwork Wed Sep 30 06:41:57 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sedat Dilek X-Patchwork-Id: 7292981 X-Patchwork-Delegate: jikos@jikos.cz Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 96171BEEA4 for ; Wed, 30 Sep 2015 06:42:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E96FC20693 for ; Wed, 30 Sep 2015 06:41:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 370AE206A1 for ; Wed, 30 Sep 2015 06:41:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753788AbbI3Gl6 (ORCPT ); Wed, 30 Sep 2015 02:41:58 -0400 Received: from mail-vk0-f49.google.com ([209.85.213.49]:34619 "EHLO mail-vk0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753650AbbI3Gl6 (ORCPT ); Wed, 30 Sep 2015 02:41:58 -0400 Received: by vkat63 with SMTP id t63so19427193vka.1 for ; Tue, 29 Sep 2015 23:41:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=idbc6EjNMizqIJ82dq9Wrm8GlnOPKj2NiVuyqN0c0yM=; b=i9sHrTukygJHq+cDOLmchW5F1j6wa9MTg41p1TrHxx6NN+q8dd/mqnjXeWWM9niXyd bqvRg9sb/U15Rjw1OUkcmE09aqcz1syM7Gc4hB+m3bR/BKZiHqXC2OWIiNC2/k4IEWH+ OhmvVgxkG0fQ3RAJJ/1uGpdcLvoWHPLdlfK3F12PSJahD2JpZwUCCbIPH5qJALw0a5bR 7BGfJQ1zIfbThDTZjUoAKCLY+mWNFcloq3kwHxd2dSwtPmNbVgZlr4V5iVUae24xp0h7 ZnGxHqTCh9/TYrTtSAZ+haZ6Q6l6DJGcerG3ictxe+bpcDmvqz7L0Tm7dB+7YAh4g8aH RCQg== MIME-Version: 1.0 X-Received: by 10.31.167.21 with SMTP id q21mr1650494vke.49.1443595317164; Tue, 29 Sep 2015 23:41:57 -0700 (PDT) Received: by 10.103.3.66 with HTTP; Tue, 29 Sep 2015 23:41:57 -0700 (PDT) Reply-To: sedat.dilek@gmail.com In-Reply-To: References: <1443427804-2957-1-git-send-email-sedat.dilek@gmail.com> Date: Wed, 30 Sep 2015 08:41:57 +0200 Message-ID: Subject: Re: [PATCH] usbhid: Fix lockdep unannotated irqs-off warning From: Sedat Dilek To: Jiri Kosina Cc: linux-input@vger.kernel.org, Tejun Heo , Lai Jiangshan , Steven Rostedt , Paul McKenney Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, T_TVD_MIME_EPI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP > What shall I do... play with lockdep (print_irqtrace_events) in > del_timer_sync()? I recalled that when Jiri was thinking towards a "compiler bug" that the part in del_timer_sync() emebedded in the "ifdef CONFIG_LOCKDEP" is somehow "mis-compiled". Furthermore, I see that try_to_del_timer_sync() is invoked within del_timer_sync() which does a spin_unlock_irqrestore(). [ kernel/time/timer.c ] int del_timer_sync(struct timer_list *timer) { #ifdef CONFIG_LOCKDEP unsigned long flags; /* * If lockdep gives a backtrace here, please reference * the synchronization rules above. */ local_irq_save(flags); lock_map_acquire(&timer->lockdep_map); lock_map_release(&timer->lockdep_map); local_irq_restore(flags); #endif /* * don't use it in hardirq context, because it * could lead to deadlock. */ WARN_ON(in_irq() && !(timer->flags & TIMER_IRQSAFE)); for (;;) { int ret = try_to_del_timer_sync(timer); if (ret >= 0) return ret; cpu_relax(); } } EXPORT_SYMBOL(del_timer_sync); #endif ... int try_to_del_timer_sync(struct timer_list *timer) { struct tvec_base *base; unsigned long flags; int ret = -1; debug_assert_init(timer); base = lock_timer_base(timer, &flags); if (base->running_timer != timer) { timer_stats_timer_clear_start_info(timer); ret = detach_if_pending(timer, base, true); } spin_unlock_irqrestore(&base->lock, flags); return ret; } EXPORT_SYMBOL(try_to_del_timer_sync); ... Is the attached patch suitable for a test? I remember I tried to turn lockdep kernel-config for amd64 but that was somehow tricky. Shall I ask timer folks? Thoughts? Thanks! - Sedat - From edb4cb72c631c5e588af40794830c5bb5d6a927a Mon Sep 17 00:00:00 2001 From: Sedat Dilek Date: Wed, 30 Sep 2015 08:20:15 +0200 Subject: [PATCH] timer: lockdep: Add WARN_ON(irqs_disabled()) to del_timer_sync() --- kernel/locking/lockdep.c | 1 + kernel/time/timer.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c index 8acfbf773e06..8b29b3dd518f 100644 --- a/kernel/locking/lockdep.c +++ b/kernel/locking/lockdep.c @@ -2410,6 +2410,7 @@ void print_irqtrace_events(struct task_struct *curr) printk("softirqs last disabled at (%u): ", curr->softirq_disable_event); print_ip_sym(curr->softirq_disable_ip); } +EXPORT_SYMBOL(print_irqtrace_events); static int HARDIRQ_verbose(struct lock_class *class) { diff --git a/kernel/time/timer.c b/kernel/time/timer.c index 84190f02b521..f434b2dce642 100644 --- a/kernel/time/timer.c +++ b/kernel/time/timer.c @@ -1082,6 +1082,9 @@ int del_timer_sync(struct timer_list *timer) #ifdef CONFIG_LOCKDEP unsigned long flags; + if(WARN_ON(irqs_disabled())) + print_irqtrace_events(current); + /* * If lockdep gives a backtrace here, please reference * the synchronization rules above. -- 2.5.3