From owner-freebsd-current@FreeBSD.ORG Wed Sep 2 05:47:06 2009 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8BEF8106566C for ; Wed, 2 Sep 2009 05:47:06 +0000 (UTC) (envelope-from ubm.freebsd@googlemail.com) Received: from mail-bw0-f206.google.com (mail-bw0-f206.google.com [209.85.218.206]) by mx1.freebsd.org (Postfix) with ESMTP id 0CD208FC1F for ; Wed, 2 Sep 2009 05:47:05 +0000 (UTC) Received: by bwz2 with SMTP id 2so481264bwz.43 for ; Tue, 01 Sep 2009 22:47:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:subject :message-id:in-reply-to:references:x-mailer:mime-version :content-type:content-transfer-encoding; bh=rCwFTcdpwIJ5Z0nq5zQfY3zIT3QgVVXoiRfIajYQ7ro=; b=mQcvzffhsPbvNl57gO77rRZ++yfdAJ3t781FC8tB6f7H92DJrHLwjzUCewmekDfkQ/ uk7a/3nda+qcV0t09b7J0dV/Q2wZtxCCGkmP1OsbyeIoJw4EO004nkEk5IQx4E8ZNXcr ei98TrEgg9ka1IvP0bUOxr73IpjbL5peE4Qrs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=date:from:to:subject:message-id:in-reply-to:references:x-mailer :mime-version:content-type:content-transfer-encoding; b=r+dMR+7p4ArkJMW2Ib76exUkc/MHJyg+zETSUgznIMpF/WA7s7U0aJCajY7AiRK3pX ncBWMx2M9G39cL3mWOuuDqnlBpJQWUjmpSXZ53nJIBO7xV4hqhhEFuF6adqYg6vkx+lG n/vorPjbpHwypK3FAT0TWGjpo0KJiVjwE3jLU= Received: by 10.103.81.36 with SMTP id i36mr3378490mul.122.1251870424417; Tue, 01 Sep 2009 22:47:04 -0700 (PDT) Received: from ubm.mine.nu (e181050152.adsl.alicedsl.de [85.181.50.152]) by mx.google.com with ESMTPS id u26sm2894247mug.23.2009.09.01.22.47.02 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 01 Sep 2009 22:47:02 -0700 (PDT) Date: Wed, 2 Sep 2009 07:47:01 +0200 From: Marc UBM Bocklet To: current@freebsd.org Message-Id: <20090902074701.9a063349.ubm.freebsd@gmail.com> In-Reply-To: <200909010955.33747.jhb@freebsd.org> References: <20090822115958.f93fcf29.ubm.freebsd@gmail.com> <20090831222650.45b6c806.ubm@u-boot-man.de> <3bbf2fe10908311331k3e871898tc36a9846651cc53@mail.gmail.com> <200909010955.33747.jhb@freebsd.org> X-Mailer: Sylpheed 2.7.0 (GTK+ 2.16.4; i386-portbld-freebsd8.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Mailman-Approved-At: Wed, 02 Sep 2009 11:05:45 +0000 Cc: Subject: Re: panic: apic_free_vector: Thread already bound. X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Sep 2009 05:47:06 -0000 On Tue, 1 Sep 2009 09:55:33 -0400 John Baldwin 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