Re: panic: apic_free_vector: Thread already bound.

From: Marc UBM Bocklet <ubm.freebsd_at_googlemail.com>
Date: Wed, 2 Sep 2009 07:47:01 +0200
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 _at__at_ -990,18 +990,21 _at__at_
>  	 * 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 _at__at_ -994,18 +994,21 _at__at_
>  	 * 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
Received on Wed Sep 02 2009 - 03:47:06 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:54 UTC