From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60550) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W1MjM-0004qi-Eg for qemu-devel@nongnu.org; Thu, 09 Jan 2014 16:01:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W1MjG-0004dL-9h for qemu-devel@nongnu.org; Thu, 09 Jan 2014 16:01:32 -0500 Received: from mail-qe0-f49.google.com ([209.85.128.49]:57992) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W1MjG-0004at-69 for qemu-devel@nongnu.org; Thu, 09 Jan 2014 16:01:26 -0500 Received: by mail-qe0-f49.google.com with SMTP id w4so854530qeb.36 for ; Thu, 09 Jan 2014 13:01:24 -0800 (PST) From: Mike Day In-Reply-To: <1389245648-10300-1-git-send-email-aik@ozlabs.ru> References: <1389245648-10300-1-git-send-email-aik@ozlabs.ru> Date: Thu, 09 Jan 2014 16:00:58 -0500 Message-ID: <87ppo0na45.fsf@pixel.localdomain> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [RFC PATCH v2] PPC: smp: autodetect numbers of threads per core List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexey Kardashevskiy , qemu-devel@nongnu.org Cc: Paul Mackerras , qemu-ppc@nongnu.org, Alexander Graf Alexey Kardashevskiy writes: > /* compute missing values, prefer sockets over cores over threads */ > if (cpus == 0 || sockets == 0) { > sockets = sockets > 0 ? sockets : 1; > cores = cores > 0 ? cores : 1; > - threads = threads > 0 ? threads : 1; > + if (threads_max) { > + if (threads > 0) { > + fprintf(stderr, "Use either threads or threads_max\n"); > + exit(1); If you went ahead with the threads="max" string option you wouldn't need to check here for mutual excusivity and the user wouldn't need to worry about an extra command options. > + } > + threads = smp_threads > 0 ? smp_threads : 1; > + } else { > + threads = threads > 0 ? threads : 1; > + } > if (cpus == 0) { > cpus = cores * threads * sockets; > } -- Mike Day | "Endurance is a Virtue"