Received: from eggs.gnu.org ([2001:4830:134:3::10]:57693) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YR7b3-0002FP-B8 for qemu-devel@nongnu.org; Thu, 26 Feb 2015 18:11:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YR7b0-0000ni-3q for qemu-devel@nongnu.org; Thu, 26 Feb 2015 18:11:57 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48004) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YR7az-0000nc-Rd for qemu-devel@nongnu.org; Thu, 26 Feb 2015 18:11:54 -0500 Date: Thu, 26 Feb 2015 20:11:49 -0300 From: Eduardo Habkost Message-ID: <20150226231149.GE3513@thinpad.lan.raisama.net> References: <1424894306-26740-1-git-send-email-ehabkost@redhat.com> <1424894306-26740-9-git-send-email-ehabkost@redhat.com> <20150226160637.GC3513@thinpad.lan.raisama.net> <20150226225116.GD3513@thinpad.lan.raisama.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [PULL 08/11] linux-user: Check for cpu_init() errors List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Paolo Bonzini , Andreas =?iso-8859-1?Q?F=E4rber?= , QEMU Developers On Fri, Feb 27, 2015 at 08:00:25AM +0900, Peter Maydell wrote: > On 27 February 2015 at 07:51, Eduardo Habkost wrote: > > On Fri, Feb 27, 2015 at 07:44:29AM +0900, Peter Maydell wrote: > >> When can it actually fail? Have you seen it do this in practice? > >> (Note that this is only called from fork, so we know that > >> cpu_model must be valid, or we would have failed on startup > >> trying to create the CPU for the initial thread.) > > > > I have never seen it in practice, but in x86 it will fail if we try to > > create more than 254 VCPUs. > > That's bad -- it's not hard to imagine a program with 256 > threads. Why does x86 have this limitation and can we fix it? > That seems like the better course than this patch. I don't think *-user or any x86-specific code has any hard requirement of having all VCPUs with different APIC IDs. But right now we set APIC ID = cpu_index for every VCPU, so the current code has this limitation. I would be glad to send a patch adding an assert() instead of an error message, but I don't think I will be able to audit every single cpu_init() function soon (to ensure they really never fail). So, while we don't audit all cpu_init() functions, do you prefer to live with an error message, or an assert() that may or may not be triggered by existing code? -- Eduardo