Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: Alexander Graf <agraf@suse.de>
To: Paul Mackerras <paulus@samba.org>
Cc: kvm-ppc@vger.kernel.org, kvm@vger.kernel.org
Subject: Re: [PATCH v2 3/3] KVM: PPC: Book3S HV: Provide a method for userspace to read and write the HPT
Date: Tue, 20 Nov 2012 10:16:24 +0100	[thread overview]
Message-ID: <8A12CDEC-45FC-4436-88DF-7708B04CDB31@suse.de> (raw)
In-Reply-To: <20121120085720.GC2994@bloggs.ozlabs.ibm.com>


On 20.11.2012, at 09:57, Paul Mackerras wrote:

> A new ioctl, KVM_PPC_GET_HTAB_FD, returns a file descriptor.  Reads on
> this fd return the contents of the HPT (hashed page table), writes
> create and/or remove entries in the HPT.  There is a new capability,
> KVM_CAP_PPC_HTAB_FD, to indicate the presence of the ioctl.  The ioctl
> takes an argument structure with the index of the first HPT entry to
> read out and a set of flags.  The flags indicate whether the user is
> intending to read or write the HPT, and whether to return all entries
> or only the "bolted" entries (those with the bolted bit, 0x10, set in
> the first doubleword).
> 
> This is intended for use in implementing qemu's savevm/loadvm and for
> live migration.  Therefore, on reads, the first pass returns information
> about all HPTEs (or all bolted HPTEs).  When the first pass reaches the
> end of the HPT, it returns from the read.  Subsequent reads only return
> information about HPTEs that have changed since they were last read.
> A read that finds no changed HPTEs in the HPT following where the last
> read finished will return 0 bytes.
> 
> The format of the data provides a simple run-length compression of the
> invalid entries.  Each block of data starts with a header that indicates
> the index (position in the HPT, which is just an array), the number of
> valid entries starting at that index (may be zero), and the number of
> invalid entries following those valid entries.  The valid entries, 16
> bytes each, follow the header.  The invalid entries are not explicitly
> represented.
> 
> Signed-off-by: Paul Mackerras <paulus@samba.org>
> ---
> v2: added comments, added reserved field in struct kvm_get_htab_fd
> 
> Documentation/virtual/kvm/api.txt        |   53 +++++
> arch/powerpc/include/asm/kvm_book3s_64.h |   22 ++
> arch/powerpc/include/asm/kvm_ppc.h       |    2 +
> arch/powerpc/include/uapi/asm/kvm.h      |   25 +++
> arch/powerpc/kvm/book3s_64_mmu_hv.c      |  344 ++++++++++++++++++++++++++++++
> arch/powerpc/kvm/book3s_hv.c             |   12 --
> arch/powerpc/kvm/powerpc.c               |   17 ++
> include/uapi/linux/kvm.h                 |    3 +
> 8 files changed, 466 insertions(+), 12 deletions(-)
> 
> diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt
> index 6671fdc..33080ea 100644
> --- a/Documentation/virtual/kvm/api.txt
> +++ b/Documentation/virtual/kvm/api.txt
> @@ -2071,6 +2071,59 @@ KVM_S390_INT_EXTERNAL_CALL (vcpu) - sigp external call; source cpu in parm
> 
> Note that the vcpu ioctl is asynchronous to vcpu execution.
> 
> +4.78 KVM_PPC_GET_HTAB_FD
> +
> +Capability: KVM_CAP_PPC_HTAB_FD
> +Architectures: powerpc
> +Type: vm ioctl
> +Parameters: Pointer to struct kvm_get_htab_fd (in)
> +Returns: file descriptor number (>= 0) on success, -1 on error
> +
> +This returns a file descriptor that can be used either to read out the
> +entries in the guest's hashed page table (HPT), or to write entries to
> +initialize the HPT.  The returned fd can only be written to if the
> +KVM_GET_HTAB_WRITE bit is set in the flags field of the argument, and
> +can only be read if that bit is clear.  The argument struct looks like
> +this:
> +
> +/* For KVM_PPC_GET_HTAB_FD */
> +struct kvm_get_htab_fd {
> +	__u64	flags;
> +	__u64	start_index;

Documentation is out of sync :).

Applied all 3 with fixed documentation.


Alex

  reply	other threads:[~2012-11-20  9:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-20  8:52 [PATCH v2 1/3] KVM: PPC: Book3S HV: Add a mechanism for recording modified HPTEs Paul Mackerras
2012-11-20  8:55 ` [PATCH v2 2/3] KVM: PPC: Book3S HV: Make a HPTE removal function available Paul Mackerras
2012-11-20  8:57 ` [PATCH v2 3/3] KVM: PPC: Book3S HV: Provide a method for userspace to read and write the HPT Paul Mackerras
2012-11-20  9:16   ` Alexander Graf [this message]
2012-11-20 11:44     ` Paul Mackerras

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=8A12CDEC-45FC-4436-88DF-7708B04CDB31@suse.de \
    --to=agraf@suse.de \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=paulus@samba.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