Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: Peter Xu <peterx@redhat.com>
Cc: kvm@vger.kernel.org, pbonzini@redhat.com
Subject: Re: [kvm-unit-tests PATCH v4 3/5] x86: move USERBASE to 32Mb in smap/pku/pks tests
Date: Thu, 31 Jul 2025 10:58:57 +0200	[thread overview]
Message-ID: <20250731105857.2cdb5c22@fedora> (raw)
In-Reply-To: <aIqG8nAB2kaH3Mjg@x1.local>

On Wed, 30 Jul 2025 16:56:18 -0400
Peter Xu <peterx@redhat.com> wrote:

> On Fri, Jul 25, 2025 at 11:54:27AM +0200, Igor Mammedov wrote:
> > If number of CPUs is increased up to 2048, it will push
> > available pages above 16Mb range and make smap/pku/pks
> > tests fail with 'Could not reserve memory' error.
> > 
> > Move pages used by tests to 32Mb to fix it.
> > 
> > Signed-off-by: Igor Mammedov <imammedo@redhat.com>  
> 
> Reviewed-by: Peter Xu <peterx@redhat.com>
> 
> > ---
> >  x86/pks.c  | 2 +-
> >  x86/pku.c  | 2 +-
> >  x86/smap.c | 2 +-
> >  3 files changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/x86/pks.c b/x86/pks.c
> > index f4d6ac83..9b9519ba 100644
> > --- a/x86/pks.c
> > +++ b/x86/pks.c
> > @@ -6,7 +6,7 @@
> >  #include "x86/msr.h"
> >  
> >  #define PTE_PKEY_BIT     59
> > -#define SUPER_BASE        (1 << 23)
> > +#define SUPER_BASE        (2 << 24)  
> 
> Nitpick: maybe 1<<25 would be easier to read.

I can try with, if I have to respin.

 
> Below are some random thoughts when reading these tests..
> 
> I'm not sure whether I understand them correctly here: all of them so far
> depend on the "test" var present in the .bss section, and they all assumed
> that the var's physical address (likely together with the whole .bss) will
> be under SUPER_BASE after loaded in the VM.
> 
> Based on that, there's yet another restriction versus the need to reserve
> (SUPER_BASE, SUPER_BASE*2), because the tests want to map the same (0,
> SUPER_BASE) memory twice in that virtual address range, so here the tests
> do not really need the phys pages in the back but kind of a way to reserve
> virtual addresses..
> 
> Instead of these tricks, I wonder whether we can do alloc_page() once, then
> put the test var on the page allocated.  Then we can build the required
> PKU/PKS/SMAP special pgtables on top, mapping to the page allocated.  It
> should make sure system changes (like growing num_cpus) never affect it
> anymore.
> 
> That (even if feasible.. or maybe I missed something) can definitely
> involve more changes, so not something to ask for on adding the hpet test /
> x2apic support.  Just some pure thoughts when reading it..

I had the same thoughts but I'm not confident enough to rewrite
those tests. Hence a knee-jerk reaction of just fixing up base
to unbreak affected test.

> 
> Thanks,
> 


  reply	other threads:[~2025-07-31  8:59 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-25  9:54 [kvm-unit-tests PATCH v4 0/5] x86: add HPET counter tests Igor Mammedov
2025-07-25  9:54 ` [kvm-unit-tests PATCH v4 1/5] x86: resize id_map[] elements to u32 Igor Mammedov
2025-07-30 20:39   ` Peter Xu
2025-07-25  9:54 ` [kvm-unit-tests PATCH v4 2/5] x86: fix APs with APIC ID more that 255 not showing in id_map Igor Mammedov
2025-07-30 20:40   ` Peter Xu
2025-07-25  9:54 ` [kvm-unit-tests PATCH v4 3/5] x86: move USERBASE to 32Mb in smap/pku/pks tests Igor Mammedov
2025-07-30 20:56   ` Peter Xu
2025-07-31  8:58     ` Igor Mammedov [this message]
2025-07-25  9:54 ` [kvm-unit-tests PATCH v4 4/5] x86: bump number of max cpus to 1024 Igor Mammedov
2025-07-30 20:56   ` Peter Xu
2025-07-25  9:54 ` [kvm-unit-tests PATCH v4 5/5] x86: add HPET counter read micro benchmark and enable/disable torture tests Igor Mammedov
2025-07-30 21:00   ` Peter Xu
2025-09-08  8:19 ` [kvm-unit-tests PATCH v4 0/5] x86: add HPET counter tests Igor Mammedov

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=20250731105857.2cdb5c22@fedora \
    --to=imammedo@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    /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