From: Paul Mackerras <paulus@samba.org> To: Alexander Graf <agraf@suse.de> Cc: kvm@vger.kernel.org, kvm-ppc@vger.kernel.org Subject: [PATCH 0/4] KVM: PPC: Book3S HV: HPT read/write functions for userspace Date: Wed, 14 Nov 2012 15:30:34 +1100 [thread overview] Message-ID: <20121114043034.GA13832@drongo> (raw) This series of patches provides an interface by which userspace can read and write the hashed page table (HPT) of a Book3S HV guest. The interface is an ioctl which provides a file descriptor which can be accessed with the read() and write() system calls. The data read and written is the guest view of the HPT, in which the second doubleword of each HPTE (HPT entry) contains a guest physical address, as distinct from the real HPT that the hardware accesses, where the second doubleword of each HPTE contains a real address. Because the HPT is divided into groups (HPTEGs) of 8 entries each, where each HPTEG usually only contains a few valid entries, or none, the data format that we use does run-length encoding of the invalid entries, so in fact the invalid entries take up no space in the stream. The interface also provides for doing multiple passes over the HPT, where the first pass provides information on all HPTEs, and subsequent passes only return the HPTEs that have changed since the previous pass. I have implemented a read/write interface rather than an mmap-based interface because the data is not stored contiguously anywhere in kernel memory. Of each 16-byte HPTE, the first 8 bytes come from the real HPT and the second 8 bytes come from the parallel vmalloc'd array where we store the guest view of the guest physical address, permissions, accessed/dirty bits etc. Thus a mmap-based interface would not be practicable (not without doubling the size of the parallel array, typically requiring an extra 8MB of kernel memory per guest). This is also why I have not used the memslot interface for this. This implements the interface for HV-style KVM but not for PR-style KVM. Userspace does not need any additional interface with PR-style KVM because userspace maintains the guest HPT already in that case, and has an image of the guest view of the HPT in its address space. This series is against the next branch of the kvm tree. The patches are basically identical to the previous posting of the series, just rediffed for the move of kvm.h from include/linux to include/uapi/linux, and for commit 8ca40a70a7 ("KVM: Take kvm instead of vcpu to mmu_notifier_retry"), which supersedes patch 1 of the old series. The overall diffstat is: Documentation/virtual/kvm/api.txt | 53 +++++ arch/powerpc/include/asm/kvm_book3s.h | 8 +- arch/powerpc/include/asm/kvm_book3s_64.h | 24 ++ arch/powerpc/include/asm/kvm_host.h | 1 + arch/powerpc/include/asm/kvm_ppc.h | 2 + arch/powerpc/include/uapi/asm/kvm.h | 24 ++ arch/powerpc/kvm/book3s_64_mmu_hv.c | 380 +++++++++++++++++++++++++++++- arch/powerpc/kvm/book3s_hv.c | 12 - arch/powerpc/kvm/book3s_hv_rm_mmu.c | 71 ++++-- arch/powerpc/kvm/powerpc.c | 17 ++ include/uapi/linux/kvm.h | 3 + 11 files changed, 551 insertions(+), 44 deletions(-) Please apply. Paul.
WARNING: multiple messages have this Message-ID (diff)
From: Paul Mackerras <paulus@samba.org> To: Alexander Graf <agraf@suse.de> Cc: kvm@vger.kernel.org, kvm-ppc@vger.kernel.org Subject: [PATCH 0/4] KVM: PPC: Book3S HV: HPT read/write functions for userspace Date: Wed, 14 Nov 2012 04:30:34 +0000 [thread overview] Message-ID: <20121114043034.GA13832@drongo> (raw) This series of patches provides an interface by which userspace can read and write the hashed page table (HPT) of a Book3S HV guest. The interface is an ioctl which provides a file descriptor which can be accessed with the read() and write() system calls. The data read and written is the guest view of the HPT, in which the second doubleword of each HPTE (HPT entry) contains a guest physical address, as distinct from the real HPT that the hardware accesses, where the second doubleword of each HPTE contains a real address. Because the HPT is divided into groups (HPTEGs) of 8 entries each, where each HPTEG usually only contains a few valid entries, or none, the data format that we use does run-length encoding of the invalid entries, so in fact the invalid entries take up no space in the stream. The interface also provides for doing multiple passes over the HPT, where the first pass provides information on all HPTEs, and subsequent passes only return the HPTEs that have changed since the previous pass. I have implemented a read/write interface rather than an mmap-based interface because the data is not stored contiguously anywhere in kernel memory. Of each 16-byte HPTE, the first 8 bytes come from the real HPT and the second 8 bytes come from the parallel vmalloc'd array where we store the guest view of the guest physical address, permissions, accessed/dirty bits etc. Thus a mmap-based interface would not be practicable (not without doubling the size of the parallel array, typically requiring an extra 8MB of kernel memory per guest). This is also why I have not used the memslot interface for this. This implements the interface for HV-style KVM but not for PR-style KVM. Userspace does not need any additional interface with PR-style KVM because userspace maintains the guest HPT already in that case, and has an image of the guest view of the HPT in its address space. This series is against the next branch of the kvm tree. The patches are basically identical to the previous posting of the series, just rediffed for the move of kvm.h from include/linux to include/uapi/linux, and for commit 8ca40a70a7 ("KVM: Take kvm instead of vcpu to mmu_notifier_retry"), which supersedes patch 1 of the old series. The overall diffstat is: Documentation/virtual/kvm/api.txt | 53 +++++ arch/powerpc/include/asm/kvm_book3s.h | 8 +- arch/powerpc/include/asm/kvm_book3s_64.h | 24 ++ arch/powerpc/include/asm/kvm_host.h | 1 + arch/powerpc/include/asm/kvm_ppc.h | 2 + arch/powerpc/include/uapi/asm/kvm.h | 24 ++ arch/powerpc/kvm/book3s_64_mmu_hv.c | 380 +++++++++++++++++++++++++++++- arch/powerpc/kvm/book3s_hv.c | 12 - arch/powerpc/kvm/book3s_hv_rm_mmu.c | 71 ++++-- arch/powerpc/kvm/powerpc.c | 17 ++ include/uapi/linux/kvm.h | 3 + 11 files changed, 551 insertions(+), 44 deletions(-) Please apply. Paul.
next reply other threads:[~2012-11-14 4:30 UTC|newest] Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-11-14 4:30 Paul Mackerras [this message] 2012-11-14 4:30 ` [PATCH 0/4] KVM: PPC: Book3S HV: HPT read/write functions for userspace Paul Mackerras 2012-11-14 4:31 ` [PATCH 1/4] KVM: PPC: Book3S HV: Restructure HPT entry creation code Paul Mackerras 2012-11-14 4:31 ` Paul Mackerras 2012-11-19 12:54 ` Alexander Graf 2012-11-19 12:54 ` Alexander Graf 2012-11-14 4:32 ` [PATCH 2/4] KVM: PPC: Book3S HV: Add a mechanism for recording modified HPTEs Paul Mackerras 2012-11-14 4:32 ` Paul Mackerras 2012-11-19 12:36 ` Alexander Graf 2012-11-19 12:36 ` Alexander Graf 2012-11-19 17:20 ` Scott Wood 2012-11-19 17:20 ` Scott Wood 2012-11-19 17:40 ` Alexander Graf 2012-11-19 17:40 ` Alexander Graf 2012-11-19 23:25 ` Paul Mackerras 2012-11-19 23:25 ` Paul Mackerras 2012-11-14 4:32 ` [PATCH 3/4] KVM: PPC: Book3S HV: Make a HPTE removal function available Paul Mackerras 2012-11-14 4:32 ` Paul Mackerras 2012-11-14 4:33 ` [PATCH 4/4] KVM: PPC: Book3S HV: Provide a method for userspace to read and write the HPT Paul Mackerras 2012-11-14 4:33 ` Paul Mackerras 2012-11-19 12:53 ` Alexander Graf 2012-11-19 12:53 ` Alexander Graf 2012-11-19 23:59 ` Paul Mackerras 2012-11-19 23:59 ` 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=20121114043034.GA13832@drongo \ --to=paulus@samba.org \ --cc=agraf@suse.de \ --cc=kvm-ppc@vger.kernel.org \ --cc=kvm@vger.kernel.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: linkBe 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.