All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Arthur Chunqi Li <yzt356@gmail.com>
Cc: kvm <kvm@vger.kernel.org>, Jan Kiszka <jan.kiszka@web.de>
Subject: Re: Calling to kvm_mmu_load
Date: Wed, 30 Oct 2013 12:44:03 +0100	[thread overview]
Message-ID: <5270F103.1030603@redhat.com> (raw)
In-Reply-To: <CABpY8MJ7hgcOv_moSqVoKfduWLXaJoSYdqUjCSgtTrz_bGXiyg@mail.gmail.com>

Il 30/10/2013 12:39, Arthur Chunqi Li ha scritto:
>> >
>> > kvm_memory_slot just maps a host userspace address range to a guest
>> > physical address range.  Cooperation with Linux memory management is
>> > done with the Linux MMU notifiers.  MMU notifiers let KVM know that a
>> > page has been swapped out, and KVM reacts by invalidating the shadow
>> > page tables for the corresponding guest physical address.
> So for each VM, qemu need to register its memory region and KVM stores
> this region of GPA to HVA mapping in kvm_memory_slot, and at the first
> page fault KVM uses EPT to map GPA to HPA. Am I right?

Yes.

> In this way, how is ballooning mechanism implemented in KVM memory
> management module?

Ballooning is done entirely in userspace with a madvise(MADV_DONTNEED)
call on the HVA.  The userspace has its own GPA->HVA mapping that is
separate from the memslots (e.g. memory_region_find +
memory_region_get_ram_ptr in QEMU).

Paolo

  reply	other threads:[~2013-10-30 11:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-21  7:56 Calling to kvm_mmu_load Arthur Chunqi Li
2013-10-23  6:21 ` Paolo Bonzini
2013-10-24  7:55   ` Arthur Chunqi Li
2013-10-25  0:43     ` Paolo Bonzini
2013-10-29  5:39       ` Arthur Chunqi Li
2013-10-29 12:55         ` Paolo Bonzini
2013-10-30 11:39           ` Arthur Chunqi Li
2013-10-30 11:44             ` Paolo Bonzini [this message]
2013-10-31  8:05           ` Arthur Chunqi Li
2013-10-31  9:52             ` Paolo Bonzini

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=5270F103.1030603@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=jan.kiszka@web.de \
    --cc=kvm@vger.kernel.org \
    --cc=yzt356@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.