panic: apic_free_vector: Thread already bound.

Marc UBM Bocklet ubm.freebsd at googlemail.com
Wed Sep 2 05:47:06 UTC 2009


On Tue, 1 Sep 2009 09:55:33 -0400
John Baldwin <jhb at freebsd.org> wrote:


> > Maybe we can ship 8 with a printf() instrad than a panic()?
> 
> Actually, it looks like 'rebooting' is what we want.  Try this:
> 
> --- //depot/vendor/freebsd/src/sys/amd64/amd64/local_apic.c
> 2009/08/14 21:10:13 ++
> + //depot/user/jhb/acpipci/amd64/amd64/local_apic.c	2009/09/01
> 13:54:23 @@ -990,18 +990,21 @@
>  	 * we don't lose an interrupt delivery race.
>  	 */
>  	td = curthread;
> -	thread_lock(td);
> -	if (sched_is_bound(td))
> -		panic("apic_free_vector: Thread already bound.\n");
> -	sched_bind(td, apic_cpuid(apic_id));
> -	thread_unlock(td);
> +	if (!rebooting) {
> +		thread_lock(td);
> +		if (sched_is_bound(td))
> +			panic("apic_free_vector: Thread already
> bound.\n");
> +		sched_bind(td, apic_cpuid(apic_id));
> +		thread_unlock(td);
> +	}
>  	mtx_lock_spin(&icu_lock);
>  	lapics[apic_id].la_ioint_irqs[vector - APIC_IO_INTS] = -1;
>  	mtx_unlock_spin(&icu_lock);
> -	thread_lock(td);
> -	sched_unbind(td);
> -	thread_unlock(td);
> -
> +	if (!rebooting) {
> +		thread_lock(td);
> +		sched_unbind(td);
> +		thread_unlock(td);
> +	}
>  }
>  
>  /* Map an IDT vector (APIC) to an IRQ (interrupt source). */
> --- //depot/vendor/freebsd/src/sys/i386/i386/local_apic.c
> 2009/08/14 21:10:13 ++
> + //depot/user/jhb/acpipci/i386/i386/local_apic.c	2009/09/01
> 13:53:14 @@ -994,18 +994,21 @@
>  	 * we don't lose an interrupt delivery race.
>  	 */
>  	td = curthread;
> -	thread_lock(td);
> -	if (sched_is_bound(td))
> -		panic("apic_free_vector: Thread already bound.\n");
> -	sched_bind(td, apic_cpuid(apic_id));
> -	thread_unlock(td);
> +	if (!rebooting) {
> +		thread_lock(td);
> +		if (sched_is_bound(td))
> +			panic("apic_free_vector: Thread already
> bound.\n");
> +		sched_bind(td, apic_cpuid(apic_id));
> +		thread_unlock(td);
> +	}
>  	mtx_lock_spin(&icu_lock);
>  	lapics[apic_id].la_ioint_irqs[vector - APIC_IO_INTS] = -1;
>  	mtx_unlock_spin(&icu_lock);
> -	thread_lock(td);
> -	sched_unbind(td);
> -	thread_unlock(td);
> -
> +	if (!rebooting) {
> +		thread_lock(td);
> +		sched_unbind(td);
> +		thread_unlock(td);
> +	}
>  }
>  
>  /* Map an IDT vector (APIC) to an IRQ (interrupt source). */

I can confirm that this fixes the issue for me.

Thanks a lot! :-)

Bye
Marc


More information about the freebsd-current mailing list