[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZYSDr9uYi3cUk_Jt@linux.dev>
Date: Thu, 21 Dec 2023 18:27:59 +0000
From: Oliver Upton <oliver.upton@...ux.dev>
To: Sebastian Ene <sebastianene@...gle.com>
Cc: will@...nel.org, James Morse <james.morse@....com>,
Suzuki K Poulose <suzuki.poulose@....com>,
Zenghui Yu <yuzenghui@...wei.com>, catalin.marinas@....com,
mark.rutland@....com, akpm@...ux-foundation.org, maz@...nel.org,
kvmarm@...ts.linux.dev, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org, kernel-team@...roid.com,
vdonnefort@...gle.com, qperret@...gle.com, smostafa@...gle.com
Subject: Re: [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@...gle.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
Powered by blists - more mailing lists