From: Will Deacon <will@kernel.org>
To: Dev Jain <dev.jain@arm.com>
Cc: Ryan Roberts <ryan.roberts@arm.com>,
catalin.marinas@arm.com, anshuman.khandual@arm.com,
quic_zhenhuah@quicinc.com, kevin.brodsky@arm.com,
yangyicong@hisilicon.com, joey.gouly@arm.com,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, david@redhat.com
Subject: Re: [PATCH v2] arm64: Enable vmalloc-huge with ptdump
Date: Wed, 11 Jun 2025 10:30:49 +0100 [thread overview]
Message-ID: <20250611093048.GA10885@willie-the-truck> (raw)
In-Reply-To: <1cf5e639-dcf8-492b-9164-493ee45cc0ac@arm.com>
On Wed, Jun 11, 2025 at 08:32:51AM +0530, Dev Jain wrote:
>
> On 11/06/25 12:30 am, Ryan Roberts wrote:
> > On 10/06/2025 17:00, Dev Jain wrote:
> > > arm64 disables vmalloc-huge when kernel page table dumping is enabled,
> > > because an intermediate table may be removed, potentially causing the
> > > ptdump code to dereference an invalid address. We want to be able to
> > > analyze block vs page mappings for kernel mappings with ptdump, so to
> > > enable vmalloc-huge with ptdump, synchronize between page table removal in
> > > pmd_free_pte_page()/pud_free_pmd_page() and ptdump pagetable walking. We
> > > use mmap_read_lock and not write lock because we don't need to synchronize
> > > between two different vm_structs; two vmalloc objects running this same
> > > code path will point to different page tables, hence there is no race.
> > >
> > > For pud_free_pmd_page(), we isolate the PMD table to avoid taking the lock
> > > 512 times again via pmd_free_pte_page(). Note that there is no need to
> > > move __flush_tlb_kernel_pgtable() to immediately after pud_clear(); the
> > > only argument against this would be that we immediately require a
> > > dsb(ishst) (present in __flush_tlb_kernel_pgtable()) after pud_clear(),
> > > but that is not the case, since the transition is from
> > > valid -> invalid, not vice-versa.
> > >
> > > No issues were observed with mm-selftests. No issues were observed while
> > > parallelly running test_vmalloc.sh and dumping the kernel pagetable through
> > > sysfs in a loop.
> > >
> > > v1->v2:
> > > - Take lock only when CONFIG_PTDUMP_DEBUGFS is on
> > I thought we agreed that we would use a static key and some rcu synchronize
> > magic? What was the reason for taking this approach?
>
> As I understand it, the RCU magic won't work, I had replied here:
> https://lore.kernel.org/all/6cd41ae9-303d-4eda-8d64-f7dba19eb106@arm.com/
Regardless, it's still not acceptable to penalise the common code because
of a debug option so I'm not going to merge this as-is.
Lemme go reply on the other thread.
Will
prev parent reply other threads:[~2025-06-11 14:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-10 16:00 [PATCH v2] arm64: Enable vmalloc-huge with ptdump Dev Jain
2025-06-10 19:00 ` Ryan Roberts
2025-06-11 3:02 ` Dev Jain
2025-06-11 9:30 ` Will Deacon [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250611093048.GA10885@willie-the-truck \
--to=will@kernel.org \
--cc=anshuman.khandual@arm.com \
--cc=catalin.marinas@arm.com \
--cc=david@redhat.com \
--cc=dev.jain@arm.com \
--cc=joey.gouly@arm.com \
--cc=kevin.brodsky@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=quic_zhenhuah@quicinc.com \
--cc=ryan.roberts@arm.com \
--cc=yangyicong@hisilicon.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox