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 270EBC61D97 for ; Wed, 22 Nov 2023 23:19:30 +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=DL24IhR+k3nIWRAeSquYKfsU78PkVuY5BX3lMSkXlk4=; b=cj6ND4jsMr90BT TRRvSV9uR2j3+yK4tREv9Pz1WD7tzuBK1lm3YJL+QV8Np4N286RB9EdjejdNq49fTq6K4H4nfidIl BPyl/c1McYQKC5ZKdr8m/U5GpThhZ7hEMJxxJYcjlr+5J2KBt3X4rEuGFU27wUDgzi1BozFOigWid ZSkWCFym1eXPFerZ/yHqXMLCcZdL4K2tfe+EMI9WgdziCW4M0pfViOeUFgw7IsRhgDR7UYdjp2rwe JFnjpe7dua8QLgHeE4FFTj7dnA3vCueEqr+giTW0SnL80IZPQ+dIPsoPopjaj/zM5Ru+iPHn5gzWB Z9o+Y9c9ttld/Ck+GhLw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r5wUm-003Hl0-1o; Wed, 22 Nov 2023 23:19:00 +0000 Received: from out-171.mta0.migadu.com ([91.218.175.171]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r5wUj-003Hk2-0P for linux-arm-kernel@lists.infradead.org; Wed, 22 Nov 2023 23:18:58 +0000 Date: Wed, 22 Nov 2023 23:18:45 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1700695131; 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=JxXGMR68Ffnug5d1GsuemuN3GA7Qv3hraWikP3Qedyg=; b=EKGjeETg1FstPJI4IUIF9cjjTbqw4SiOzQYBToAG/PRyaM3apZI2VzkUQzsX64VhacLKYU McFbkQwAgzMlNjIHOG6MJ+5w7jqYHy/LCciVJ3Mit2qHGpRdkTGOSOpKVOycUXo7qdZXMC OhzwgUxs+eWT7kYTCw1de2PfeRGitOE= 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 v3 00/10] arm64: ptdump: View the second stage page-tables Message-ID: References: <20231115171639.2852644-2-sebastianene@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20231115171639.2852644-2-sebastianene@google.com> X-Migadu-Flow: FLOW_OUT X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231122_151857_319190_ABC5D90C X-CRM114-Status: GOOD ( 19.18 ) 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 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//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: > > > 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