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 4FC1DCD13CF for ; Mon, 2 Sep 2024 07:09:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=dH+gKZniEI3v7+0LpRiy8ASOw0/wvRv4BM3n+1kO5jw=; b=S6rTBWIK6I6CkyvWXzM4v9pbIO U9mkvIJMVvSqdrclwH141c4XPCDuceVaE3AJqEpN/jYOVCQEy1S4hPGS5Bh9UVSiCBDPKwSjpBZ5d gqwH5rP+igAffFE1XRfh5qcqZ2FRCm/SDULZULQVl3SD9fLJg4uLujtuYYmQJyiZIpiM5j1QxYsZz CnVZzVyXQy6QfMH+7TQMb7yicpqnRrwU7dOhNoIZEhP7e3bLVBDZjR99HWpIElopywzvurc6uHkGm zvJfwhHSTTUeSv/I52stRIjq7ve3Uj6miCvU2mOJMlt1rp1bJG0l94hzqVmLZKmbdo1QG2hIh1nIq jOFusjjw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sl1Bj-0000000DER2-3Ocn; Mon, 02 Sep 2024 07:09:23 +0000 Received: from mail-ed1-x52c.google.com ([2a00:1450:4864:20::52c]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sl1Aq-0000000DEEi-2K05 for linux-arm-kernel@lists.infradead.org; Mon, 02 Sep 2024 07:08:29 +0000 Received: by mail-ed1-x52c.google.com with SMTP id 4fb4d7f45d1cf-5c24374d8b6so9524a12.1 for ; Mon, 02 Sep 2024 00:08:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1725260907; x=1725865707; darn=lists.infradead.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=dH+gKZniEI3v7+0LpRiy8ASOw0/wvRv4BM3n+1kO5jw=; b=C8Q49A6Ix6ZgR+J7EIvXT9IGvDQeRfjlSC8QtwJQjl+wcqepArYPgpBX2E5U0cJbFh IaS1uwuGV0CQ4C+1X+SgCFLrdmCXB6/LKg2IWmg5wZyT/S8JI1NWzjDKp8HhVsDB2Gok AmFbzFjcWt8WF8lKDFWraVCFnNbeRywjVybi9/eouinsCvHaon8UEIzhdb6oAq5QrVFc LKqS7kg/jlULcoUcla1SObbH+HttL8N39bwn3mQIiUIw+sxjN0uIzaC2HO1yZkBQ8ApM JZfmg2ez9XJV2z2aE1T3Nk9HXaKV3V/XPD9GFnj2XhrfmDYMgCSxbRM/Gk73bZZLTusM sWhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725260907; x=1725865707; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=dH+gKZniEI3v7+0LpRiy8ASOw0/wvRv4BM3n+1kO5jw=; b=YisA2h+H1JsyWbhohUCeD8vmnj6vt3283W05pcTyLsPlT7qoRBqa3BuNbPsX4wh/9r 3ayFNqJncYEJ7TKLWuTu+CK/SdvU/rVM6Dg8+/blJn4BU/J4WRJO/yHeM/YnprNuhsBg k5dnjdLOpKZFykZmLVVy3oVSei/V22aoWXrOjcW5oNVpuI3ziIlHV1LDPD2lSnhg6GQU l+Ivquw/F3e5xfo0D3B8oKEmznoRBkBlPrWC1u43Ue+huva/96eZ4O6+yqO8rAs6rvyF KmYDhIUxykK9QPQLycrWy9DKGh3SBfHeaSEsFVTkxfbiwwZ9dclxot1DANFa5gfdInQE h4QA== X-Forwarded-Encrypted: i=1; AJvYcCVu09oY9oNKpU+sqr1LWc3YPtc6/QQAqz/nxr9RDGvpX22yUH4HqQEmJ3v3Yxu4ZEcCUc7JCoYr8NwzdNWoqOi7@lists.infradead.org X-Gm-Message-State: AOJu0Yyh/LLEXshLwzsvrik9jYzw/fteY4F5ilEIXmm6lcBxNUP99Ln5 rNT31PC8Y47fpwbfMWaqiRm/28gluBZoDpk9xRTWCpBmDyJoHbLrkfgpLGO9Ug== X-Google-Smtp-Source: AGHT+IFoF66DMu3YJdmK/srN6fY+dEN2koeeRQ0q+8VZVMngCsfM3z7RwNnlHbO5MRJO6ZKoo5r/kg== X-Received: by 2002:a05:6402:5188:b0:5c2:5641:af79 with SMTP id 4fb4d7f45d1cf-5c25641afb6mr61789a12.0.1725260906279; Mon, 02 Sep 2024 00:08:26 -0700 (PDT) Received: from google.com (44.232.78.34.bc.googleusercontent.com. [34.78.232.44]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42ba641dad0sm161741835e9.30.2024.09.02.00.08.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Sep 2024 00:08:25 -0700 (PDT) Date: Mon, 2 Sep 2024 07:08:24 +0000 From: Sebastian Ene To: Marc Zyngier Cc: akpm@linux-foundation.org, alexghiti@rivosinc.com, ankita@nvidia.com, ardb@kernel.org, catalin.marinas@arm.com, christophe.leroy@csgroup.eu, james.morse@arm.com, vdonnefort@google.com, mark.rutland@arm.com, oliver.upton@linux.dev, rananta@google.com, ryan.roberts@arm.com, shahuang@redhat.com, suzuki.poulose@arm.com, will@kernel.org, yuzenghui@huawei.com, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kernel-team@android.com Subject: Re: [PATCH v9 0/5] arm64: ptdump: View the second stage page-tables Message-ID: References: <20240827084549.45731-1-sebastianene@google.com> <864j72vzmw.wl-maz@kernel.org> <8634mmvyx0.wl-maz@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240902_000828_617196_89550C45 X-CRM114-Status: GOOD ( 30.43 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Sep 02, 2024 at 06:11:04AM +0000, Sebastian Ene wrote: > On Fri, Aug 30, 2024 at 04:00:11PM +0100, Marc Zyngier wrote: > > On Fri, 30 Aug 2024 15:44:39 +0100, > > Marc Zyngier wrote: Hello Marc, I tried with a 16Kb host under VHE on Qemu starting a 4kb guest with kvmtool: root@seb-qemu-pkvm-host:~# zcat /proc/config.gz | grep "CONFIG_ARM64_[164K]*_PAGES=y" CONFIG_ARM64_16K_PAGES=y root@seb-qemu-pkvm-host:~# cat /sys/kernel/debug/kvm/263-4/stage2* 2 ---[ Guest IPA ]--- 0x0000000000000000-0x0000000001020000 16512K 3 0x0000000001020000-0x0000000001024000 16K 3 R W X AF 0x0000000001024000-0x0000000002000000 16240K 3 0x0000000002000000-0x0000000080000000 2016M 2 0x0000000080000000-0x0000000084000000 64M 2 R W AF BLK 0x0000000084000000-0x000000008e000000 160M 2 0x000000008e000000-0x0000000090000000 32M 2 R W AF BLK 0x0000000090000000-0x0000000098000000 128M 2 0x0000000098000000-0x000000009a000000 32M 2 R W X AF BLK 0x000000009a000000-0x000000009c000000 32M 2 R W AF BLK This looks quite right I guess and I wonder how can I repro what you are seeing ? What kvm-arm.mode is the host running into ? Thanks, Seb > > Hello Marc, > > > > > > > Hi Seb, > > > > [...] > > > > > I've been giving this a go on my test systems with 16k pages, and it > > > doesn't really work as advertised: > > > > > > root@babette:/sys/kernel/debug/kvm# cat 2573-13/stage2_* > > > 2 > > > ---[ Guest IPA ]--- > > > 0x0000000000000000-0x0000000008000000 128M > > > 0x0000000008000000-0x00000000090a0000 17024K 3 > > > 0x00000000090a0000-0x00000000090a4000 16K 3 R W X AF > > > 0x00000000090a4000-0x000000000a000000 15728K 3 > > > > > > Only 16kB mapped? This is a full Linux guest running the Debian > > > installer, and just the kernel is about 20MB (the VM has 4GB of RAM, > > > and is using QEMU as the VMM) > > > > > > So clearly something isn't playing as expected. Also, this '128M' > > > without a level being displayed makes me wonder. It is probably the > > > QEMU flash, but then the rest of the addresses don't make much sense > > > (RAM on QEMU is at 1GB, not at 128MB. > > > > > > On another system with kvmtool, I get something similar: > > > > > > root@duodenum:/home/maz# cat /sys/kernel/debug/kvm/*/stage2_* > > > 2 > > > ---[ Guest IPA ]--- > > > 0x0000000000000000-0x0000000001020000 16512K 3 > > > 0x0000000001020000-0x0000000001024000 16K 3 R W X AF > > > 0x0000000001024000-0x0000000002000000 16240K 3 > > > > > > and kvmtool places the RAM at 2GB. Clearly not what we're seeing here. > > > > > > Could you please verify this? > > Ughh, this doesn't look right. I will give it a spin with a different > granule, thanks for bringing me to attention. I will look first at > mm/ptdump.c if it works as intended. > > > > > > For the record, on a 4kB host, I get much more plausible results: > > > > root@big-leg-emma:/home/maz# cat /sys/kernel/debug/kvm/632-12/stage2_* > > 3 > > ---[ Guest IPA ]--- > > 0x0000000000000000-0x0000000000200000 2M 2 R AF BLK > > 0x0000000000200000-0x0000000040000000 1022M 2 > > 0x0000000040000000-0x0000000040200000 2M 2 R W X AF BLK > > 0x0000000040200000-0x0000000044000000 62M 2 > > 0x0000000044000000-0x0000000044200000 2M 2 R W X AF BLK > > 0x0000000044200000-0x0000000047600000 52M 2 > > 0x0000000047600000-0x0000000047800000 2M 2 R W AF BLK > > 0x0000000047800000-0x0000000047e00000 6M 2 R W X AF BLK > > 0x0000000047e00000-0x0000000048000000 2M 2 R W AF BLK > > 0x0000000048000000-0x00000000b9c00000 1820M 2 > > 0x00000000b9c00000-0x00000000b9e00000 2M 2 R W X AF BLK > > 0x00000000b9e00000-0x00000000bb800000 26M 2 > > 0x00000000bb800000-0x00000000bba00000 2M 2 R W X AF BLK > > 0x00000000bba00000-0x00000000bbe00000 4M 2 R W AF BLK > > 0x00000000bbe00000-0x00000000bc200000 4M 2 R W X AF BLK > > 0x00000000bc200000-0x00000000bc800000 6M 2 R W AF BLK > > 0x00000000bc800000-0x00000000be400000 28M 2 > > 0x00000000be400000-0x00000000bf800000 20M 2 R W X AF BLK > > 0x00000000bf800000-0x00000000bfe00000 6M 2 R W AF BLK > > 0x00000000bfe00000-0x00000000c0000000 2M 2 R W X AF BLK > > > > So 16kB is the one that needs investigating, and I strongly suspect > > that 64kB is in the same boat... > > > > Thanks, > > > > M. (signing off for the day) > > > > Thanks, > Sebastian > > > -- > > Without deviation from the norm, progress is not possible.