From owner-freebsd-xen@FreeBSD.ORG Sun Sep 9 16:25:24 2012 Return-Path: Delivered-To: freebsd-xen@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BD00A1065670 for ; Sun, 9 Sep 2012 16:25:24 +0000 (UTC) (envelope-from steven@pyro.eu.org) Received: from falkenstein-2.sn.de.cluster.ok24.net (falkenstein-2.sn.de.cluster.ok24.net [IPv6:2002:4e2f:2f89:2::1]) by mx1.freebsd.org (Postfix) with ESMTP id 6E7438FC0A for ; Sun, 9 Sep 2012 16:25:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=simple/simple; d=pyro.eu.org; s=09.2012; h=Content-Transfer-Encoding:Content-Type:Subject:To:MIME-Version:From:Date:Message-ID; bh=7aQJmFnmZWzMtk865ixsvjUgLmPIMzlb+IaZfo710p8=; b=g654WwpMM4U+FKa//ts+Sg85UHXCUAZtEqP5tmflzKnWgGC0da2VsgldgvFKGvLDKiZJ94tyK3n331Loq0XFugahi8ScigpUBj1tyq1snbvpeiBa2xMa3b7xSAsPf5/c40dFAFl6wRNKRY+G/5Rn7T933242kHhVe2+I+4AT8ME=; X-Spam-Status: No, score=-1.1 required=2.0 tests=ALL_TRUSTED, BAYES_00, DKIM_ADSP_DISCARD, TVD_RCVD_IP Received: from 188-220-33-66.zone11.bethere.co.uk ([188.220.33.66] helo=guisborough-1.rcc.uk.cluster.ok24.net) by falkenstein-2.sn.de.cluster.ok24.net with esmtp (Exim 4.72) (envelope-from ) id 1TAkK0-0002v2-Ow for freebsd-xen@freebsd.org; Sun, 09 Sep 2012 17:25:23 +0100 X-Spam-Status: No, score=-4.3 required=2.0 tests=ALL_TRUSTED, AWL, BAYES_00, DKIM_POLICY_SIGNALL Received: from [192.168.0.110] (helo=[192.168.0.9]) by guisborough-1.rcc.uk.cluster.ok24.net with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1TAkJm-0000s0-6q for freebsd-xen@freebsd.org; Sun, 09 Sep 2012 17:25:18 +0100 Message-ID: <504CC2E1.5070404@pyro.eu.org> Date: Sun, 09 Sep 2012 17:25:05 +0100 From: Steven Chamberlain User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.6esrpre) Gecko/20120817 Icedove/10.0.6 MIME-Version: 1.0 To: freebsd-xen@freebsd.org X-Enigmail-Version: 1.4.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: xenstore panic booting XENHVM on NetBSD6/xen41 X-BeenThere: freebsd-xen@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion of the freebsd port to xen - implementation and usage List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Sep 2012 16:25:24 -0000 Hi! I have been using the kernel of FreeBSD 9.0 GENERIC on a NetBSD 6 (BETA2/RC1) Xen 4.1 HVM host for some time using emulated IDE/SCSI devices. But I wanted to try to reduce the overhead of disk I/O and hopefully increase performance. When I rebuilt the kernel with XENHVM config options, it would panic at boot. The kernel of FreeBSD 9.1-RC1 has the same problem. With xen_platform_pci=0 it will boot okay (but then I'd still be unable to use any PV devices). > xenbusb_front0: on xenstore0 > > Fatal trap 12: page fault while in kernel mode [...] > #0 0xffffffff8082a861 at kdb_backtrace+0x64 > #1 0xffffffff807f872d at panic+0x1c4 > #2 0xffffffff80a8a10d at trap_fatal+0x39d > #3 0xffffffff80a8a24f at trap_pfault+0x124 > #4 0xffffffff80a8a933 at trap+0x3d3 > #5 0xffffffff80a76f6f at calltrap+0x8 > #6 0xffffffff80a5b26f at xs_directory+0x71 > #7 0xffffffff80a5b29c at xs_exists+0x15 > #8 0xffffffff80a58911 at xenbusb_add_device+0xae > #9 0xffffffff80a595d7 at xenbusb_front_enumerate_type+0x5d > #10 0xffffffff80a58e32 at xenbusb_attach+0xf9 > #11 0xffffffff80a59614 at xenbusb_front_attach+0x15 > #12 0xffffffff808265a6 at device_attach+0x337 > #13 0xffffffff80826ab3 at device_probe_and_attach+0x22 > #14 0xffffffff80826c24 at bus_generic_attach+0x1a > #15 0xffffffff80a5a051 at xs_attach_deferred+0x21 > #16 0xffffffff80820a9a at run_interrupt_driven_config_hooks+0xea > #17 0xffffffff80820b37 at boot_run_interrupt_driven_config_hooks+0x16 I seem to have traced this to the (inlined) split() function being given a zero-length string from xs_directory() and it does not handle that well. So I came up with this workaround which results in a successful boot and has been running fine (with PV disks and network interface) for over a week now: --- kfreebsd-9-9.0.orig/sys/xen/xenstore/xenstore.c 2011-09-21 00:44:34.000000000 +0100 +++ kfreebsd-9-9.0/sys/xen/xenstore/xenstore.c 2012-08-29 18:10:13.026462720 +0100 @@ -306,6 +306,10 @@ { const char **ret; + /* :XXX: */ + if (len < 1) + return (NULL); + /* Protect against unterminated buffers. */ strings[len - 1] = '\0'; I'm still not sure sure why xs_directory() is trying to split a zero-length string, if that's normal or if the Xen host is doing something odd. Thanks! Regards, -- Steven Chamberlain steven@pyro.eu.org