From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
To: kvm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] kvm: Fix kvm mmu_notifier initialization order
Date: Wed, 11 May 2011 09:28:28 +0900 [thread overview]
Message-ID: <87fwomozbn.fsf@devron.myhome.or.jp> (raw)
Like the following, mmu_notifier can be called after registering
immediately. So, kvm have to initialize kvm->mmu_lock before it.
BUG: spinlock bad magic on CPU#0, kswapd0/342
lock: ffff8800af8c4000, .magic: 00000000, .owner: <none>/-1, .owner_cpu: 0
Pid: 342, comm: kswapd0 Not tainted 2.6.39-rc5+ #1
Call Trace:
[<ffffffff8118ce61>] spin_bug+0x9c/0xa3
[<ffffffff8118ce91>] do_raw_spin_lock+0x29/0x13c
[<ffffffff81024923>] ? flush_tlb_others_ipi+0xaf/0xfd
[<ffffffff812e22f3>] _raw_spin_lock+0x9/0xb
[<ffffffffa0582325>] kvm_mmu_notifier_clear_flush_young+0x2c/0x66 [kvm]
[<ffffffff810d3ff3>] __mmu_notifier_clear_flush_young+0x2b/0x57
[<ffffffff810c8761>] page_referenced_one+0x88/0xea
[<ffffffff810c89bf>] page_referenced+0x1fc/0x256
[<ffffffff810b2771>] shrink_page_list+0x187/0x53a
[<ffffffff810b2ed7>] shrink_inactive_list+0x1e0/0x33d
[<ffffffff810acf95>] ? determine_dirtyable_memory+0x15/0x27
[<ffffffff812e90ee>] ? call_function_single_interrupt+0xe/0x20
[<ffffffff810b3356>] shrink_zone+0x322/0x3de
[<ffffffff810a9587>] ? zone_watermark_ok_safe+0xe2/0xf1
[<ffffffff810b3928>] kswapd+0x516/0x818
[<ffffffff810b3412>] ? shrink_zone+0x3de/0x3de
[<ffffffff81053d17>] kthread+0x7d/0x85
[<ffffffff812e9394>] kernel_thread_helper+0x4/0x10
[<ffffffff81053c9a>] ? __init_kthread_worker+0x37/0x37
[<ffffffff812e9390>] ? gs_change+0xb/0xb
Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
---
virt/kvm/kvm_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff -puN virt/kvm/kvm_main.c~kvm-mmu_notifier-lock-fix virt/kvm/kvm_main.c
--- linux-2.6/virt/kvm/kvm_main.c~kvm-mmu_notifier-lock-fix 2011-05-11 09:21:52.000000000 +0900
+++ linux-2.6-hirofumi/virt/kvm/kvm_main.c 2011-05-11 09:22:04.000000000 +0900
@@ -467,6 +467,7 @@ static struct kvm *kvm_create_vm(void)
if (!kvm->buses[i])
goto out_err;
}
+ spin_lock_init(&kvm->mmu_lock);
r = kvm_init_mmu_notifier(kvm);
if (r)
@@ -474,7 +475,6 @@ static struct kvm *kvm_create_vm(void)
kvm->mm = current->mm;
atomic_inc(&kvm->mm->mm_count);
- spin_lock_init(&kvm->mmu_lock);
kvm_eventfd_init(kvm);
mutex_init(&kvm->lock);
mutex_init(&kvm->irq_lock);
_
--
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
next reply other threads:[~2011-05-11 0:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-11 0:28 OGAWA Hirofumi [this message]
2011-05-11 11:52 ` [PATCH] kvm: Fix kvm mmu_notifier initialization order Avi Kivity
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=87fwomozbn.fsf@devron.myhome.or.jp \
--to=hirofumi@mail.parknet.co.jp \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.