From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Kt15x-0003UI-7t for qemu-devel@nongnu.org; Thu, 23 Oct 2008 10:23:25 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Kt15w-0003TY-7Z for qemu-devel@nongnu.org; Thu, 23 Oct 2008 10:23:24 -0400 Received: from [199.232.76.173] (port=48566 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Kt15w-0003TN-0I for qemu-devel@nongnu.org; Thu, 23 Oct 2008 10:23:24 -0400 Received: from e8.ny.us.ibm.com ([32.97.182.138]:50096) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Kt15w-0002j8-01 for qemu-devel@nongnu.org; Thu, 23 Oct 2008 10:23:24 -0400 Received: from d01relay02.pok.ibm.com (d01relay02.pok.ibm.com [9.56.227.234]) by e8.ny.us.ibm.com (8.13.1/8.13.1) with ESMTP id m9NEK8RB003971 for ; Thu, 23 Oct 2008 10:20:08 -0400 Received: from d01av04.pok.ibm.com (d01av04.pok.ibm.com [9.56.224.64]) by d01relay02.pok.ibm.com (8.13.8/8.13.8/NCO v9.1) with ESMTP id m9NENMjw111654 for ; Thu, 23 Oct 2008 10:23:22 -0400 Received: from d01av04.pok.ibm.com (loopback [127.0.0.1]) by d01av04.pok.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id m9NENMiS005660 for ; Thu, 23 Oct 2008 10:23:22 -0400 Message-ID: <490088D6.1090702@us.ibm.com> Date: Thu, 23 Oct 2008 09:23:18 -0500 From: Anthony Liguori MIME-Version: 1.0 References: <1224771556-11146-1-git-send-email-glommer@redhat.com> <1224771556-11146-25-git-send-email-glommer@redhat.com> In-Reply-To: <1224771556-11146-25-git-send-email-glommer@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH 24/32] check wether kqemu is enabled in open code Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Glauber Costa Cc: jan.kiszka@siemens.com, jes@sgi.com, qemu-devel@nongnu.org, avi@qumranet.com, dmitry.baryshkov@siemens.com Glauber Costa wrote: > kqemu is still too much spread around. The proper fix > usually involves rethinking a bit of kqemu logic so for now, > just check whether or not kqemu is enabled. If the kqemu accelerator > is not present, consider it not. Otherwise, check env field. > > Signed-off-by: Glauber Costa > --- > cpu-exec.c | 2 +- > kqemu.c | 21 +++++++++++++++++++++ > kqemu.h | 3 +++ > 3 files changed, 25 insertions(+), 1 deletions(-) > > diff --git a/cpu-exec.c b/cpu-exec.c > index 18908d5..b47cf43 100644 > --- a/cpu-exec.c > +++ b/cpu-exec.c > @@ -599,7 +599,7 @@ int cpu_exec(CPUState *env1) > { > if (next_tb != 0 && > #ifdef USE_KQEMU > - (env->kqemu_enabled != 2) && > + (!kqemu_kernel_enabled(env)) && > #endif > tb->page_addr[1] == -1) { > tb_add_jump((TranslationBlock *)(next_tb & ~3), next_tb & 3, tb); > diff --git a/kqemu.c b/kqemu.c > index 16ebe7d..f99a4f1 100644 > --- a/kqemu.c > +++ b/kqemu.c > @@ -126,6 +126,27 @@ static int is_cpuid_supported(void) > } > #endif > > +/* FIXME: Should not be needed, since ideally, QEMUAccel would avoid all kqemu tests > + * altogether > + */ > +int kqemu_is_enabled(CPUState *env) > +{ > + if (strcasecmp(current_accel->name, "kqemu")) { > + return 0; > + } > + > + return env->kqemu_enabled; > + > +} > + > +int kqemu_kernel_enabled(CPUState *env) > +{ > + if (strcasecmp(current_accel->name, "kqemu")) { > + return 0; > + } > + return env->kqemu_enabled == 2; > +} > Why is kqemu_enabled part of the vcpu state? Wouldn't it always be 0 even if we weren't using the accelerator? Regards, Anthony Liguori > static void kqemu_update_cpuid(CPUState *env) > { > int critical_features_mask, features, ext_features, ext_features_mask; > diff --git a/kqemu.h b/kqemu.h > index cf14179..62ba1d9 100644 > --- a/kqemu.h > +++ b/kqemu.h > @@ -157,6 +157,9 @@ struct kqemu_phys_mem { > #define KQEMU_SET_PHYS_MEM _IOW('q', 5, struct kqemu_phys_mem) > #endif > > +int kqemu_is_enabled(CPUState *env); > +int kqemu_kernel_enabled(CPUState *env); > + > typedef struct KQEMUCPUstate { > int kqemu_enabled; > int last_io_time; >