From: Jan Kara <jack@suse.cz>
To: linux-fsdevel@vger.kernel.org
Cc: linux-ext4@vger.kernel.org, Dave Chinner <david@fromorbit.com>,
xfs@oss.sgi.com, cluster-devel@redhat.com,
Steven Whitehouse <swhiteho@redhat.com>,
Mark Fasheh <mfasheh@suse.com>, Joel Becker <jlbec@evilplan.org>,
ocfs2-devel@oss.oracle.com, reiserfs-devel@vger.kernel.org,
Jeff Mahoney <jeffm@suse.de>, Dave Kleikamp <shaggy@kernel.org>,
jfs-discussion@lists.sourceforge.net, tytso@mit.edu,
viro@zeniv.linux.org.uk, Jan Kara <jack@suse.cz>
Subject: [PATCH] x86: Fixup lockdep complaint caused by io apic code
Date: Fri, 10 Oct 2014 16:23:42 +0200 [thread overview]
Message-ID: <1412951028-4085-38-git-send-email-jack@suse.cz> (raw)
In-Reply-To: <1412951028-4085-1-git-send-email-jack@suse.cz>
0day kernel testing guys have reported following lockdep complaint:
======================================================
[ INFO: possible circular locking dependency detected ]
3.15.0-rc5-00567-gbafe980 #1 Not tainted
-------------------------------------------------------
swapper/1 is trying to acquire lock:
(&irq_desc_lock_class){-.-...}, at: [<8107dc8c>] __irq_get_desc_lock+0x3c/0x70
but task is already holding lock:
(&port_lock_key){......}, at: [<815f5b27>] serial8250_startup+0x337/0x720
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #2 (&port_lock_key){......}:
<this stack looks somewhat bogus but we do end up taking
port->lock when printing to serial console>
[<810750e5>] lock_acquire+0x85/0x190
[<81baed9d>] _raw_spin_lock_irqsave+0x4d/0x60
[<8106eb1c>] down_trylock+0xc/0x30
[<8107b795>] console_trylock+0x15/0xb0
[<8107be8f>] vprintk_emit+0x14f/0x4d0
[<81b969b9>] printk+0x38/0x3a
[<82137f78>] print_ICs+0x5b/0x3e7
[<8212bb41>] do_one_initcall+0x8b/0x128
[<8212bd7d>] kernel_init_freeable+0x19f/0x236
[<81b9238b>] kernel_init+0xb/0xd0
[<81bb0080>] ret_from_kernel_thread+0x20/0x30
-> #1 (i8259A_lock){-.....}:
[<810750e5>] lock_acquire+0x85/0x190
[<81baed9d>] _raw_spin_lock_irqsave+0x4d/0x60
[<81005af1>] unmask_8259A_irq+0x11/0x60
[<81005b4b>] enable_8259A_irq+0xb/0x10
[<8107fffb>] irq_enable+0x2b/0x40
[<8108005d>] irq_startup+0x4d/0x60
[<8107f2bc>] __setup_irq+0x39c/0x460
[<8107f433>] setup_irq+0x33/0x80
[<8212db15>] setup_default_timer_irq+0xf/0x11
[<8212db2d>] hpet_time_init+0x16/0x18
[<8212daff>] x86_late_time_init+0x9/0x10
[<8212ba3d>] start_kernel+0x331/0x3aa
[<8212b380>] i386_start_kernel+0x12e/0x131
-> #0 (&irq_desc_lock_class){-.-...}:
[<810743c2>] __lock_acquire+0x19c2/0x1b20
[<810750e5>] lock_acquire+0x85/0x190
[<81baed9d>] _raw_spin_lock_irqsave+0x4d/0x60
[<8107dc8c>] __irq_get_desc_lock+0x3c/0x70
[<8107eb1e>] __disable_irq_nosync+0x1e/0x50
[<8107eb58>] disable_irq_nosync+0x8/0x10
[<815f5c78>] serial8250_startup+0x488/0x720
[<815f205e>] uart_startup.part.4+0x6e/0x1e0
[<815f2a40>] uart_open+0xe0/0x140
[<815e4b51>] tty_open+0x141/0x510
[<81118bc0>] chrdev_open+0x60/0x140
[<8111372c>] do_dentry_open+0x14c/0x230
[<8111459e>] finish_open+0x2e/0x40
[<8112132a>] do_last+0x4aa/0xd30
[<81121c5a>] path_openat+0xaa/0x610
[<811221ec>] do_filp_open+0x2c/0x70
[<81114a81>] do_sys_open+0x111/0x210
[<81114b9d>] SyS_open+0x1d/0x20
[<8212bda4>] kernel_init_freeable+0x1c6/0x236
[<81b9238b>] kernel_init+0xb/0xd0
[<81bb0080>] ret_from_kernel_thread+0x20/0x30
I believe the core of the problem is that print_PIC() calls printk()
from under i8259A_lock. I've checked and that doesn't seem to happen
anywhere else in the kernel. So let's move printk() from under that
lock.
As a side note this problem has existed for a long time but it was
uncovered by my patch resulting in extended lockdep coverage of printk
code.
Reported-by: Jet Chen <jet.chen@intel.com>
Signed-off-by: Jan Kara <jack@suse.cz>
---
arch/x86/kernel/apic/io_apic.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index 6ad4658de705..b815a4c9e5e5 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -1770,7 +1770,7 @@ __apicdebuginit(void) print_local_APICs(int maxcpu)
__apicdebuginit(void) print_PIC(void)
{
- unsigned int v;
+ unsigned int v0, v1, v2;
unsigned long flags;
if (!legacy_pic->nr_legacy_irqs)
@@ -1780,24 +1780,23 @@ __apicdebuginit(void) print_PIC(void)
raw_spin_lock_irqsave(&i8259A_lock, flags);
- v = inb(0xa1) << 8 | inb(0x21);
- printk(KERN_DEBUG "... PIC IMR: %04x\n", v);
-
- v = inb(0xa0) << 8 | inb(0x20);
- printk(KERN_DEBUG "... PIC IRR: %04x\n", v);
+ v0 = inb(0xa1) << 8 | inb(0x21);
+ v1 = inb(0xa0) << 8 | inb(0x20);
outb(0x0b,0xa0);
outb(0x0b,0x20);
- v = inb(0xa0) << 8 | inb(0x20);
+ v2 = inb(0xa0) << 8 | inb(0x20);
outb(0x0a,0xa0);
outb(0x0a,0x20);
raw_spin_unlock_irqrestore(&i8259A_lock, flags);
- printk(KERN_DEBUG "... PIC ISR: %04x\n", v);
+ printk(KERN_DEBUG "... PIC IMR: %04x\n", v0);
+ printk(KERN_DEBUG "... PIC IRR: %04x\n", v1);
+ printk(KERN_DEBUG "... PIC ISR: %04x\n", v2);
- v = inb(0x4d1) << 8 | inb(0x4d0);
- printk(KERN_DEBUG "... PIC ELCR: %04x\n", v);
+ v0 = inb(0x4d1) << 8 | inb(0x4d0);
+ printk(KERN_DEBUG "... PIC ELCR: %04x\n", v0);
}
static int __initdata show_lapic = 1;
--
1.8.1.4
next prev parent reply other threads:[~2014-10-10 14:23 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-10 14:23 [PATCH 0/2 v2] Fix data corruption when blocksize < pagesize for mmapped data Jan Kara
2014-10-10 14:23 ` [PATCH 1/2 RESEND] bdi: Fix hung task on sync Jan Kara
2014-10-10 14:23 ` [PATCH] block: free q->flush_rq in blk_init_allocated_queue error paths Jan Kara
2014-10-10 15:19 ` Dave Jones
2014-10-10 15:32 ` Jan Kara
2014-10-10 14:23 ` [PATCH] block: improve rq_affinity placement Jan Kara
2014-10-10 14:23 ` [PATCH] block: Make rq_affinity = 1 work as expected Jan Kara
2014-10-10 14:23 ` [PATCH] block: strict rq_affinity Jan Kara
2014-10-10 14:23 ` [PATCH] ext3: Fix deadlock in data=journal mode when fs is frozen Jan Kara
2014-10-10 14:23 ` [PATCH] ext3: Speedup WB_SYNC_ALL pass Jan Kara
2014-10-10 14:23 ` [PATCH] ext4: Avoid lock inversion between i_mmap_mutex and transaction start Jan Kara
2014-10-10 14:23 ` [PATCH 1/2] ext4: Don't check quota format when there are no quota files Jan Kara
2014-10-10 14:23 ` [PATCH 1/2] ext4: Fix block zeroing when punching holes in indirect block files Jan Kara
2014-10-10 14:23 ` [PATCH] ext4: Fix buffer double free in ext4_alloc_branch() Jan Kara
2014-10-10 14:23 ` [PATCH] ext4: Fix jbd2 warning under heavy xattr load Jan Kara
2014-10-10 14:23 ` [PATCH] ext4: Fix zeroing of page during writeback Jan Kara
2014-10-10 14:23 ` [PATCH] ext4: Remove orphan list handling Jan Kara
2014-10-10 14:23 ` [PATCH] ext4: Speedup WB_SYNC_ALL pass Jan Kara
2014-10-10 14:23 ` [PATCH for 3.14-stable] fanotify: fix double free of pending permission events Jan Kara
2014-10-10 14:23 ` [PATCH] fs: Avoid userspace mounting anon_inodefs filesystem Jan Kara
2014-10-10 14:23 ` [PATCH 1/2] jbd2: Avoid pointless scanning of checkpoint lists Jan Kara
2014-10-10 14:23 ` [PATCH] jbd2: Optimize jbd2_log_do_checkpoint() a bit Jan Kara
2014-10-10 14:23 ` [PATCH] lockdep: Dump info via tracing Jan Kara
2014-10-10 14:23 ` [PATCH] mm: Fixup pagecache_isize_extended() definitions for !CONFIG_MMU Jan Kara
2014-10-10 14:23 ` [PATCH] ncpfs: fix rmdir returns Device or resource busy Jan Kara
2014-10-10 14:23 ` [PATCH] ocfs2: Fix quota file corruption Jan Kara
2014-10-10 14:23 ` [PATCH 1/2] printk: Debug patch1 Jan Kara
2014-10-10 14:23 ` [PATCH] printk: debug: Slow down printing to 9600 bauds Jan Kara
2014-10-10 14:23 ` [PATCH] printk: enable interrupts before calling console_trylock_for_printk() Jan Kara
2014-10-10 14:23 ` [PATCH] quota: Fix race between dqput() and dquot_scan_active() Jan Kara
2014-10-10 14:23 ` [PATCH] scsi: Keep interrupts disabled while submitting requests Jan Kara
2014-10-10 14:23 ` [PATCH] sync: don't block the flusher thread waiting on IO Jan Kara
2014-10-10 14:23 ` [PATCH] timer: Fix lock inversion between hrtimer_bases.lock and scheduler locks Jan Kara
2014-10-10 14:23 ` [PATCH] udf: Avoid infinite loop when processing indirect ICBs Jan Kara
2014-10-10 14:23 ` [PATCH] udf: Print error when inode is loaded Jan Kara
2014-10-10 14:23 ` [PATCH] vfs: Allocate anon_inode_inode in anon_inode_init() Jan Kara
2014-10-10 14:23 ` [PATCH 1/2] vfs: Fix data corruption when blocksize < pagesize for mmaped data Jan Kara
2014-10-10 14:23 ` [PATCH RESEND] vfs: Return EINVAL for default SEEK_HOLE, SEEK_DATA implementation Jan Kara
2014-10-10 14:23 ` [PATCH] writeback: plug writeback at a high level Jan Kara
2014-10-10 14:23 ` Jan Kara [this message]
2014-10-10 14:23 ` [PATCH 2/2 RESEND] bdi: Avoid oops on device removal Jan Kara
2014-10-10 14:23 ` [PATCH 2/2] ext3: Don't check quota format when there are no quota files Jan Kara
2014-10-10 14:23 ` [PATCH 2/2] ext4: Fix hole punching for files with indirect blocks Jan Kara
2014-10-10 14:23 ` [PATCH 2/2] ext4: Fix mmap data corruption when blocksize < pagesize Jan Kara
2014-10-10 14:23 ` [PATCH 2/2] jbd2: Simplify calling convention around __jbd2_journal_clean_checkpoint_list Jan Kara
2014-10-10 14:23 ` [PATCH 2/2] printk: Debug patch 2 Jan Kara
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1412951028-4085-38-git-send-email-jack@suse.cz \
--to=jack@suse.cz \
--cc=cluster-devel@redhat.com \
--cc=david@fromorbit.com \
--cc=jeffm@suse.de \
--cc=jfs-discussion@lists.sourceforge.net \
--cc=jlbec@evilplan.org \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=mfasheh@suse.com \
--cc=ocfs2-devel@oss.oracle.com \
--cc=reiserfs-devel@vger.kernel.org \
--cc=shaggy@kernel.org \
--cc=swhiteho@redhat.com \
--cc=tytso@mit.edu \
--cc=viro@zeniv.linux.org.uk \
--cc=xfs@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).