lkml.org 
[lkml]   [2023]   [Dec]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v4 10/10] arm64: ptdump: Add guest stage-2 pagetables dumping
On Mon, Dec 18, 2023 at 01:59:00PM +0000, Sebastian Ene wrote:
> Register a debugfs file on guest creation to be able to view their
> second translation tables with ptdump. This assumes that the host is in
> control of the guest stage-2 and has direct access to the pagetables.
>
> Signed-off-by: Sebastian Ene <sebastianene@google.com>

I couldn't see how this patched worked at all until I went back to patch
1 and found this:

> +static int kvm_ptdump_open(struct inode *inode, struct file *file)
> +{

[...]

> + if (!reg->show_ptdump_info)
> + reg->show_ptdump_info = kvm_ptdump_show;

[...]

> +}


> +static int kvm_ptdump_show(struct seq_file *m, void *)
> +{
> + struct kvm *guest_kvm = m->private;
> + struct kvm_s2_mmu *mmu = &guest_kvm->arch.mmu;
> + int ret;
> +
> + write_lock(&guest_kvm->mmu_lock);
> + ret = kvm_ptdump_show_common(m, mmu->pgt);
> + write_unlock(&guest_kvm->mmu_lock);
> +
> + return ret;
> +}

Where are you getting a reference on the kvm struct? You need to do this
to ensure the VM doesn't get destroyed behind your back.

--
Thanks,
Oliver

\
 
 \ /
  Last update: 2023-12-21 19:29    [W:0.096 / U:0.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site