public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony-rdkfGonbjUSkNkDKm+mE6A@public.gmane.org>
To: Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	kvm-ppc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>,
	kvm-ia64-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: Re: [PATCH] Clean up KVM/QEMU interaction
Date: Wed, 30 Jan 2008 08:42:18 -0600	[thread overview]
Message-ID: <47A08CCA.8070503@codemonkey.ws> (raw)
In-Reply-To: <47A047BC.10101-atKUWr5tajBWk0Htik3J/w@public.gmane.org>

Avi Kivity wrote:
> Anthony Liguori wrote:
>   
>> This patch attempts to clean up the interactions between KVM and QEMU.  Sorry
>> for such a big patch, but I don't think there's a better way to approach this
>> such that it's still bisect friendly.  I think this is most of what's needed to
>> get basic KVM support into QEMU though.
>>
>> Right now, there's a mix of #ifdef USE_KVM, if (kvm_allowed), and various
>> extern declarations.  It's all pretty fugly and there's a lot of mistakes due
>> to it.
>>
>> The following patch eliminates almost all uses of #ifdef USE_KVM by introducing
>> a kvm_enabled() macro.  If USE_KVM is set, this macro evaluates to kvm_allowed.
>> If USE_KVM isn't set, the macro evaluates to 0.
>>
>> Since GCC eliminates if (0) blocks, this is just as good as using #ifdef.  By
>> making sure that we never call into libkvm directly from QEMU, we can also just
>> not link qemu-kvm when USE_KVM isn't set instead of having the entire file
>> wrapped in a USE_KVM.
>>
>>   
>>     
>
> It might not when optimizations are disabled.  Please test.
>   

I did.  It works even without -O.

> Also, long term (when we're fully merged into qemu), we need to be able 
> to build without libkvm or linux/kvm.h installed.

With this patch (and the follow-ups), we can build without libkvm.  
There are only two places we call libkvm directly: in qemu-kvm-*.c or in 
some blocks guarded with KVM_CAP_*

I'll clean up the later with a follow up patch.

>   That means we can't 
> use any of the kvm.h defines and data structures.  So for example, 
> kvm_qemu_check_extension(KVM_CAP_USER_MEMORY)) needs to be changed to 
> kvm_qemu_supports_userspace_memory().
>   

Every place that makes that sort of call is guarded at the moment so it 
works.

Regards,

Anthony Liguori


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

      parent reply	other threads:[~2008-01-30 14:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-29 22:46 [PATCH] Clean up KVM/QEMU interaction Anthony Liguori
     [not found] ` <1201646815-5071-1-git-send-email-aliguori-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2008-01-29 23:19   ` [kvm-ppc-devel] " Hollis Blanchard
2008-01-30  2:36   ` Zhang, Xiantao
2008-01-30  5:38   ` Jerone Young
2008-01-30  9:47   ` Avi Kivity
     [not found]     ` <47A047BC.10101-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2008-01-30 10:16       ` Avi Kivity
2008-01-30 14:42       ` Anthony Liguori [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47A08CCA.8070503@codemonkey.ws \
    --to=anthony-rdkfgonbjusknkdkm+me6a@public.gmane.org \
    --cc=avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org \
    --cc=jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org \
    --cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=kvm-ia64-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=kvm-ppc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox