From owner-freebsd-arm@FreeBSD.ORG Mon Jan 14 14:51:18 2013 Return-Path: Delivered-To: arm@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 0E73917A for ; Mon, 14 Jan 2013 14:51:18 +0000 (UTC) (envelope-from mlfbsd@kanar.ci0.org) Received: from kanar.ci0.org (unknown [IPv6:2a01:e0b:1:150:ca0a:a9ff:fef1:a4c9]) by mx1.freebsd.org (Postfix) with ESMTP id 99DDED55 for ; Mon, 14 Jan 2013 14:51:17 +0000 (UTC) Received: from kanar.ci0.org (pluxor@localhost [127.0.0.1]) by kanar.ci0.org (8.14.5/8.14.5) with ESMTP id r0EEoqti077726; Mon, 14 Jan 2013 15:50:52 +0100 (CET) (envelope-from mlfbsd@kanar.ci0.org) Received: (from mlfbsd@localhost) by kanar.ci0.org (8.14.5/8.14.5/Submit) id r0EEopPb077725; Mon, 14 Jan 2013 15:50:51 +0100 (CET) (envelope-from mlfbsd) Date: Mon, 14 Jan 2013 15:50:51 +0100 From: Olivier Houchard To: Oleksandr Tymoshenko Subject: Re: Fwd: arm: cpu_switch() has bug? Message-ID: <20130114145051.GA77459@ci0.org> References: <20130109.193945.561808600309975779.okuno.kohji@jp.panasonic.com> <50F1E092.1050905@bluezbox.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <50F1E092.1050905@bluezbox.com> User-Agent: Mutt/1.4.2.3i Cc: arm@freebsd.org, okuno.kohji@jp.panasonic.com X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Porting FreeBSD to the StrongARM Processor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Jan 2013 14:51:18 -0000 Hi, > Hi, > > I have doubt if cpu_switch() of arm has a bug. > > In swtch.S:L.334, if newtd->td_pcb (this is in stack pointer for > kernel) has an address accessed first for the old(current) thread, > data_abort_fault may occur. > > When data_abort_fault occurs, data_abort_handler() tries to solve this > address from kernel_map. In this time, curthread and curpcb are > already updated in swtch.S:L.223-231. As this result, > data_abort_handler() will occur data_abort_fault in trap.c:L.301, again. > > When I check, in other CPUs, after updating the root pointer of MMU, > curthread and curpcb are updated. > > Would you please check this? > > Thanks, > Kohji Okuno I don't think it can happen, when we reach cpu_switch(), both the old thread and the new thread should be swapped in, so the kstack for both will be mapped, and we won't get a data abort when trying to access it. I agree however it may come back to hunt us one day, so I'll see if I can not easily move that later in the process, after we switched the page tables. Regards, Olivier