From owner-freebsd-ia64@FreeBSD.ORG Tue Jun 10 12:11:15 2003 Return-Path: Delivered-To: freebsd-ia64@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3383237B401 for ; Tue, 10 Jun 2003 12:11:15 -0700 (PDT) Received: from ns1.xcllnt.net (209-128-86-226.bayarea.net [209.128.86.226]) by mx1.FreeBSD.org (Postfix) with ESMTP id 56D8B43FCB for ; Tue, 10 Jun 2003 12:11:14 -0700 (PDT) (envelope-from marcel@xcllnt.net) Received: from ns1.xcllnt.net (localhost [127.0.0.1]) by ns1.xcllnt.net (8.12.9/8.12.9) with ESMTP id h5AJBEhS014076; Tue, 10 Jun 2003 12:11:14 -0700 (PDT) (envelope-from marcel@ns1.xcllnt.net) Received: (from marcel@localhost) by ns1.xcllnt.net (8.12.9/8.12.9/Submit) id h5AJBDQY014075; Tue, 10 Jun 2003 12:11:13 -0700 (PDT) Date: Tue, 10 Jun 2003 12:11:13 -0700 From: Marcel Moolenaar To: Alan Robinson Message-ID: <20030610191113.GA14015@ns1.xcllnt.net> References: <20030606183130.A19592@fujitsu-siemens.com> <20030606182015.GC569@dhcp01.pn.xcllnt.net> <20030610105306.A18863@fujitsu-siemens.com> <20030610112735.A20041@fujitsu-siemens.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030610112735.A20041@fujitsu-siemens.com> User-Agent: Mutt/1.5.1i cc: freebsd-ia64@freebsd.org Subject: Re: DDB and SMP causes Unaligned Reference X-BeenThere: freebsd-ia64@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting FreeBSD to the IA-64 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jun 2003 19:11:15 -0000 On Tue, Jun 10, 2003 at 11:27:35AM +0200, Alan Robinson wrote: > On Tue, Jun 10, 2003 at 10:53:06AM +0200, Alan Robinson wrote: > > On Fri, Jun 06, 2003 at 11:20:15AM -0700, Marcel Moolenaar wrote: > > > > > > We don't set pc_pcb on ia64. The line above should read: > > > savectx(curthread->td_pcb); > > > > > Tried it. > > > > > > Try it and let me know if it works. I'll commit it then. > > > > > Works. > > Works. > > (It still causes the strange double entry into DDB) > > > > It would also be a good idea to remove the unneeded pc_pcb line with its > > incorrect comment from src/sys/ia64/include/pcpu.h > > > > I deleted the pc_pcb line from src/sys/ia64/include/pcpu.h and > much to my surprise got a compile error in src/sys/ia64/ia64/machdep.c > where the function cpu_pcpu_init does indeed set pc_pcb: > > void > cpu_pcpu_init(struct pcpu *pcpu, int cpuid, size_t size) > { > KASSERT(size >= sizeof(struct pcpu) + sizeof(struct pcb), > ("%s: too small an allocation for pcpu", __func__)); > pcpu->pc_pcb = (void*)(pcpu+1); > } > > so much for it not being set!. It is set, just the alignment of > struct pcb is wrong. Oops. I guess I was mistaken with the i386 NPX (non-SMP) specific pc_curpcb. So, yes; it means we need to make sure *pc_pcb is aligned and the place to do it is exactly the place where we initialize it :-) > Is your suggested (and working) change > > > savectx(curthread->td_pcb); > still correct ? Probably not. I suspect there's a corner case where we cannot use the PCB of the currently running thread, even though it's otherwise the best PCB to put it in, AFAICT. Chances are DDB expects the current context to be saved in pc_pcb as well. The bottom line is that I was confused, so I have to thread carefully now... -- Marcel Moolenaar USPA: A-39004 marcel@xcllnt.net