From patchwork Sat Jul 21 12:27:03 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 172429 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 7A6232C01CC for ; Sat, 21 Jul 2012 22:28:22 +1000 (EST) Received: from localhost ([::1]:58257 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SsYnE-00023W-JN for incoming@patchwork.ozlabs.org; Sat, 21 Jul 2012 08:28:20 -0400 Received: from eggs.gnu.org ([208.118.235.92]:58583) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SsYmd-0000xI-60 for qemu-devel@nongnu.org; Sat, 21 Jul 2012 08:27:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SsYmb-000523-RZ for qemu-devel@nongnu.org; Sat, 21 Jul 2012 08:27:43 -0400 Received: from e06smtp14.uk.ibm.com ([195.75.94.110]:51973) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SsYmb-00050j-Iv for qemu-devel@nongnu.org; Sat, 21 Jul 2012 08:27:41 -0400 Received: from /spool/local by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sat, 21 Jul 2012 13:27:40 +0100 Received: from d06nrmr1507.portsmouth.uk.ibm.com (9.149.38.233) by e06smtp14.uk.ibm.com (192.168.101.144) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Sat, 21 Jul 2012 13:27:15 +0100 Received: from d06av02.portsmouth.uk.ibm.com (d06av02.portsmouth.uk.ibm.com [9.149.37.228]) by d06nrmr1507.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q6LCRF2T1310916 for ; Sat, 21 Jul 2012 13:27:15 +0100 Received: from d06av02.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q6LCREmJ017990 for ; Sat, 21 Jul 2012 06:27:15 -0600 Received: from localhost (sig-9-146-168-221.uk.ibm.com [9.146.168.221]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q6LCREJY017983; Sat, 21 Jul 2012 06:27:14 -0600 From: Stefan Hajnoczi To: Anthony Liguori Date: Sat, 21 Jul 2012 13:27:03 +0100 Message-Id: <1342873625-7979-5-git-send-email-stefanha@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1342873625-7979-1-git-send-email-stefanha@linux.vnet.ibm.com> References: <1342873625-7979-1-git-send-email-stefanha@linux.vnet.ibm.com> x-cbid: 12072112-1948-0000-0000-0000027561E8 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 195.75.94.110 Cc: Peter Maydell , qemu-devel@nongnu.org, Stefan Hajnoczi Subject: [Qemu-devel] [PATCH 4/6] cpus.c: Make all_cpu_threads_idle() static X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Peter Maydell Commit 946fb27c1 moved all the uses of all_cpu_threads_idle() into cpus.c. This means we can mark the function 'static' (again), if we shuffle it a bit earlier in the source file. Signed-off-by: Peter Maydell Signed-off-by: Stefan Hajnoczi --- cpus.c | 52 ++++++++++++++++++++++++++-------------------------- qemu-common.h | 1 - 2 files changed, 26 insertions(+), 27 deletions(-) diff --git a/cpus.c b/cpus.c index b182b3d..756e624 100644 --- a/cpus.c +++ b/cpus.c @@ -61,6 +61,32 @@ static CPUArchState *next_cpu; +static bool cpu_thread_is_idle(CPUArchState *env) +{ + if (env->stop || env->queued_work_first) { + return false; + } + if (env->stopped || !runstate_is_running()) { + return true; + } + if (!env->halted || qemu_cpu_has_work(env) || kvm_irqchip_in_kernel()) { + return false; + } + return true; +} + +static bool all_cpu_threads_idle(void) +{ + CPUArchState *env; + + for (env = first_cpu; env != NULL; env = env->next_cpu) { + if (!cpu_thread_is_idle(env)) { + return false; + } + } + return true; +} + /***********************************************************/ /* guest cycle counter */ @@ -433,32 +459,6 @@ static int cpu_can_run(CPUArchState *env) return 1; } -static bool cpu_thread_is_idle(CPUArchState *env) -{ - if (env->stop || env->queued_work_first) { - return false; - } - if (env->stopped || !runstate_is_running()) { - return true; - } - if (!env->halted || qemu_cpu_has_work(env) || kvm_irqchip_in_kernel()) { - return false; - } - return true; -} - -bool all_cpu_threads_idle(void) -{ - CPUArchState *env; - - for (env = first_cpu; env != NULL; env = env->next_cpu) { - if (!cpu_thread_is_idle(env)) { - return false; - } - } - return true; -} - static void cpu_handle_guest_debug(CPUArchState *env) { gdb_set_stop_cpu(env); diff --git a/qemu-common.h b/qemu-common.h index 09676f5..7c8dac8 100644 --- a/qemu-common.h +++ b/qemu-common.h @@ -293,7 +293,6 @@ int cpu_load(QEMUFile *f, void *opaque, int version_id); void qemu_cpu_kick(void *env); void qemu_cpu_kick_self(void); int qemu_cpu_is_self(void *env); -bool all_cpu_threads_idle(void); /* work queue */ struct qemu_work_item {