Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Kkgnl-0003Fa-Om for qemu-devel@nongnu.org; Tue, 30 Sep 2008 11:06:13 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Kkgnk-0003Ep-5d for qemu-devel@nongnu.org; Tue, 30 Sep 2008 11:06:13 -0400 Received: from [199.232.76.173] (port=40521 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Kkgnk-0003Em-1p for qemu-devel@nongnu.org; Tue, 30 Sep 2008 11:06:12 -0400 Received: from jaguar.mkp.net ([192.139.46.146]:34111) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Kkgnj-0003LF-5g for qemu-devel@nongnu.org; Tue, 30 Sep 2008 11:06:11 -0400 Sender: jes@jaguar.mkp.net Subject: Re: [Qemu-devel] [patch] Introduce per machine based max_cpu variable References: <48D8D694.1000609@sgi.com> <200809231350.34178.paul@codesourcery.com> <48D8E6CA.9040802@sgi.com> <200809231404.49340.paul@codesourcery.com> <48DBAC61.9090906@sgi.com> <48E23C00.2030309@codemonkey.ws> From: Jes Sorensen Date: 30 Sep 2008 11:06:07 -0400 In-Reply-To: <48E23C00.2030309@codemonkey.ws> Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Anthony Liguori , Paul Brook >>>>> "Anthony" == Anthony Liguori writes: >> Index: qemu/hw/an5206.c >> =================================================================== >> --- qemu.orig/hw/an5206.c +++ qemu/hw/an5206.c @@ -88,8 +88,9 @@ >> static void an5206_init(ram_addr_t ram_s } QEMUMachine >> an5206_machine = { - "an5206", - "Arnewsh 5206", - an5206_init, - >> 512, + .name = "an5206", + .desc = "Arnewsh 5206", + .init = >> an5206_init, + .ram_require = 512, + .max_cpus = 1, }; Anthony> Your change would be greatly simplified if you defined Anthony> max_cpus to be such that it was the maximum number of vcpus - Anthony> 1. Anthony> Then the default value of 0 would be sufficient for most Anthony> machine types. Hi Anthony, I thought about this, but I think it's a really bad idea. It will cause confusion over time and I think it is quite reasonable to require all machines to define the maximum number of CPUs they support. Thats why I defined the error message so it was quite easy for anyone to fixup in case I got one of them wrong. I really think it's better to do this right than hack it. One option would be to spit out an error asking people to fix zero into '1' and then let zero mean 1 for a while, but I don't think it's worth the overhead. >> Index: qemu/hw/boards.h >> =================================================================== >> --- qemu.orig/hw/boards.h +++ qemu/hw/boards.h @@ -16,7 +16,8 @@ >> typedef struct QEMUMachine { QEMUMachineInitFunc *init; #define >> RAMSIZE_FIXED (1 << 0) ram_addr_t ram_require; - int nodisk_ok; + >> short max_cpus; + char nodisk_ok; struct QEMUMachine *next; } >> QEMUMachine; Anthony> Just use int and please don't change nodisk_ok to char. I did this to avoid making the structure grow. nodisk_ok is just a true/false flag and I think even SGI has no plans to grow beyond 16 bit CPU count numbers. I don't mind keeping both as int, I just thought it was silly to waste the space for zero gain. Anyway, I'll make the change to the patch. Anthony> exit() should be passed something between 0 and 255. Anthony> WEXITSTATUS always returns the least significant 8 bits so Anthony> the result will always be 0..255. Moreover, by convention in Anthony> QEMU we usually exit(1), not exit(-1). I'll fix this - I am 99.999% sure I copied the exit(-1) from somewhere else in the code though :-) cheers, Jes