From owner-freebsd-current@FreeBSD.ORG Fri Jul 8 13:20:00 2011 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 301E6106566B; Fri, 8 Jul 2011 13:20:00 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id E439A8FC1F; Fri, 8 Jul 2011 13:19:59 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 6765846B45; Fri, 8 Jul 2011 09:19:59 -0400 (EDT) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id F062C8A02C; Fri, 8 Jul 2011 09:19:58 -0400 (EDT) From: John Baldwin To: Doug Barton Date: Fri, 8 Jul 2011 09:19:58 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110617; KDE/4.5.5; amd64; ; ) References: <4E100086.7080105@FreeBSD.org> <201107071720.50203.jhb@freebsd.org> <4E16C463.9020604@FreeBSD.org> In-Reply-To: <4E16C463.9020604@FreeBSD.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201107080919.58210.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Fri, 08 Jul 2011 09:19:59 -0400 (EDT) Cc: freebsd-current@freebsd.org Subject: Re: cardbus panic: end address is not aligned 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: Fri, 08 Jul 2011 13:20:00 -0000 On Friday, July 08, 2011 4:48:35 am Doug Barton wrote: > On 07/07/2011 14:20, John Baldwin wrote: > > On Sunday, July 03, 2011 1:39:18 am Doug Barton wrote: > >> I have 2 ath-based pc-card adapters. If I put either one of them in the > >> slot while the system is up, or if I try booting with them in the slot, > >> I get an instant panic. The cards previously worked in -current, and > >> continue to work in 8-stable and windows xp. I don't have any other > >> pc-cards to compare with. Full core.txt.0 file is in my home directory > >> on freefall. > >> > >> This problem persists on r223732 but happened to me for the first time a > >> week or 2 ago (haven't had time to report it previously, apologies). It > >> likely originated a while before though, I don't use these cards very > >> often. > >> > >> panic: end address is not aligned > >> > >> #1 0xffffffff80426a8a in kern_reboot (howto=260) > >> at /home/svn/head/sys/kern/kern_shutdown.c:430 > >> #2 0xffffffff80426521 in panic (fmt=Variable "fmt" is not available. > >> ) > >> at /home/svn/head/sys/kern/kern_shutdown.c:604 > >> #3 0xffffffff8032c648 in pcib_grow_window (sc=0xfffffe0002603400, > >> w=0xfffffe0002603498, type=3, start=0, end=4294967295, count=65536, > >> flags=Variable "flags" is not available. > > > > The line is here: > > > > KASSERT((w->limit & ((1ul << w->step) - 1)) == (1ul << w->step) - 1, > > ("end address is not aligned")); > > > > Can you run kgdb and do 'frame 3' and 'p/x *w'? > > (kgdb) frame 3 > #3 0xffffffff8032c648 in pcib_grow_window (sc=0xfffffe0002603400, > w=0xfffffe0002603498, type=3, start=0, end=4294967295, count=65536, > flags=Variable "flags" is not available. > ) > at /home/svn/head/sys/dev/pci/pci_pci.c:1018 > 1018 KASSERT((w->limit & ((1ul << w->step) - 1)) == (1ul << w->step) - 1, > (kgdb) p/x *w > $1 = {base = 0x80000000, limit = 0x8800ffff, rman = {rm_list = { > tqh_first = 0xfffffe0002702a00, tqh_last = 0xfffffe0002702a98}, > rm_mtx = 0xfffffe00024e20e0, rm_link = {tqe_next = 0xfffffe0002603520, > tqe_prev = 0xfffffe0002603448}, rm_start = 0x0, rm_end = 0xffffffff, > rm_type = 0x2, rm_descr = 0xfffffe0002608060}, res = > 0xfffffe0002702b00, > reg = 0x20, valid = 0x1, mask = 0x2, step = 0x14, name = > 0xffffffff8071b77c} Hmm, well that's odd. It didn't grow it enough it seems. > > Also, can you boot your machine, then do 'sysctl debug.bootverbose=1', insert > > the card and record the messages in dmesg when it does? (You can likely get > > those out of kgdb.) > > The system panics instantly when I insert the cards. Would a verbose > dmesg entry from 8.2-stable work? I can do that on the same hardware. > If not I can try it on -current and see if anything gets logged. Err, if you can get a crashdump, you can use 'printf "%s", msgbufp->msg_ptr' in kgdb to output all of dmseg. You can also use the 'dmesg' command against a crash dump directly, and if you have crashinfo enabled, the tail of the core.txt.N file in /var/crash will have the full dmesg in it as well. The real messages I will want to see are in the dmesg. Also, getting the output of 'devinfo -r' before you insert the card would also be helpful so I can see what it is growing from. Actually, forgo all that. Try this patch: Index: pci_pci.c =================================================================== --- pci_pci.c (revision 223847) +++ pci_pci.c (working copy) @@ -954,7 +954,7 @@ pcib_grow_window(struct pcib_softc *sc, struct pci if (bootverbose) printf("\tback candidate range: %#lx-%#lx\n", start_free, back); - back = roundup2(back + 1, w->step) - 1; + back = roundup2(back + 1, 1ul << w->step) - 1; back -= rman_get_end(w->res); } else back = 0; -- John Baldwin