From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: external module sched_in event Date: Sun, 23 Dec 2007 19:37:40 +0200 Message-ID: <476E9CE4.2060705@qumranet.com> References: <20071220162353.GA3802@v2.random> <476D61E8.5000102@qumranet.com> <20071223164932.GA8483@v2.random> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org To: Andrea Arcangeli Return-path: In-Reply-To: <20071223164932.GA8483-lysg2Xt5kKMAvxtiuMwx3w@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Errors-To: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: kvm.vger.kernel.org Andrea Arcangeli wrote: > On Sat, Dec 22, 2007 at 09:13:44PM +0200, Avi Kivity wrote: > >> Unfortunately, this fails badly on Intel i386: >> > > Hmm ok there's a definitive bug that I forgot a int1 kernel->kernel > switch on x86 has no special debug stack like on x86-64. This will > have a better chance to work, hope I got all offsets right by > memory.... At least the offset "32" in the leal and eax + fastcall > should all be right or I doubt it could survive the double > dereferencing. Likely the one-more-derefence didn't oops there because > you likely have >=1g of ram and there was a 25% chance of crashing due > the lack of sched-in and 75% chance of crashing in the > one-more-dereference in a more meaningful way. > > Now I see lots of > BUG: warning at arch/i386/kernel/smp.c:701/smp_call_function_single() > (Not tainted) > [] __vcpu_clear+0x0/0x4a [kvm_intel] > [] smp_call_function_single+0x90/0x10c > [] __switch_to+0x174/0x18e > [] vcpu_clear+0x41/0x50 [kvm_intel] > [] vmx_vcpu_load+0x2e/0x103 [kvm_intel] > [] vmx_vcpu_put+0xc0/0xf3 [kvm_intel] > [] kvm_arch_vcpu_load+0x9/0xa [kvm] > [] preempt_notifier_trigger+0x5b/0xe1 [kvm] > [] pn_int1_handler+0x16/0x26 [kvm] > [] __mutex_lock_slowpath+0x45/0x77 > [] mutex_lock+0x26/0x29 > [] apic_update_ppr+0x17/0x3e [kvm] > [] kvm_mmu_page_fault+0x14/0x9b [kvm] > [] kvm_get_apic_interrupt+0x3a/0x4f [kvm] > [] kvm_handle_exit+0x6a/0x86 [kvm_intel] > [] kvm_arch_vcpu_ioctl_run+0x2a4/0x3aa [kvm] > [] kvm_vcpu_ioctl+0xce/0x298 [kvm] > [] __activate_task+0x1c/0x29 > [] try_to_wake_up+0x3aa/0x3b4 > [] _spin_unlock_irq+0x5/0x7 > [] __wake_up_common+0x32/0x55 > [] __wake_up+0x32/0x43 > [] wake_futex+0x42/0x4c > [] futex_wake+0xa6/0xb0 > [] do_futex+0x217/0xb7d > [] journal_stop+0x1cb/0x1d7 [jbd] > [] mapping_tagged+0x2b/0x32 > [] kvm_vm_ioctl+0x172/0x183 [kvm] > [] _spin_unlock_irq+0x5/0x7 > [] __sched_text_start+0x999/0xa21 > [] smp_apic_timer_interrupt+0x76/0x80 > [] kvm_vcpu_ioctl+0x0/0x298 [kvm] > [] do_ioctl+0x1f/0x62 > [] vfs_ioctl+0x244/0x256 > [] sys_ioctl+0x4c/0x64 > [] syscall_call+0x7/0xb > ======================= The sched_in notifier needs to enable interrupts (but it must disable preemption to avoid recursion). Eventually I got this: BUG: spinlock lockup on CPU#3, qemu-system-x86/4425, c07001cc (Not tainted) [] __vcpu_clear+0x0/0x4a [kvm_intel] [] _raw_spin_lock+0xb8/0xd9 [] smp_call_function_single+0x9a/0x10c [] __switch_to+0x174/0x18e [] vcpu_clear+0x41/0x50 [kvm_intel] [] vmx_vcpu_load+0x2e/0x103 [kvm_intel] [] vmx_vcpu_put+0xc0/0xf3 [kvm_intel] [] kvm_arch_vcpu_load+0x9/0xa [kvm] [] preempt_notifier_trigger+0x5b/0xe1 [kvm] [] pn_int1_handler+0x16/0x26 [kvm] [] __mutex_lock_slowpath+0x45/0x77 [] mutex_lock+0x26/0x29 [] apic_update_ppr+0x17/0x3e [kvm] [] kvm_mmu_page_fault+0x14/0x9b [kvm] [] kvm_get_apic_interrupt+0x3a/0x4f [kvm] [] kvm_handle_exit+0x6a/0x86 [kvm_intel] [] kvm_arch_vcpu_ioctl_run+0x2a4/0x3aa [kvm] [] tcp_sendmsg+0x913/0xa04 [] kvm_vcpu_ioctl+0xce/0x298 [kvm] [] __activate_task+0x1c/0x29 [] try_to_wake_up+0x3aa/0x3b4 [] _spin_unlock_irq+0x5/0x7 [] __sched_text_start+0x999/0xa21 [] core_sys_select+0x218/0x2f3 [] futex_wake+0xa6/0xb0 [] do_futex+0x217/0xb7d [] __dequeue_signal+0xff/0x14e [] dequeue_signal+0x36/0xae [] kvm_vm_ioctl+0x172/0x183 [kvm] [] ktime_get_ts+0x16/0x44 [] ktime_get+0x12/0x34 [] common_timer_get+0xf4/0x130 [] kvm_vcpu_ioctl+0x0/0x298 [kvm] [] do_ioctl+0x1f/0x62 [] vfs_ioctl+0x244/0x256 [] copy_to_user+0x3c/0x50 [] sys_ioctl+0x4c/0x64 [] syscall_call+0x7/0xb ======================= followed by lockup of the qemu process, but it may be due to interrupts being disabled. -- error compiling committee.c: too many arguments to function ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/