From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 27164C35274 for ; Thu, 21 Dec 2023 18:28:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=SjJgbZiKqpbOJjcnUtHcEHPrMDDufnnRp0HZp9P6+74=; b=hVTmqAOKuUux24 J5xNU7e8uz6qb2f6vvxo1RGfPyqbYaiKkJOXHIWRG0KyrLb37WOrWNAvd6ZfEiPdgOpXqwy8CHx5w He5s2UY4sNEIzrtqZmCtaV/7uQ+y6ZC0SsDAfxLbPLK3fw9+IZoDDXtu4cXhKFJ3TYnj3fAKhP4aO UVyrFUuuKlfEe9h/Rbx9ACUQqPjveiXVd86xGKOdCP+aw4qa0arEFoB5IFutu3vmi1LVu0TP8G4Y+ izp4xyi4nNZYeq9i2XwXy8Uea3FAQihQh3+349ZujQcXaO3VvgpTYocpBe2YJV6xLisSm46S4TCY+ r62tBNHdQoglWI8xnU7w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rGNmF-003nhm-39; Thu, 21 Dec 2023 18:28:11 +0000 Received: from out-185.mta1.migadu.com ([95.215.58.185]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rGNmB-003ngl-2J for linux-arm-kernel@lists.infradead.org; Thu, 21 Dec 2023 18:28:09 +0000 Date: Thu, 21 Dec 2023 18:27:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1703183284; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=0jZW0b0lm5RMynnWmSejBR19+/LyL1/KkgZ6oIXL75I=; b=XRyh/wvgzvJPwABrAu1MA0OdmzIh1K33vCQXcnoSSO1C4xR6Xhl33pLhM8pHnqXvk4aiO3 5+00f0sGhR13/Qz44jmbdyy5wYNkM94B3BFz8FWYsoHBLKHy/I2QiUDNM3U3SBPQwMtOMp Rmemg1S1xZw5ePNCXP77oRWcc7y71/c= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Oliver Upton To: Sebastian Ene Cc: will@kernel.org, James Morse , Suzuki K Poulose , Zenghui Yu , 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 v4 10/10] arm64: ptdump: Add guest stage-2 pagetables dumping Message-ID: References: <20231218135859.2513568-2-sebastianene@google.com> <20231218135859.2513568-12-sebastianene@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20231218135859.2513568-12-sebastianene@google.com> X-Migadu-Flow: FLOW_OUT X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231221_102808_161728_30E7DC81 X-CRM114-Status: GOOD ( 13.29 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel