From: Paul Mackerras <paulus@samba.org>
To: Dave Hansen <dave@linux.vnet.ibm.com>
Cc: linuxppc-dev@ozlabs.org, kvm-ppc@vger.kernel.org,
kvm@vger.kernel.org, Alexander Graf <agraf@suse.de>
Subject: Re: [PATCH 10/17] KVM: PPC: Add support for Book3S processors in hypervisor mode
Date: Mon, 4 Jul 2011 21:51:08 +1000 [thread overview]
Message-ID: <20110704115108.GA2607@bloggs.ozlabs.ibm.com> (raw)
In-Reply-To: <1309545462.16582.12.camel@nimitz>
On Fri, Jul 01, 2011 at 11:37:42AM -0700, Dave Hansen wrote:
> On Wed, 2011-06-29 at 20:21 +1000, Paul Mackerras wrote:
> > +struct kvmppc_pginfo {
> > + unsigned long pfn;
> > + atomic_t refcnt;
> > +};
>
> I only see this refcnt inc'd in one spot and never decremented or read.
> Is the refcnt just the number of hptes we have for this particular page
> at the moment?
It's redundant at present, because the guest physical memory is all
large pages and we don't hand any pages back until the guest quits.
We're going to have to keep some sort of list of HPTEs for each
guest-physical page and we will probably need this refcnt then.
> > +static unsigned long user_page_size(unsigned long addr)
> > +{
> > + struct vm_area_struct *vma;
> > + unsigned long size = PAGE_SIZE;
> > +
> > + down_read(¤t->mm->mmap_sem);
> > + vma = find_vma(current->mm, addr);
> > + if (vma)
> > + size = vma_kernel_pagesize(vma);
> > + up_read(¤t->mm->mmap_sem);
> > + return size;
> > +}
>
> That one looks pretty arch-independent and like it could use some
> consolidation with: virt/kvm/kvm_main.c::kvm_host_page_size()
Actually, it goes away again in patch 14. :)
> > + /* VRMA can't be > 1TB */
> > + if (npages > 1ul << (40 - kvm->arch.ram_porder))
> > + npages = 1ul << (40 - kvm->arch.ram_porder);
>
> Is that because it can only be a single segment? Does that mean that we
> can't ever have guests larger than 1TB? Or just that they have to live
> with 1TB until they get their own page tables up?
It can only be a single segment, and that's because that's how the
hardware works.
It means that the when running in real mode the guest can access at
most the first 1TB of physical memory. Real mode is used early in the
boot process and also in the early stages of exception/interrupt
processing. (Under pHyp we typically only get to access the first
128MB or 256MB of memory in real mode.)
> > + /* Can't use more than 1 HPTE per HPTEG */
> > + if (npages > HPT_NPTEG)
> > + npages = HPT_NPTEG;
> > +
> > + for (i = 0; i < npages; ++i) {
> > + pfn = pginfo[i].pfn;
> > + /* can't use hpt_hash since va > 64 bits */
> > + hash = (i ^ (VRMA_VSID ^ (VRMA_VSID << 25))) & HPT_HASH_MASK;
>
> Is that because 'i' could potentially have a very large pfn? Nish
> thought it might have something to do with the hpte entries being larger
> than 64-bits themselves with the vsid included, but we got thoroughly
> confused. :)
It's because VRMA_VSID (which is set by hardware, we don't control it)
is larger than 2^24. The hpt_hash() function takes a 64-bit VA
composed of a 24-bit VSID and 40 bits of segment offset (for addresses
in 1TB segments).
Paul.
next prev parent reply other threads:[~2011-07-04 11:51 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-29 10:15 [PATCH 0/17] Hypervisor-mode KVM on POWER7 and PPC970 Paul Mackerras
2011-06-29 10:16 ` [PATCH 01/17] KVM: PPC: Fix machine checks on 32-bit Book3S Paul Mackerras
2011-07-01 10:08 ` Alexander Graf
2011-06-29 10:17 ` [PATCH 02/17] KVM: PPC: Move fields between struct kvm_vcpu_arch and kvmppc_vcpu_book3s Paul Mackerras
2011-06-29 10:17 ` [PATCH 03/17] KVM: PPC: Split out code from book3s.c into book3s_pr.c Paul Mackerras
2011-06-29 10:18 ` [PATCH 04/17] powerpc, KVM: Rework KVM checks in first-level interrupt handlers Paul Mackerras
2011-06-29 10:18 ` [PATCH 05/17] KVM: PPC: Deliver program interrupts right away instead of queueing them Paul Mackerras
2011-07-01 11:47 ` Alexander Graf
2011-06-29 10:19 ` [PATCH 06/17] KVM: PPC: Pass init/destroy vm and prepare/commit memory region ops down Paul Mackerras
2011-06-29 10:19 ` [PATCH 07/17] KVM: PPC: Move guest enter/exit down into subarch-specific code Paul Mackerras
2011-06-29 10:20 ` [PATCH 08/17] powerpc: Set up LPCR for running guest partitions Paul Mackerras
2011-06-29 10:20 ` [PATCH 09/17] KVM: PPC: Split host-state fields out of kvmppc_book3s_shadow_vcpu Paul Mackerras
2011-06-29 10:21 ` [PATCH 10/17] KVM: PPC: Add support for Book3S processors in hypervisor mode Paul Mackerras
2011-07-01 18:37 ` Dave Hansen
2011-07-01 19:12 ` Alexander Graf
2011-07-04 11:51 ` Paul Mackerras [this message]
2011-06-29 10:22 ` [PATCH 11/17] KVM: PPC: Handle some PAPR hcalls in the kernel Paul Mackerras
2011-06-29 10:22 ` [PATCH 12/17] KVM: PPC: Accelerate H_PUT_TCE by implementing it in real mode Paul Mackerras
2011-06-29 10:23 ` [PATCH 13/17] KVM: PPC: Allow book3s_hv guests to use SMT processor modes Paul Mackerras
2012-04-16 9:45 ` Alexander Graf
2012-04-16 12:13 ` Paul Mackerras
2012-04-16 13:01 ` Alexander Graf
2011-06-29 10:25 ` [PATCH 14/17] KVM: PPC: Allocate RMAs (Real Mode Areas) at boot for use by guests Paul Mackerras
2011-06-29 10:26 ` [PATCH 15/17] powerpc, KVM: Split HVMODE_206 cpu feature bit into separate HV and architecture bits Paul Mackerras
2011-06-29 10:40 ` [PATCH 16/17] KVM: PPC: book3s_hv: Add support for PPC970-family processors Paul Mackerras
2011-06-29 10:41 ` [RFC PATCH 17/17] KVM: PPC: Add an ioctl for userspace to select which platform to emulate Paul Mackerras
2011-06-29 11:53 ` Josh Boyer
2011-06-29 11:56 ` Alexander Graf
2011-06-29 11:58 ` Josh Boyer
2011-06-30 8:34 ` Avi Kivity
2011-06-30 15:04 ` Alexander Graf
2011-06-30 15:16 ` Avi Kivity
2011-06-30 15:22 ` Alexander Graf
2011-06-30 16:00 ` Avi Kivity
2011-06-30 16:33 ` Alexander Graf
2011-07-03 8:15 ` Avi Kivity
2011-07-03 8:34 ` Alexander Graf
2011-07-03 8:56 ` Avi Kivity
2011-07-03 9:00 ` Alexander Graf
2011-07-03 9:05 ` Avi Kivity
2011-07-03 9:09 ` Alexander Graf
2011-07-03 9:12 ` Avi Kivity
2011-07-04 10:59 ` Alexander Graf
2011-07-04 11:22 ` Avi Kivity
2011-07-04 11:36 ` Alexander Graf
2011-07-04 11:37 ` Avi Kivity
2011-07-04 11:41 ` Alexander Graf
2011-06-30 23:13 ` Benjamin Herrenschmidt
2011-07-01 10:09 ` Paul Mackerras
2011-07-01 10:23 ` Alexander Graf
2011-07-01 18:24 ` [PATCH 0/17] Hypervisor-mode KVM on POWER7 and PPC970 Alexander Graf
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=20110704115108.GA2607@bloggs.ozlabs.ibm.com \
--to=paulus@samba.org \
--cc=agraf@suse.de \
--cc=dave@linux.vnet.ibm.com \
--cc=kvm-ppc@vger.kernel.org \
--cc=kvm@vger.kernel.org \
--cc=linuxppc-dev@ozlabs.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;
as well as URLs for NNTP newsgroup(s).