Re: [Qemu-devel] [Qemu-ppc] [PATCH] spapr: Correct RAM size calculation for HPT resizing

2017-10-10 Thread David Gibson
On Tue, Oct 10, 2017 at 05:10:27PM +0200, Andrea Bolognani wrote:
> On Wed, 2017-10-11 at 00:21 +1100, David Gibson wrote:
> > In order to prevent the guest from forcing the allocation of large amounts
> > of qemu memory (or host kernel memory, in the case of KVM HV), we limit
> > the size of Hashed Page Table (HPT) it is allowed to allocated, based on
> > its RAM size.
> > 
> > However, the current calculation is not correct: it only adds up the size
> > of plugged memory, ignoring the base memory size.  This patch corrects it.
> > 
> > While we're there, use get_plugged_memory_size() instead of directly
> > calling pc_existing_dimms_capacity().  The only difference is that it
> > will abort on failure, which is right: a failure here indicates something
> > wrong within qemu.
> 
> Does this change invalidate in any way the calculation performed
> by libvirt to figure out the memory locking limit for guests?

No.

-- 
David Gibson| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson


signature.asc
Description: PGP signature


Re: [Qemu-devel] [Qemu-ppc] [PATCH] spapr: Correct RAM size calculation for HPT resizing

2017-10-10 Thread Andrea Bolognani
On Wed, 2017-10-11 at 00:21 +1100, David Gibson wrote:
> In order to prevent the guest from forcing the allocation of large amounts
> of qemu memory (or host kernel memory, in the case of KVM HV), we limit
> the size of Hashed Page Table (HPT) it is allowed to allocated, based on
> its RAM size.
> 
> However, the current calculation is not correct: it only adds up the size
> of plugged memory, ignoring the base memory size.  This patch corrects it.
> 
> While we're there, use get_plugged_memory_size() instead of directly
> calling pc_existing_dimms_capacity().  The only difference is that it
> will abort on failure, which is right: a failure here indicates something
> wrong within qemu.

Does this change invalidate in any way the calculation performed
by libvirt to figure out the memory locking limit for guests?

-- 
Andrea Bolognani / Red Hat / Virtualization