From owner-freebsd-amd64@FreeBSD.ORG Sun Dec 23 07:40:01 2012 Return-Path: Delivered-To: freebsd-amd64@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 72A0F595 for ; Sun, 23 Dec 2012 07:40:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id 524BC8FC0A for ; Sun, 23 Dec 2012 07:40:01 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id qBN7e15d083736 for ; Sun, 23 Dec 2012 07:40:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id qBN7e16e083735; Sun, 23 Dec 2012 07:40:01 GMT (envelope-from gnats) Date: Sun, 23 Dec 2012 07:40:01 GMT Message-Id: <201212230740.qBN7e16e083735@freefall.freebsd.org> To: freebsd-amd64@FreeBSD.org Cc: From: Andriy Gapon Subject: Re: amd64/174409: stopping during resume caused by io_apic.c change(r243764) X-Mailman-Approved-At: Sun, 23 Dec 2012 12:27:53 +0000 X-BeenThere: freebsd-amd64@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: Andriy Gapon List-Id: Porting FreeBSD to the AMD64 platform List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Dec 2012 07:40:01 -0000 The following reply was made to PR amd64/174409; it has been noted by GNATS. From: Andriy Gapon To: KAHO Toshikazu Cc: bug-followup@FreeBSD.org Subject: Re: amd64/174409: stopping during resume caused by io_apic.c change(r243764) Date: Sun, 23 Dec 2012 09:32:02 +0200 on 19/12/2012 03:47 KAHO Toshikazu said the following: > Hello, > >> Are you set up for crash dumps (minidumps are ok) ? >> Could you please add a call to panic("ioapic_resume"); at the beginning of >> ioapic_resume function in sys/x86/x86/io_apic.c and save a crash dump for debugging? > > The machine now panics, but any keyboard operation makes nothing > in debugger. If sysctl debug.debugger_on_panic=0 , kernel was > trying to save a dump but failed by ahci error. All devices seem > to be sleeping yet. Oh, I should have realized that this won't work. Sorry about that. Could you please revert all patches from me and put your source tree into the working shape (head minus r243764) and the try the following purely diagnostic patch? The patch presumes that you have DDB in your kernel config. Please report output produced after resuming. Thank you. diff --git a/sys/x86/x86/io_apic.c b/sys/x86/x86/io_apic.c index 4df27c2..1f82816 100644 --- a/sys/x86/x86/io_apic.c +++ b/sys/x86/x86/io_apic.c @@ -486,14 +486,30 @@ ioapic_config_intr } static void +ioapic_dump(struct ioapic *io) +{ + int i; + + printf("ioapic%u:\n", io->io_id); + for (i = 0; i < io->io_numintr; i++) + printf("pin%d: %08x:%08x\n", i, + ioapic_read(io->io_addr, IOAPIC_REDTBL_LO(i)), + ioapic_read(io->io_addr, IOAPIC_REDTBL_HI(i))); +} + +static void ioapic_resume(struct pic *pic) { struct ioapic *io = (struct ioapic *)pic; int i; mtx_lock_spin(&icu_lock); + printf("before re-programming ioapic\n"); + ioapic_dump(io); for (i = 0; i < io->io_numintr; i++) ioapic_program_intpin(&io->io_pins[i]); + printf("after re-programming ioapic\n"); + ioapic_dump(io); mtx_unlock_spin(&icu_lock); } diff --git a/sys/x86/x86/local_apic.c b/sys/x86/x86/local_apic.c index 0df973a..13e4b4f 100644 --- a/sys/x86/x86/local_apic.c +++ b/sys/x86/x86/local_apic.c @@ -342,6 +342,8 @@ lapic_dump(const char* str) printf(" cmci: 0x%08x\n", lapic->lvt_cmci); } +static db_cmdfcn_t db_show_lapic; + void lapic_setup(int boot) { @@ -353,6 +355,10 @@ lapic_setup(int boot) la = &lapics[lapic_id()]; KASSERT(la->la_present, ("missing APIC structure")); saveintr = intr_disable(); + + printf("before setup\n"); + db_show_lapic(0, 0, 0, NULL); + maxlvt = (lapic->version & APIC_VER_MAXLVT) >> MAXLVTSHIFT; /* Initialize the TPR to allow all interrupts. */ @@ -398,6 +404,9 @@ lapic_setup(int boot) if (maxlvt >= LVT_CMCI) lapic->lvt_cmci = lvt_mode(la, LVT_CMCI, lapic->lvt_cmci); + printf("after setup\n"); + db_show_lapic(0, 0, 0, NULL); + intr_restore(saveintr); } -- Andriy Gapon