Linux KVM/arm64 development list
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Andre Przywara <andre.przywara@arm.com>
Cc: Will Deacon <will@kernel.org>,
	kernel-team@android.com, kvmarm@lists.cs.columbia.edu
Subject: Re: [PATCH v2 3/3] kvmtool: arm64: Configure VM with the minimal required IPA space
Date: Thu, 26 Aug 2021 12:11:18 +0100	[thread overview]
Message-ID: <871r6gpijt.wl-maz@kernel.org> (raw)
In-Reply-To: <20210824014734.610f2cb2@slackpad.fritz.box>

On Tue, 24 Aug 2021 01:47:34 +0100,
Andre Przywara <andre.przywara@arm.com> wrote:
> 
> On Sun, 22 Aug 2021 16:25:26 +0100
> Marc Zyngier <maz@kernel.org> wrote:
> 
> Hi Marc,
> 
> > There is some value in keeping the IPA space small, as it reduces
> > the size of the stage-2 page tables.
> > 
> > Let's compute the required space at VM creation time, and inform
> > the kernel of our requirements.
> 
> You mentioned some kernel bug in the first version of this patch, I
> guess the fix for this is 262b003d059c?
> It seems to me that this is somewhat of a regression on older host
> kernels, when trying to run a guest with "-m 2048", for instance?
> Should we teach kvmtool about this bug, and do a check for the bug
> condition, when kvm__register_ram() returns with -EFAULT? And give users
> a hint to try with one MB more or less guest RAM? Or maybe try
> this automatically?

I guess an additional patch could do a retry with one more bit of IPA
space.

However, the fix for this bug was backported to all stable kernels.
Given that the audience for kvmtool is pretty limited, I'd rather only
add this if someone actively complains.

> 
> > 
> > Signed-off-by: Marc Zyngier <maz@kernel.org>
> > ---
> >  arm/aarch64/kvm.c | 20 +++++++++++++++++++-
> >  1 file changed, 19 insertions(+), 1 deletion(-)
> > 
> > diff --git a/arm/aarch64/kvm.c b/arm/aarch64/kvm.c
> > index d03a27f2..4e66a22e 100644
> > --- a/arm/aarch64/kvm.c
> > +++ b/arm/aarch64/kvm.c
> > @@ -3,6 +3,7 @@
> >  #include <asm/image.h>
> >  
> >  #include <linux/byteorder.h>
> > +#include <kvm/util.h>
> >  
> >  /*
> >   * Return the TEXT_OFFSET value that the guest kernel expects. Note
> > @@ -59,5 +60,22 @@ int kvm__arch_get_ipa_limit(struct kvm *kvm)
> >  
> >  int kvm__get_vm_type(struct kvm *kvm)
> >  {
> > -	return KVM_VM_TYPE_ARM_IPA_SIZE(kvm__arch_get_ipa_limit(kvm));
> > +	unsigned int ipa_bits, max_ipa_bits;
> > +	unsigned long max_ipa;
> > +
> > +	/* If we're running on an old kernel, use 0 as the VM type */
> > +	max_ipa_bits = kvm__arch_get_ipa_limit(kvm);
> > +	if (!max_ipa_bits)
> > +		return 0;
> 
> Should this return KVM_VM_TYPE, as it does at the moment? Or is this
> more confusing than helpful?

I think that'd be really confusing. If you wanted a name, it really
should be something like KVM_LEGACY_40BIT_IPA_DONT_EVER_USE.

> 
> Just a nit anyway, the patch looks correct otherwise:
> 
> Reviewed-by: Andre Przywara <andre.przywara@arm.com>

Thanks,

	M.

-- 
Without deviation from the norm, progress is not possible.
_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

  reply	other threads:[~2021-08-26 11:11 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-22 15:25 [PATCH v2 0/3] kvmtool: Limit IPA space to what is actually required Marc Zyngier
2021-08-22 15:25 ` [PATCH v2 1/3] kvmtool: Abstract KVM_VM_TYPE into a weak function Marc Zyngier
2021-08-22 19:58   ` Oliver Upton
2021-08-22 15:25 ` [PATCH v2 2/3] kvmtool: arm64: Use the maximum supported IPA size when creating the VM Marc Zyngier
2021-08-22 20:03   ` Oliver Upton
2021-08-24  0:46   ` Andre Przywara
2021-08-22 15:25 ` [PATCH v2 3/3] kvmtool: arm64: Configure VM with the minimal required IPA space Marc Zyngier
2021-08-22 20:05   ` Oliver Upton
2021-08-23  9:36     ` Marc Zyngier
2021-08-23  9:43       ` Oliver Upton
2021-08-24  0:47   ` Andre Przywara
2021-08-26 11:11     ` Marc Zyngier [this message]
2021-08-31 15:05 ` [PATCH v2 0/3] kvmtool: Limit IPA space to what is actually required Will Deacon

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=871r6gpijt.wl-maz@kernel.org \
    --to=maz@kernel.org \
    --cc=andre.przywara@arm.com \
    --cc=kernel-team@android.com \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=will@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: 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