linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Oliver Upton <oliver.upton@linux.dev>
To: Sebastian Ene <sebastianene@google.com>
Cc: will@kernel.org, James Morse <james.morse@arm.com>,
	Suzuki K Poulose <suzuki.poulose@arm.com>,
	Zenghui Yu <yuzenghui@huawei.com>,
	catalin.marinas@arm.com, mark.rutland@arm.com,
	akpm@linux-foundation.org, maz@kernel.org,
	kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, kernel-team@android.com,
	vdonnefort@google.com, qperret@google.com, smostafa@google.com
Subject: Re: [PATCH v3 00/10] arm64: ptdump: View the second stage page-tables
Date: Wed, 22 Nov 2023 23:18:45 +0000	[thread overview]
Message-ID: <ZV6MVYI8J6NFS9Wl@linux.dev> (raw)
In-Reply-To: <20231115171639.2852644-2-sebastianene@google.com>

Hi Seb,

On Wed, Nov 15, 2023 at 05:16:30PM +0000, Sebastian Ene wrote:
> Hi,
> 
> This can be used as a debugging tool for dumping the second stage
> page-tables.
> 
> When CONFIG_PTDUMP_STAGE2_DEBUGFS is enabled, ptdump registers 
> '/sys/debug/kvm/<guest_id>/stage2_page_tables' entry with debugfs
> upon guest creation. This allows userspace tools (eg. cat) to dump the
> stage-2 pagetables by reading the registered file.
> 
> Reading the debugfs file shows stage-2 memory ranges in following format:
> <IPA range> <size> <descriptor type> <access permissions> <mem_attributes>
> 
> Under pKVM configuration(kvm-arm.mode=protected) ptdump registers an entry
> for the host stage-2 pagetables in the following path:
> /sys/debug/kvm/host_stage2_page_tables/
> 
> The tool interprets the pKVM ownership annotation stored in the invalid
> entries and dumps to the console the ownership information. To be able
> to access the host stage-2 page-tables from the kernel, a new hypervisor
> call was introduced which allows us to snapshot the page-tables in a host
> provided buffer. The hypervisor call is hidden behind CONFIG_NVHE_EL2_DEBUG
> as this should be used under debugging environment.

While I think the value of the feature you're proposing is great, I'm
not a fan of the current shape of this series.

Reusing note_page() for the stage-2 dump is somewhat convenient, but the
series pulls a **massive** amount of KVM details outside of KVM:

 - Open-coding the whole snapshotting interface with EL2 outside of KVM.
   This is a complete non-starter for me; the kernel<->EL2 interface
   needs to be owned by the EL1 portions of KVM.

 - Building page-table walkers using the KVM pgtable library outside of
   KVM.

 - Copying (rather than directly calling) the logic responsible for
   things like FWB and PGD concatenation.

 - Hoisting the definition of _software bits_ outside of KVM. I'm less
   concerned about hardware bits since they have an unambiguous meaning.

I think exporting the necessary stuff from ptdump into KVM will lead to
a much cleaner implementation.

-- 
Thanks,
Oliver

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2023-11-22 23:19 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-15 17:16 [PATCH v3 00/10] arm64: ptdump: View the second stage page-tables Sebastian Ene
2023-11-15 17:16 ` [PATCH v3 01/10] KVM: arm64: Add snap shooting the host stage-2 pagetables Sebastian Ene
2023-11-21 14:12   ` Vincent Donnefort
2023-11-23 14:40     ` Sebastian Ene
2023-11-15 17:16 ` [PATCH v3 02/10] arm64: ptdump: Use the mask from the state structure Sebastian Ene
2023-11-15 17:16 ` [PATCH v3 03/10] arm64: ptdump: Add the walker function to the ptdump info structure Sebastian Ene
2023-11-15 17:16 ` [PATCH v3 04/10] KVM: arm64: Move pagetable definitions to common header Sebastian Ene
2023-11-15 17:16 ` [PATCH v3 05/10] arm64: ptdump: Add hooks on debugfs file operations Sebastian Ene
2023-11-22 14:36   ` Vincent Donnefort
2023-11-15 17:16 ` [PATCH v3 06/10] arm64: ptdump: Register a debugfs entry for the host stage-2 tables Sebastian Ene
2023-11-21 17:13   ` Vincent Donnefort
2023-11-23 14:48     ` Sebastian Ene
2023-11-15 17:16 ` [PATCH v3 07/10] arm64: ptdump: Parse the host stage-2 page-tables from the snapshot Sebastian Ene
2023-11-15 21:57   ` kernel test robot
2023-11-18 22:39   ` kernel test robot
2023-11-15 17:16 ` [PATCH v3 08/10] arm64: ptdump: Interpret memory attributes based on runtime configuration Sebastian Ene
2023-11-15 17:16 ` [PATCH v3 09/10] arm64: ptdump: Interpret pKVM ownership annotations Sebastian Ene
2023-11-15 17:16 ` [PATCH v3 10/10] arm64: ptdump: Add support for guest stage-2 pagetables dumping Sebastian Ene
2023-11-22 23:35   ` Oliver Upton
2023-11-23 10:58     ` Sebastian Ene
2023-11-22 23:18 ` Oliver Upton [this message]
2023-11-23  9:49   ` [PATCH v3 00/10] arm64: ptdump: View the second stage page-tables Sebastian Ene

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=ZV6MVYI8J6NFS9Wl@linux.dev \
    --to=oliver.upton@linux.dev \
    --cc=akpm@linux-foundation.org \
    --cc=catalin.marinas@arm.com \
    --cc=james.morse@arm.com \
    --cc=kernel-team@android.com \
    --cc=kvmarm@lists.linux.dev \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=maz@kernel.org \
    --cc=qperret@google.com \
    --cc=sebastianene@google.com \
    --cc=smostafa@google.com \
    --cc=suzuki.poulose@arm.com \
    --cc=vdonnefort@google.com \
    --cc=will@kernel.org \
    --cc=yuzenghui@huawei.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;
as well as URLs for NNTP newsgroup(s).