* [PATCH] Abort if gcc4 was used to compile qemu and kvm is not enabled
@ 2007-10-08 15:44 Carlo Marcelo Arenas Belon
2007-10-08 15:53 ` Anthony Liguori
0 siblings, 1 reply; 7+ messages in thread
From: Carlo Marcelo Arenas Belon @ 2007-10-08 15:44 UTC (permalink / raw)
To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
Using gcc4 to compile qemu will generate broken code for its cpu emulation
but should be fine if using kvm only.
This will allow users that have no access to gcc4 on their platforms to at
least get kvm compiled and use it while preventing them to run a broken
qemu if kvm is not available.
This is not meant to be used in the long run when a solution to qemu's use
of gcc-3.x for code generation is finally resolved upstream, which is why
it is kept inside the KVM specific sections of the code only.
Signed-off-by: Carlo Marcelo Arenas Belon <carenas-kLeDWSohozoJb6fo7hG9ng@public.gmane.org>
---
qemu/vl.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/qemu/vl.c b/qemu/vl.c
index 634fb34..549f008 100644
--- a/qemu/vl.c
+++ b/qemu/vl.c
@@ -8425,8 +8425,13 @@ int main(int argc, char **argv)
#endif
#ifdef USE_KVM
case QEMU_OPTION_no_kvm:
+#if __GNUC__ >= 4
+ fprintf(stderr, "Can't run without kvm if compiled with gcc4\n");
+ exit(1);
+#else
kvm_allowed = 0;
break;
+#endif
case QEMU_OPTION_no_kvm_irqchip:
kvm_irqchip = 0;
break;
@@ -8559,8 +8564,13 @@ int main(int argc, char **argv)
#if USE_KVM
if (kvm_allowed) {
if (kvm_qemu_init() < 0) {
+#if __GNUC__ >= 4
+ fprintf(stderr, "Could not initialize KVM, can't run without kvm if compiled with gcc4\n");
+ exit(1);
+#else
fprintf(stderr, "Could not initialize KVM, will disable KVM support\n");
kvm_allowed = 0;
+#endif
}
}
#endif
--
1.5.2.5
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] Abort if gcc4 was used to compile qemu and kvm is not enabled
2007-10-08 15:44 [PATCH] Abort if gcc4 was used to compile qemu and kvm is not enabled Carlo Marcelo Arenas Belon
@ 2007-10-08 15:53 ` Anthony Liguori
[not found] ` <470A5290.4040504-rdkfGonbjUSkNkDKm+mE6A@public.gmane.org>
0 siblings, 1 reply; 7+ messages in thread
From: Anthony Liguori @ 2007-10-08 15:53 UTC (permalink / raw)
To: Carlo Marcelo Arenas Belon; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
Carlo Marcelo Arenas Belon wrote:
> Using gcc4 to compile qemu will generate broken code for its cpu emulation
> but should be fine if using kvm only.
>
> This will allow users that have no access to gcc4 on their platforms to at
> least get kvm compiled and use it while preventing them to run a broken
> qemu if kvm is not available.
>
This is a pretty bad thing IMHO. There are other patches out there that
allow QEMU (even with -no-kvm) to work with GCC4. A random check like
this is going to result in difficulties down the road. Maybe a release
of GCC4 will allow QEMU to work in the future. A check like this is
just way too general IMHO.
If you're going to do anything, a firm warning when compiling with a
GCC4 override would be the best thing.
Regards,
Anthony Liguori
> This is not meant to be used in the long run when a solution to qemu's use
> of gcc-3.x for code generation is finally resolved upstream, which is why
> it is kept inside the KVM specific sections of the code only.
>
> Signed-off-by: Carlo Marcelo Arenas Belon <carenas-kLeDWSohozoJb6fo7hG9ng@public.gmane.org>
> ---
> qemu/vl.c | 10 ++++++++++
> 1 files changed, 10 insertions(+), 0 deletions(-)
>
> diff --git a/qemu/vl.c b/qemu/vl.c
> index 634fb34..549f008 100644
> --- a/qemu/vl.c
> +++ b/qemu/vl.c
> @@ -8425,8 +8425,13 @@ int main(int argc, char **argv)
> #endif
> #ifdef USE_KVM
> case QEMU_OPTION_no_kvm:
> +#if __GNUC__ >= 4
> + fprintf(stderr, "Can't run without kvm if compiled with gcc4\n");
> + exit(1);
> +#else
> kvm_allowed = 0;
> break;
> +#endif
> case QEMU_OPTION_no_kvm_irqchip:
> kvm_irqchip = 0;
> break;
> @@ -8559,8 +8564,13 @@ int main(int argc, char **argv)
> #if USE_KVM
> if (kvm_allowed) {
> if (kvm_qemu_init() < 0) {
> +#if __GNUC__ >= 4
> + fprintf(stderr, "Could not initialize KVM, can't run without kvm if compiled with gcc4\n");
> + exit(1);
> +#else
> fprintf(stderr, "Could not initialize KVM, will disable KVM support\n");
> kvm_allowed = 0;
> +#endif
> }
> }
> #endif
>
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Abort if gcc4 was used to compile qemu and kvm is not enabled
[not found] ` <470A5290.4040504-rdkfGonbjUSkNkDKm+mE6A@public.gmane.org>
@ 2007-10-08 18:45 ` Byron Stanoszek
[not found] ` <Pine.LNX.4.64.0710081411160.27239-4mf1WHGLwUrYtjvyW6yDsg@public.gmane.org>
0 siblings, 1 reply; 7+ messages in thread
From: Byron Stanoszek @ 2007-10-08 18:45 UTC (permalink / raw)
To: Anthony Liguori
Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
Carlo Marcelo Arenas Belon
On Mon, 8 Oct 2007, Anthony Liguori wrote:
> Carlo Marcelo Arenas Belon wrote:
>> Using gcc4 to compile qemu will generate broken code for its cpu emulation
>> but should be fine if using kvm only.
>>
>> This will allow users that have no access to gcc4 on their platforms to at
>> least get kvm compiled and use it while preventing them to run a broken
>> qemu if kvm is not available.
>>
>
> This is a pretty bad thing IMHO. There are other patches out there that
> allow QEMU (even with -no-kvm) to work with GCC4. A random check like
> this is going to result in difficulties down the road. Maybe a release
> of GCC4 will allow QEMU to work in the future. A check like this is
> just way too general IMHO.
>
> If you're going to do anything, a firm warning when compiling with a
> GCC4 override would be the best thing.
I disagree with the compile warning. There have been times in the past when
I've forgotten to "insmod kvm*.ko" long after the compile stage, and wound up
wondering why the virtual machine was slower. Even when I first started using
KVM, I had no positive feedback that KVM was even working properly (was the
device node created? am I using a cpu with the correct extensions? etc). I
eventually figured out that if 'lsmod' showed kvm-intel.ko usage > 0, then I
knew it was working.
I would think that anyone who is using KVM has the required hardware and wants
to be sure that KVM is really being used. Specifying -no-kvm is an excellent
tool for debugging purposes, but I don't want KVM to fail silently on me and
pretend that I typed -no-kvm, especially if I'm using GCC 4.x and never
intended to use the QEMU portion anyway.
I would much rather see KVM fail gracefully, rather than revert to QEMU,
regardless of the compiler version being used.
-Byron
--
Byron Stanoszek Ph: (330) 644-3059
Systems Programmer Fax: (330) 644-8110
Commercial Timesharing Inc. Email: byron-vdaza9t/se1BDgjK7y7TUQ@public.gmane.org
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Abort if gcc4 was used to compile qemu and kvm is not enabled
[not found] ` <Pine.LNX.4.64.0710081411160.27239-4mf1WHGLwUrYtjvyW6yDsg@public.gmane.org>
@ 2007-10-08 19:29 ` Anthony Liguori
[not found] ` <470A851C.3050602-rdkfGonbjUSkNkDKm+mE6A@public.gmane.org>
2007-10-09 13:28 ` Avi Kivity
1 sibling, 1 reply; 7+ messages in thread
From: Anthony Liguori @ 2007-10-08 19:29 UTC (permalink / raw)
To: Byron Stanoszek
Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
Carlo Marcelo Arenas Belon
Byron Stanoszek wrote:
> On Mon, 8 Oct 2007, Anthony Liguori wrote:
>>
>> If you're going to do anything, a firm warning when compiling with a
>> GCC4 override would be the best thing.
>
> I disagree with the compile warning. There have been times in the past
> when
> I've forgotten to "insmod kvm*.ko" long after the compile stage, and
> wound up
> wondering why the virtual machine was slower. Even when I first
> started using
> KVM, I had no positive feedback that KVM was even working properly
> (was the
> device node created? am I using a cpu with the correct extensions?
> etc). I
> eventually figured out that if 'lsmod' showed kvm-intel.ko usage > 0,
> then I
> knew it was working.
You don't have to have kvm.ko insmod'd during compile. Presumably the
issue you were seeing is that you built a version of QEMU without KVM
support. Were you using the top-level configure script?
> I would think that anyone who is using KVM has the required hardware
> and wants
> to be sure that KVM is really being used. Specifying -no-kvm is an
> excellent
> tool for debugging purposes, but I don't want KVM to fail silently on
> me and
> pretend that I typed -no-kvm, especially if I'm using GCC 4.x and never
> intended to use the QEMU portion anyway.
Eventually, KVM will merge with upstream QEMU. In that case, many
people will be using QEMU without the desiring to use KVM. We don't
want to introduce behavior in QEMU that is unmergable with upstream QEMU
b/c that will just cause users more headache when that behavior is
eventually change.
Regards,
Anthony Liguori
> I would much rather see KVM fail gracefully, rather than revert to QEMU,
> regardless of the compiler version being used.
>
> -Byron
>
> --
> Byron Stanoszek Ph: (330) 644-3059
> Systems Programmer Fax: (330) 644-8110
> Commercial Timesharing Inc. Email: byron-vdaza9t/se1BDgjK7y7TUQ@public.gmane.org
>
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Abort if gcc4 was used to compile qemu and kvm is not enabled
[not found] ` <470A851C.3050602-rdkfGonbjUSkNkDKm+mE6A@public.gmane.org>
@ 2007-10-09 6:46 ` Carlo Marcelo Arenas Belon
2007-10-09 14:53 ` Anthony Liguori
0 siblings, 1 reply; 7+ messages in thread
From: Carlo Marcelo Arenas Belon @ 2007-10-09 6:46 UTC (permalink / raw)
To: Anthony Liguori
Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, Byron Stanoszek
On Mon, Oct 08, 2007 at 02:29:32PM -0500, Anthony Liguori wrote:
>
> Eventually, KVM will merge with upstream QEMU. In that case, many
> people will be using QEMU without the desiring to use KVM. We don't
> want to introduce behavior in QEMU that is unmergable with upstream QEMU
> b/c that will just cause users more headache when that behavior is
> eventually change.
As I mentioned in the patch proposed, I don't expect for this patch to be
ever merged upstream (even if a solution like that might be possible for kqemu
based emulations as well).
It is for the same reason that I considered this approach; which keeps the
changes to a minimum and localized to the KVM patches so it can be easily
stripped out when it is no longer needed.
The alternatives are IMHO more difficult to manage :
1) Have all users of platforms that have no gcc-3.x (currently OpenSUSE and
soon enough Debian and derivatives like Ubuntu) with no way to be able to use
kvm, unless they can somehow figure out how to compile a gcc-3.x compiler and
use that to build kvm or rely on their distributions to do that for them.
2) Add several patches to our qemu (like the ones from Novell) to get it to
build with gcc-4.x. Then everyone (including the ones which should be using
gcc-3.x instead) start using it and then we are suddenly supporting
performance problems, miscompilation bugs, and overall issues in qemu instead
of kvm (not including the misreported bugs from users that though they were
running kvm when they forgot to load the module) while making a merge with
upstream much more difficult.
3) We do nothing, add a warning to the compilation for the users to read at
compile time (most of them not aware that they should be using gcc-3.x instead
as they are used to see all the other compilation warnings anyway) and then
let kvm segfault when they start it without loading the module first.
If nothing, a message saying this won't work because you used the wrong
compiler, is IMHO better than a plain segfault.
Carlo
PS. if qemu gets upstream officially a solution to compile with gcc4, I'll be
the first one getting that merged and removing this patch.
PS2. getting gcc4 to generate valid chunks of "copyable" code as required by
qemu's dyngen is not something that would happen accidentally, for a promising
alternative look at the GCC 2007 proceedings abstract "Towards GCC as a
compiler for multiple VMs", pages 117-130,
http://ols2006.108.redhat.com/2007/GCC-Reprints/GCC2007-Proceedings.pdf
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Abort if gcc4 was used to compile qemu and kvm is not enabled
[not found] ` <Pine.LNX.4.64.0710081411160.27239-4mf1WHGLwUrYtjvyW6yDsg@public.gmane.org>
2007-10-08 19:29 ` Anthony Liguori
@ 2007-10-09 13:28 ` Avi Kivity
1 sibling, 0 replies; 7+ messages in thread
From: Avi Kivity @ 2007-10-09 13:28 UTC (permalink / raw)
To: Byron Stanoszek
Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
Carlo Marcelo Arenas Belon
Byron Stanoszek wrote:
> Even when I first started using
> KVM, I had no positive feedback that KVM was even working properly (was the
> device node created? am I using a cpu with the correct extensions? etc). I
> eventually figured out that if 'lsmod' showed kvm-intel.ko usage > 0, then I
> knew it was working.
>
The window title bar says 'QEMU/KVM' instead of 'QEMU' when kvm is active.
--
error compiling committee.c: too many arguments to function
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Abort if gcc4 was used to compile qemu and kvm is not enabled
2007-10-09 6:46 ` Carlo Marcelo Arenas Belon
@ 2007-10-09 14:53 ` Anthony Liguori
0 siblings, 0 replies; 7+ messages in thread
From: Anthony Liguori @ 2007-10-09 14:53 UTC (permalink / raw)
To: Carlo Marcelo Arenas Belon
Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, Byron Stanoszek
Carlo Marcelo Arenas Belon wrote:
> On Mon, Oct 08, 2007 at 02:29:32PM -0500, Anthony Liguori wrote:
>
> 3) We do nothing, add a warning to the compilation for the users to read at
> compile time (most of them not aware that they should be using gcc-3.x instead
> as they are used to see all the other compilation warnings anyway) and then
> let kvm segfault when they start it without loading the module first.
>
Here are some alternatives that I think are more reasonable:
1) implement a KVM target for QEMU that doesn't use dyngen at all. Some
of the architecture ports (like ia64 and s390) are going to require this
anyway since dyngen doesn't support ia64 or s390. There's no reason
this can be used for x86 too.
2) work on getting the assembly post-processor merged into upstream
QEMU. IMHO, this is the best long term strategy for QEMU GCC4 support.
3) you have to pass an option to ./configure to disable the gcc4 check.
Issue a big fat warning when the user does this saying that the
resulting QEMU will not probably work with -no-kvm or if the KVM modules
are loaded. The user is smart enough to disable the gcc4 check so I
have to imagine that they are smart enough to not completely ignore this
warning.
Regards,
Anthony Liguori
> If nothing, a message saying this won't work because you used the wrong
> compiler, is IMHO better than a plain segfault.
>
> Carlo
>
> PS. if qemu gets upstream officially a solution to compile with gcc4, I'll be
> the first one getting that merged and removing this patch.
>
> PS2. getting gcc4 to generate valid chunks of "copyable" code as required by
> qemu's dyngen is not something that would happen accidentally, for a promising
> alternative look at the GCC 2007 proceedings abstract "Towards GCC as a
> compiler for multiple VMs", pages 117-130,
> http://ols2006.108.redhat.com/2007/GCC-Reprints/GCC2007-Proceedings.pdf
>
>
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2007-10-09 14:53 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-08 15:44 [PATCH] Abort if gcc4 was used to compile qemu and kvm is not enabled Carlo Marcelo Arenas Belon
2007-10-08 15:53 ` Anthony Liguori
[not found] ` <470A5290.4040504-rdkfGonbjUSkNkDKm+mE6A@public.gmane.org>
2007-10-08 18:45 ` Byron Stanoszek
[not found] ` <Pine.LNX.4.64.0710081411160.27239-4mf1WHGLwUrYtjvyW6yDsg@public.gmane.org>
2007-10-08 19:29 ` Anthony Liguori
[not found] ` <470A851C.3050602-rdkfGonbjUSkNkDKm+mE6A@public.gmane.org>
2007-10-09 6:46 ` Carlo Marcelo Arenas Belon
2007-10-09 14:53 ` Anthony Liguori
2007-10-09 13:28 ` Avi Kivity
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox