From owner-freebsd-virtualization@freebsd.org Sat Mar 10 22:55:51 2018 Return-Path: Delivered-To: freebsd-virtualization@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5D178F3C04A for ; Sat, 10 Mar 2018 22:55:51 +0000 (UTC) (envelope-from martin@lucina.net) Received: from smtp.lucina.net (smtp.lucina.net [62.176.169.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E37EA87DD9 for ; Sat, 10 Mar 2018 22:55:50 +0000 (UTC) (envelope-from martin@lucina.net) Received: from nodbug.lucina.net (dynrak234g-65-4-67-105.inwitelecom.net [105.67.4.65]) by smtp.lucina.net (Postfix) with ESMTPSA id B0BC9122804; Sat, 10 Mar 2018 23:46:09 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=lucina.net; s=dkim-201309; t=1520721969; bh=BRUVOrvnGAPexJCTG1fOM0EbqWA8R/IFXQPBn/fRiHw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=gIP8CV9GABkj0BF2QtE+mMUtrTLEOTpj5G/xjtpN0YBpPCa8nRZBxj9/O/LwuXRr2 Rmb29vpiGZatFU+SwexNA0aoL7ZcmZe7ryWRQsVuGvuuqVVdW1bWnTOKeKJfUNThnT N9KLYLLB7agdOOQU1+btprYoGlE6WMm9jZWSEH4b+Wg+E0puBxtBq9yJtENqEbpM3z MiqXR4s2H1rqXMYcZa4Cs45rwTExnYzr2NRPv2WAwYjR2bcuA7mOkTYtPr3461qyAZ 9C3XmIV9KCPibb0aNs/L6iQC3KFwydhqYZgul+TZhjNMB/sYu1xtGnVFqW7o0pAtoq l6LngMaesuLOA== Received: by nodbug.lucina.net (Postfix, from userid 1000) id 9BD882175E7B; Sat, 10 Mar 2018 23:46:07 +0100 (CET) Date: Sat, 10 Mar 2018 23:46:07 +0100 From: Martin Lucina To: Fabian Freyer Cc: rumpkernel-users@freelists.org, freebsd-virtualization@freebsd.org Subject: Re: rumpkernel and bhyve: triple faults Message-ID: <20180310224607.wscuqebheq5bjxww@nodbug.lucina.net> Mail-Followup-To: Fabian Freyer , rumpkernel-users@freelists.org, freebsd-virtualization@freebsd.org References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) X-BeenThere: freebsd-virtualization@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "Discussion of various virtualization techniques FreeBSD supports." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Mar 2018 22:55:51 -0000 Hi, On Friday, 09.03.2018 at 18:45, Fabian Freyer wrote: > On 6 Mar 2018, at 7:45, Fabian Freyer wrote: > > Tracking down bios_crtc_base, I find that it’s loaded in > > rumprun/platform/hw/arch/amd64/locore.S:70: > > > > /* save BIOS data area values */ > > movw BIOS_COM1_BASE, %bx > > movw %bx, bios_com1_base > > movw BIOS_CRTC_BASE, %bx > > movw %bx, bios_crtc_base > > > > Where BIOS_CRTC_BASE is 0x463 and BIOS_COM1_BASE is 0x400. Checking the bhyve > > device node in /dev/vmm with xxd(1), I find the words at these addresses to be > > Uninitialised: > > > > 00000400: 0000 .. > > 00000483: 0000 .. > > > > I’m not sure where to go from here. Is this a bug in bhyve(4), should these > > values be initialised somehow, or should I patch rumpkernel(7) to skip this check > > when running on bhyve(4)? You probably want to use a serial console rather than VGA on bhyve in any case, so you'll want to add the appropriate checks to hypervisor.c and cons.c. > I’ve chased this bug down a bit further to what I believe is an issue with the > rumprun toolchain I am building on FreeBSD with the misc/rumprun port [1]. > > objdump -t helloer-rumprun.elf list a number of symbols in the *COM* section, which > holds unallocated C external variables [2]: > > objdump -t helloer-rumprun.elf | grep \*COM\* > 00000001 l O *COM* 00000001 pic1mask > 00000004 l O *COM* 00000004 pgalloc_totalkb > 00000004 l O *COM* 00000004 pgalloc_usedkb > 00001000 l O *COM* 00000020 multiboot_cmdline > 00000002 l O *COM* 00000002 bios_crtc_base > 00000001 l O *COM* 00000001 pic2mask > 00000002 l O *COM* 00000002 bios_com1_base > > As the pagetable in pagetable.s maps the first page as non-present, accessing any > of these will result in a fault. I’m pretty sure that these shouldn’t be undefined. > > A build on Linux (which boots fine) shows these not to be uninitialised: > 00000000003e3480 g O .bss 0000000000000002 bios_com1_base > 00000000003e44a0 g O .bss 0000000000000002 bios_crtc_base When you write "which boots fine", I presume you're referring to booting on bhyve? > Further down the rabbit hole, this goes on in rumprun.o: > > On Linux, bios_crtc_base is not a local symbol: > 0000000000000002 O *COM* 0000000000000002 bios_crtc_base > 0000000000000002 O *COM* 0000000000000002 bios_com1_base > > While on FreeBSD, they are marked as local: > 0000000000000002 l O *COM* 0000000000000002 bios_crtc_base > 0000000000000002 l O *COM* 0000000000000002 bios_com1_base That seems wrong. Can you try and force the toolchain to use the more recent GNU ld from devel/binutils and see if that fixes the problem? -mato