From: Ricardo Koller <ricarkol@google.com>
To: Sean Christopherson <seanjc@google.com>
Cc: kvm@vger.kernel.org, maz@kernel.org, bgardon@google.com,
andrew.jones@linux.dev, dmatlack@google.com, pbonzini@redhat.com,
axelrasmussen@google.com, kvmarm@lists.cs.columbia.edu
Subject: Re: [PATCH v7 08/13] KVM: selftests: Use the right memslot for code, page-tables, and data allocations
Date: Tue, 20 Sep 2022 11:57:12 -0700 [thread overview]
Message-ID: <YyoNCMmQ0cYzYQIy@google.com> (raw)
In-Reply-To: <YyoJA7gjEaSiGwFi@google.com>
On Tue, Sep 20, 2022 at 06:40:03PM +0000, Sean Christopherson wrote:
> On Tue, Sep 20, 2022, Ricardo Koller wrote:
> > On Tue, Sep 20, 2022 at 06:07:13PM +0000, Sean Christopherson wrote:
> > > On Tue, Sep 20, 2022, Ricardo Koller wrote:
> > > > The previous commit added support for callers of ____vm_create() to specify
> > >
> > > Changelog is stale, ____vm_create() no longer takes the struct.
> > >
> > > Side topic, it's usually a good idea to use "strong" terminology when referencing
> > > past/future changes, e.g. if patches get shuffled around for whatever reason,
> > > then "previous commit" may become stale/misleading.
> > >
> > > It's fairly easy to convey the same info ("something happened recently" or
> > > "something is going to happen soon") without being so explicit, e.g.
> > >
> > > Wire up common code to use the appropriate code, page table, and data
> > > memmslots that were recently added instead of hardcoding '0' for the
> > > memslot.
> > >
> > > or
> > >
> > > Now that kvm_vm allows specifying different memslots for code, page
> > > tables, and data, use the appropriate memslot when making allocations
> > > in common/libraty code.
> > >
> > > > what memslots to use for code, page-tables, and data allocations. Change
> > > > them accordingly:
> > > >
> > > > - stacks, code, and exception tables use the code memslot
> > >
> > > Huh? Stacks and exceptions are very much data, not code.
> > >
> >
> > I would *really* like to have the data region only store test data. It
> > makes things easier for the test implementation, like owning the whole
> > region.
>
> That's fine, but allocating stack as "code" is super confusing.
>
> > At the same I wanted to have a single region for all the "core pages" like
> > code, descriptors, exception tables, stacks, etc. Not sure what to call it
> > though.
>
> Why? Code is very different than all those other things. E.g. the main reason
> KVM doesn't provide "not-executable" or "execute-only" memslots is because there's
> never been a compelling use case, not because it's difficult to implement. If KVM
> were to ever add such functionality, then we'd want/need selftests to have a
> dedicated code memslot.
>
> > So, what about one of these 2 options:
> >
> > Option A: 3 regions, where we call the "code" region something else, like
> > "core".
> > Option B: 4 regions: code, page-tables, core-data (stacks, exception tables, etc),
> > test-data.
>
> I like (B), though I'd just call 'em "DATA" and "TEST_DATA". IIUC, TEST_DATA is
> the one you want to be special, i.e. it's ok if something that's not "core" allocates
> in DATA, but it's not ok if "core" allocates in TEST_DATA. That yields an easy
> to understand "never use TEST_DATA" rule for library/common/core functionality,
> with the code vs. page tables vs. data decision (hopefully) being fairly obvious.
>
> Defining CORE_DATA will force developers to make judgement calls and probably
> lead to bikeshedding over whether something is considered "core" code.
Sounds good, Option B then (with code, pt, data, test-data).
Thanks,
Ricardo
_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
WARNING: multiple messages have this Message-ID (diff)
From: Ricardo Koller <ricarkol@google.com>
To: Sean Christopherson <seanjc@google.com>
Cc: kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu,
andrew.jones@linux.dev, pbonzini@redhat.com, maz@kernel.org,
alexandru.elisei@arm.com, eric.auger@redhat.com,
oupton@google.com, reijiw@google.com, rananta@google.com,
bgardon@google.com, dmatlack@google.com,
axelrasmussen@google.com, Oliver Upton <oliver.upton@linux.dev>
Subject: Re: [PATCH v7 08/13] KVM: selftests: Use the right memslot for code, page-tables, and data allocations
Date: Tue, 20 Sep 2022 11:57:12 -0700 [thread overview]
Message-ID: <YyoNCMmQ0cYzYQIy@google.com> (raw)
In-Reply-To: <YyoJA7gjEaSiGwFi@google.com>
On Tue, Sep 20, 2022 at 06:40:03PM +0000, Sean Christopherson wrote:
> On Tue, Sep 20, 2022, Ricardo Koller wrote:
> > On Tue, Sep 20, 2022 at 06:07:13PM +0000, Sean Christopherson wrote:
> > > On Tue, Sep 20, 2022, Ricardo Koller wrote:
> > > > The previous commit added support for callers of ____vm_create() to specify
> > >
> > > Changelog is stale, ____vm_create() no longer takes the struct.
> > >
> > > Side topic, it's usually a good idea to use "strong" terminology when referencing
> > > past/future changes, e.g. if patches get shuffled around for whatever reason,
> > > then "previous commit" may become stale/misleading.
> > >
> > > It's fairly easy to convey the same info ("something happened recently" or
> > > "something is going to happen soon") without being so explicit, e.g.
> > >
> > > Wire up common code to use the appropriate code, page table, and data
> > > memmslots that were recently added instead of hardcoding '0' for the
> > > memslot.
> > >
> > > or
> > >
> > > Now that kvm_vm allows specifying different memslots for code, page
> > > tables, and data, use the appropriate memslot when making allocations
> > > in common/libraty code.
> > >
> > > > what memslots to use for code, page-tables, and data allocations. Change
> > > > them accordingly:
> > > >
> > > > - stacks, code, and exception tables use the code memslot
> > >
> > > Huh? Stacks and exceptions are very much data, not code.
> > >
> >
> > I would *really* like to have the data region only store test data. It
> > makes things easier for the test implementation, like owning the whole
> > region.
>
> That's fine, but allocating stack as "code" is super confusing.
>
> > At the same I wanted to have a single region for all the "core pages" like
> > code, descriptors, exception tables, stacks, etc. Not sure what to call it
> > though.
>
> Why? Code is very different than all those other things. E.g. the main reason
> KVM doesn't provide "not-executable" or "execute-only" memslots is because there's
> never been a compelling use case, not because it's difficult to implement. If KVM
> were to ever add such functionality, then we'd want/need selftests to have a
> dedicated code memslot.
>
> > So, what about one of these 2 options:
> >
> > Option A: 3 regions, where we call the "code" region something else, like
> > "core".
> > Option B: 4 regions: code, page-tables, core-data (stacks, exception tables, etc),
> > test-data.
>
> I like (B), though I'd just call 'em "DATA" and "TEST_DATA". IIUC, TEST_DATA is
> the one you want to be special, i.e. it's ok if something that's not "core" allocates
> in DATA, but it's not ok if "core" allocates in TEST_DATA. That yields an easy
> to understand "never use TEST_DATA" rule for library/common/core functionality,
> with the code vs. page tables vs. data decision (hopefully) being fairly obvious.
>
> Defining CORE_DATA will force developers to make judgement calls and probably
> lead to bikeshedding over whether something is considered "core" code.
Sounds good, Option B then (with code, pt, data, test-data).
Thanks,
Ricardo
next prev parent reply other threads:[~2022-09-20 18:57 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-20 4:25 [PATCH v7 00/13] KVM: selftests: Add aarch64/page_fault_test Ricardo Koller
2022-09-20 4:25 ` Ricardo Koller
2022-09-20 4:25 ` [PATCH v7 01/13] KVM: selftests: Add a userfaultfd library Ricardo Koller
2022-09-20 4:25 ` Ricardo Koller
2022-09-20 4:25 ` [PATCH v7 02/13] KVM: selftests: aarch64: Add virt_get_pte_hva() library function Ricardo Koller
2022-09-20 4:25 ` Ricardo Koller
2022-09-20 4:25 ` [PATCH v7 03/13] KVM: selftests: Add missing close and munmap in __vm_mem_region_delete() Ricardo Koller
2022-09-20 4:25 ` Ricardo Koller
2022-09-20 4:25 ` [PATCH v7 04/13] KVM: selftests: aarch64: Construct DEFAULT_MAIR_EL1 using sysreg.h macros Ricardo Koller
2022-09-20 4:25 ` Ricardo Koller
2022-09-20 4:25 ` [PATCH v7 05/13] tools: Copy bitfield.h from the kernel sources Ricardo Koller
2022-09-20 4:25 ` Ricardo Koller
2022-09-20 4:25 ` [PATCH v7 06/13] KVM: selftests: Stash backing_src_type in struct userspace_mem_region Ricardo Koller
2022-09-20 4:25 ` Ricardo Koller
2022-09-20 4:25 ` [PATCH v7 07/13] KVM: selftests: Add vm->memslots[] and enum kvm_mem_region_type Ricardo Koller
2022-09-20 4:25 ` Ricardo Koller
2022-09-20 7:50 ` Andrew Jones
2022-09-20 7:50 ` Andrew Jones
2022-09-20 17:39 ` Sean Christopherson
2022-09-20 17:39 ` Sean Christopherson
2022-09-20 17:49 ` Ricardo Koller
2022-09-20 17:49 ` Ricardo Koller
2022-09-20 4:25 ` [PATCH v7 08/13] KVM: selftests: Use the right memslot for code, page-tables, and data allocations Ricardo Koller
2022-09-20 4:25 ` Ricardo Koller
2022-09-20 7:51 ` Andrew Jones
2022-09-20 7:51 ` Andrew Jones
2022-09-20 18:07 ` Sean Christopherson
2022-09-20 18:07 ` Sean Christopherson
2022-09-20 18:23 ` Ricardo Koller
2022-09-20 18:23 ` Ricardo Koller
2022-09-20 18:40 ` Sean Christopherson
2022-09-20 18:40 ` Sean Christopherson
2022-09-20 18:57 ` Ricardo Koller [this message]
2022-09-20 18:57 ` Ricardo Koller
2022-09-20 4:25 ` [PATCH v7 09/13] KVM: selftests: aarch64: Add aarch64/page_fault_test Ricardo Koller
2022-09-20 4:25 ` Ricardo Koller
2022-09-20 8:05 ` Andrew Jones
2022-09-20 8:05 ` Andrew Jones
2022-09-20 17:13 ` Ricardo Koller
2022-09-20 17:13 ` Ricardo Koller
2022-09-20 4:25 ` [PATCH v7 10/13] KVM: selftests: aarch64: Add userfaultfd tests into page_fault_test Ricardo Koller
2022-09-20 4:25 ` Ricardo Koller
2022-09-20 4:25 ` [PATCH v7 11/13] KVM: selftests: aarch64: Add dirty logging " Ricardo Koller
2022-09-20 4:25 ` Ricardo Koller
2022-09-20 4:25 ` [PATCH v7 12/13] KVM: selftests: aarch64: Add readonly memslot " Ricardo Koller
2022-09-20 4:25 ` Ricardo Koller
2022-09-20 4:25 ` [PATCH v7 13/13] KVM: selftests: aarch64: Add mix of " Ricardo Koller
2022-09-20 4:25 ` Ricardo Koller
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=YyoNCMmQ0cYzYQIy@google.com \
--to=ricarkol@google.com \
--cc=andrew.jones@linux.dev \
--cc=axelrasmussen@google.com \
--cc=bgardon@google.com \
--cc=dmatlack@google.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=maz@kernel.org \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.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 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.