Received: from eggs.gnu.org ([208.118.235.92]:50331) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UVmxd-00046d-HU for qemu-devel@nongnu.org; Fri, 26 Apr 2013 14:01:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UVmxa-0006PU-OK for qemu-devel@nongnu.org; Fri, 26 Apr 2013 14:01:29 -0400 Received: from e06smtp10.uk.ibm.com ([195.75.94.106]:37599) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UVmxa-0006PN-Fq for qemu-devel@nongnu.org; Fri, 26 Apr 2013 14:01:26 -0400 Received: from /spool/local by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 26 Apr 2013 18:59:43 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id 184531B0805D for ; Fri, 26 Apr 2013 19:01:22 +0100 (BST) Received: from d06av04.portsmouth.uk.ibm.com (d06av04.portsmouth.uk.ibm.com [9.149.37.216]) by b06cxnps4076.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r3QI1CMg50135172 for ; Fri, 26 Apr 2013 18:01:12 GMT Received: from d06av04.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av04.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r3QI1Ld9006306 for ; Fri, 26 Apr 2013 12:01:21 -0600 Date: Fri, 26 Apr 2013 20:01:18 +0200 From: Dominik Dingel Message-ID: <20130426200118.0dedc20f@BR9TG4T3.de.ibm.com> In-Reply-To: <8761z9i70k.fsf@codemonkey.ws> References: <1366978377-16823-1-git-send-email-dingel@linux.vnet.ibm.com> <1366978377-16823-2-git-send-email-dingel@linux.vnet.ibm.com> <8761z9i70k.fsf@codemonkey.ws> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 01/10] Common: Add a default bootindex for all applicable devices List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: Christian Borntraeger , qemu-devel@nongnu.org, Alexander Graf On Fri, 26 Apr 2013 11:36:11 -0500 Anthony Liguori wrote: > Dominik Dingel writes: > > > Currently only devices with a positive boot index will be pushed in the > > fw_boot_order queue, so if no boot index at all will be specified, > > the queue ends up empty. > > > > Instead we push exactly as docs/bootindex.txt says the devices with > > the lowest possible boot priority at the tail of the queue, > > because we give them the highest available boot index. > > > > Signed-off-by: Dominik Dingel > > Wouldn't this break the ability to say: "don't every try to boot from > this device?" > > As an example, some people want to force PXE boot to not be tried on > certain networks. > > Regards, > > Anthony Liguori That is correct, hmm. The thing is, if we don't submit a bootindex, we will assign -1 in virtio-blk and virtio-net. This would forbid that the device would be booted from. Where docs/bootindex.txt says: if a device got no bootindex, it gets the lowest possibly priority... One way to fix this, would be to change the behaviour for virtio-blk and virtio-net, if there is no boot value assigned to, give it the possible highest number. Would be this okay for you Anthony? Dominik > > > > diff --git a/vl.c b/vl.c > > index 6caa5f4..84d7031 100644 > > --- a/vl.c > > +++ b/vl.c > > @@ -248,7 +248,7 @@ struct FWBootEntry { > > char *suffix; > > }; > > > > -static QTAILQ_HEAD(, FWBootEntry) fw_boot_order = > > +static QTAILQ_HEAD(FWBootOrder, FWBootEntry) fw_boot_order = > > QTAILQ_HEAD_INITIALIZER(fw_boot_order); > > > > int nb_numa_nodes; > > @@ -1213,10 +1213,21 @@ void add_boot_device_path(int32_t bootindex, DeviceState *dev, > > FWBootEntry *node, *i; > > > > if (bootindex < 0) { > > - return; > > + bootindex = INT32_MAX; > > + if (!QTAILQ_EMPTY(&fw_boot_order) && > > + (QTAILQ_LAST(&fw_boot_order, FWBootOrder)->bootindex == INT32_MAX)) { > > + /* there is a device at the end of the queue, so we need to walk > > + the queue reverse to get the next free bootindex */ > > + QTAILQ_FOREACH_REVERSE(i, &fw_boot_order, FWBootOrder, link) { > > + if (i->bootindex != bootindex) { > > + break; > > + } > > + bootindex--; > > + } > > + } > > } > > > > - assert(dev != NULL || suffix != NULL); > > + assert(dev != NULL || suffix != NULL || bootindex >= 0); > > > > node = g_malloc0(sizeof(FWBootEntry)); > > node->bootindex = bootindex; > > -- > > 1.7.9.5 >