From owner-freebsd-current@FreeBSD.ORG Tue Jan 14 16:49:27 2014 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 57BAEA7D for ; Tue, 14 Jan 2014 16:49:27 +0000 (UTC) Received: from mail-wg0-f53.google.com (mail-wg0-f53.google.com [74.125.82.53]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id DAE9D18BC for ; Tue, 14 Jan 2014 16:49:26 +0000 (UTC) Received: by mail-wg0-f53.google.com with SMTP id y10so660450wgg.32 for ; Tue, 14 Jan 2014 08:49:25 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-type :content-transfer-encoding; bh=IrgsaE+czSp8wPiWmzGaD5r9aoqXBgo1RcPgxl/q6nc=; b=J/fdGB5kQaRdywUL/+RRBurOrkBjdH1U+xa2vPlzRmX+76Y/R6pfdaewTZQ+48AGq3 93gssaoVGhYQyrz01TbR621/gz1JugxH7tkcW/X8jgx7FyX42nbCx7L56aiOHvkvDdCh pNWQrnORZk5Ofxx3TaafGvOL/OAWGbTnQus1RY/LFsGdhh6bMCg8YBZa+Zq7Zu1Og2yK fB9DMl1Mf2cqUymofCf/UKAXB9u54pz21nb4+HxE6WzUqhwinA0V8/vNHf/RxPfO/uIT 2Lfl4YVg1Wlls1WbxCeMVARF3zUbIwSU5HLZplK6+yz9zs4dKfq0JtQWGqlHyP9GFoD0 U7WQ== X-Gm-Message-State: ALoCoQmnrPUmC+kFVrxzPAgzxSq8wp8hyAcjBRjuI+mqm/mHLJUJzSCK0L41vS23tnf78ZJPzQ0O X-Received: by 10.180.80.103 with SMTP id q7mr11155351wix.14.1389718164890; Tue, 14 Jan 2014 08:49:24 -0800 (PST) Received: from [10.80.2.139] ([185.25.64.249]) by mx.google.com with ESMTPSA id hy8sm1003957wjb.2.2014.01.14.08.49.23 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 14 Jan 2014 08:49:24 -0800 (PST) Message-ID: <52D56A92.4070100@linaro.org> Date: Tue, 14 Jan 2014 16:49:22 +0000 From: Julien Grall User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20131104 Icedove/17.0.10 MIME-Version: 1.0 To: =?UTF-8?B?Um9nZXIgUGF1IE1vbm7DqQ==?= Subject: Re: [PATCH v10 14/20] xen: introduce xenpv bus and a dummy pvcpu device References: <1389711582-66908-1-git-send-email-roger.pau@citrix.com> <1389711582-66908-15-git-send-email-roger.pau@citrix.com> <52D55AB4.4010504@linaro.org> <52D560EB.8040108@citrix.com> <52D5625D.7030702@citrix.com> <52D563DE.1020207@citrix.com> In-Reply-To: <52D563DE.1020207@citrix.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: xen-devel@lists.xen.org, Julien Grall , freebsd-xen@freebsd.org, freebsd-current@freebsd.org, kib@freebsd.org, gibbs@freebsd.org X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.17 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: Tue, 14 Jan 2014 16:49:27 -0000 On 01/14/2014 04:20 PM, Roger Pau Monné wrote: > On 14/01/14 17:14, Julien Grall wrote: >> On 01/14/2014 04:08 PM, Roger Pau Monné wrote: >>> On 14/01/14 16:41, Julien Grall wrote: >>>> On 01/14/2014 02:59 PM, Roger Pau Monne wrote: >>>>> +static int >>>>> +xenpv_attach(device_t dev) >>>>> +{ >>>>> + device_t child; >>>>> + >>>>> + if (xen_hvm_domain()) { >>>>> + device_t xenpci; >>>>> + devclass_t dc; >>>>> + >>>>> + /* Make sure xenpci has been attached */ >>>>> + dc = devclass_find("xenpci"); >>>>> + if (dc == NULL) >>>>> + panic("unable to find xenpci devclass"); >>>>> + >>>>> + xenpci = devclass_get_device(dc, 0); >>>>> + if (xenpci == NULL) >>>>> + panic("unable to find xenpci device"); >>>>> + >>>>> + if (!device_is_attached(xenpci)) >>>>> + panic("trying to attach xenpv before xenpci"); >>>>> + } >>>> >>>> Can you use the identify method to add the xenpci device? >>> >>> I don't think so, xenpci is a pci device, it is detected and plugged by >>> the pci bus code. >> >> Oups, I though you are trying to add the device. In this case, the check >> seems pointless. In which case the xenpci couldn't exist? > > It's just a "belt and suspenders", if we attach the xenpv bus without > xenpci being attached first a bunch of things are going to fail, I > though it might be best to print a clear error message about what went > wrong in order to help debug it. I only see one place which could failed, and we are already protected. It's when we are trying to allocate space from grant-table via xenpci_alloc_space. I think this error should be enough to understand the problem. At the same time, it's the same things with xenstore. If grant-table initialization has failed, an error message is just printed and FreeBSD will likely failed later when it will try to initialized the PV disk. -- Julien Grall