From: Oscar Salvador <osalvador@suse.de>
To: "Björn Töpel" <bjorn@kernel.org>
Cc: "Albert Ou" <aou@eecs.berkeley.edu>,
"Alexandre Ghiti" <alexghiti@rivosinc.com>,
"Chethan Seshadri" <Chethan.Seshadri@catalinasystems.io>,
"David Hildenbrand" <david@redhat.com>,
linux-kernel@vger.kernel.org,
"Andrew Bresticker" <abrestic@rivosinc.com>,
"Björn Töpel" <bjorn@rivosinc.com>,
"Santosh Mamila" <santosh.mamila@catalinasystems.io>,
linux-mm@kvack.org,
"Sivakumar Munnangi" <siva.munnangi@catalinasystems.io>,
"Palmer Dabbelt" <palmer@dabbelt.com>,
"Paul Walmsley" <paul.walmsley@sifive.com>,
linux-riscv@lists.infradead.org,
virtualization@lists.linux-foundation.org,
"Lorenzo Stoakes" <lstoakes@gmail.com>
Subject: Re: [PATCH v2 5/8] riscv: mm: Take memory hotplug read-lock during kernel page table dump
Date: Tue, 14 May 2024 23:03:39 +0200 [thread overview]
Message-ID: <ZkPRq5zca7PGsqwJ@localhost.localdomain> (raw)
In-Reply-To: <20240514140446.538622-6-bjorn@kernel.org>
On Tue, May 14, 2024 at 04:04:43PM +0200, Björn Töpel wrote:
> From: Björn Töpel <bjorn@rivosinc.com>
>
> During memory hot remove, the ptdump functionality can end up touching
> stale data. Avoid any potential crashes (or worse), by holding the
> memory hotplug read-lock while traversing the page table.
>
> This change is analogous to arm64's commit bf2b59f60ee1 ("arm64/mm:
> Hold memory hotplug lock while walking for kernel page table dump").
>
> Signed-off-by: Björn Töpel <bjorn@rivosinc.com>
Reviewed-by: Oscar Salvador <osalvador@suse.de>
funny enough, it seems arm64 and riscv are the only ones holding the
hotplug lock here.
I think we have the same problem on the other arches as well (at least
on x86_64 that I can see).
If we happen to finally need the lock in those, I would rather have a
centric function in the generic mm code with the locking and then
calling an arch specific ptdump_show function, so the lock is not
scattered. But that is another story.
--
Oscar Salvador
SUSE Labs
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
WARNING: multiple messages have this Message-ID (diff)
From: Oscar Salvador <osalvador@suse.de>
To: "Björn Töpel" <bjorn@kernel.org>
Cc: "Alexandre Ghiti" <alexghiti@rivosinc.com>,
"Albert Ou" <aou@eecs.berkeley.edu>,
"David Hildenbrand" <david@redhat.com>,
"Palmer Dabbelt" <palmer@dabbelt.com>,
"Paul Walmsley" <paul.walmsley@sifive.com>,
linux-riscv@lists.infradead.org,
"Björn Töpel" <bjorn@rivosinc.com>,
"Andrew Bresticker" <abrestic@rivosinc.com>,
"Chethan Seshadri" <Chethan.Seshadri@catalinasystems.io>,
"Lorenzo Stoakes" <lstoakes@gmail.com>,
"Santosh Mamila" <santosh.mamila@catalinasystems.io>,
"Sivakumar Munnangi" <siva.munnangi@catalinasystems.io>,
"Sunil V L" <sunilvl@ventanamicro.com>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
virtualization@lists.linux-foundation.org
Subject: Re: [PATCH v2 5/8] riscv: mm: Take memory hotplug read-lock during kernel page table dump
Date: Tue, 14 May 2024 23:03:39 +0200 [thread overview]
Message-ID: <ZkPRq5zca7PGsqwJ@localhost.localdomain> (raw)
In-Reply-To: <20240514140446.538622-6-bjorn@kernel.org>
On Tue, May 14, 2024 at 04:04:43PM +0200, Björn Töpel wrote:
> From: Björn Töpel <bjorn@rivosinc.com>
>
> During memory hot remove, the ptdump functionality can end up touching
> stale data. Avoid any potential crashes (or worse), by holding the
> memory hotplug read-lock while traversing the page table.
>
> This change is analogous to arm64's commit bf2b59f60ee1 ("arm64/mm:
> Hold memory hotplug lock while walking for kernel page table dump").
>
> Signed-off-by: Björn Töpel <bjorn@rivosinc.com>
Reviewed-by: Oscar Salvador <osalvador@suse.de>
funny enough, it seems arm64 and riscv are the only ones holding the
hotplug lock here.
I think we have the same problem on the other arches as well (at least
on x86_64 that I can see).
If we happen to finally need the lock in those, I would rather have a
centric function in the generic mm code with the locking and then
calling an arch specific ptdump_show function, so the lock is not
scattered. But that is another story.
--
Oscar Salvador
SUSE Labs
next prev parent reply other threads:[~2024-05-14 21:03 UTC|newest]
Thread overview: 68+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-14 14:04 [PATCH v2 0/8] riscv: Memory Hot(Un)Plug support Björn Töpel
2024-05-14 14:04 ` Björn Töpel
2024-05-14 14:04 ` [PATCH v2 1/8] riscv: mm: Pre-allocate vmemmap/direct map PGD entries Björn Töpel
2024-05-14 14:04 ` Björn Töpel
2024-05-14 15:57 ` Alexandre Ghiti
2024-05-14 15:57 ` Alexandre Ghiti
2024-05-14 16:33 ` Björn Töpel
2024-05-14 16:33 ` Björn Töpel
2024-05-14 14:04 ` [PATCH v2 2/8] riscv: mm: Change attribute from __init to __meminit for page functions Björn Töpel
2024-05-14 14:04 ` Björn Töpel
2024-05-14 15:59 ` David Hildenbrand
2024-05-14 15:59 ` David Hildenbrand
2024-05-14 17:17 ` Alexandre Ghiti
2024-05-14 17:17 ` Alexandre Ghiti
2024-05-14 17:45 ` Björn Töpel
2024-05-14 17:45 ` Björn Töpel
2024-05-14 20:32 ` Oscar Salvador
2024-05-14 20:32 ` Oscar Salvador
2024-05-15 5:39 ` Björn Töpel
2024-05-15 5:39 ` Björn Töpel
2024-05-14 14:04 ` [PATCH v2 3/8] riscv: mm: Refactor create_linear_mapping_range() for memory hot add Björn Töpel
2024-05-14 14:04 ` Björn Töpel
2024-05-14 16:00 ` David Hildenbrand
2024-05-14 16:00 ` David Hildenbrand
2024-05-14 17:24 ` Alexandre Ghiti
2024-05-14 17:24 ` Alexandre Ghiti
2024-05-14 20:37 ` Oscar Salvador
2024-05-14 20:37 ` Oscar Salvador
2024-05-14 14:04 ` [PATCH v2 4/8] riscv: mm: Add memory hotplugging support Björn Töpel
2024-05-14 14:04 ` Björn Töpel
2024-05-14 16:04 ` David Hildenbrand
2024-05-14 16:04 ` David Hildenbrand
2024-05-14 16:34 ` Björn Töpel
2024-05-14 16:34 ` Björn Töpel
2024-05-14 17:49 ` Alexandre Ghiti
2024-05-14 17:49 ` Alexandre Ghiti
2024-05-14 19:31 ` Björn Töpel
2024-05-14 19:31 ` Björn Töpel
2024-05-14 20:49 ` Oscar Salvador
2024-05-14 20:49 ` Oscar Salvador
2024-05-15 5:41 ` Björn Töpel
2024-05-15 5:41 ` Björn Töpel
2024-05-14 14:04 ` [PATCH v2 5/8] riscv: mm: Take memory hotplug read-lock during kernel page table dump Björn Töpel
2024-05-14 14:04 ` Björn Töpel
2024-05-14 20:39 ` David Hildenbrand
2024-05-14 20:39 ` David Hildenbrand
2024-05-14 21:03 ` Oscar Salvador [this message]
2024-05-14 21:03 ` Oscar Salvador
2024-05-14 14:04 ` [PATCH v2 6/8] riscv: Enable memory hotplugging for RISC-V Björn Töpel
2024-05-14 14:04 ` Björn Töpel
2024-05-14 18:00 ` Alexandre Ghiti
2024-05-14 18:00 ` Alexandre Ghiti
2024-05-14 18:17 ` Björn Töpel
2024-05-14 18:17 ` Björn Töpel
2024-05-14 18:41 ` Alexandre Ghiti
2024-05-14 18:41 ` Alexandre Ghiti
2024-05-14 20:40 ` David Hildenbrand
2024-05-14 20:40 ` David Hildenbrand
2024-05-14 21:06 ` Oscar Salvador
2024-05-14 21:06 ` Oscar Salvador
2024-05-14 14:04 ` [PATCH v2 7/8] virtio-mem: Enable virtio-mem " Björn Töpel
2024-05-14 14:04 ` Björn Töpel
2024-05-14 15:58 ` David Hildenbrand
2024-05-14 15:58 ` David Hildenbrand
2024-05-14 14:04 ` [PATCH v2 8/8] riscv: mm: Add support for ZONE_DEVICE Björn Töpel
2024-05-14 14:04 ` Björn Töpel
2024-05-15 7:03 ` Björn Töpel
2024-05-15 7:03 ` Björn Töpel
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=ZkPRq5zca7PGsqwJ@localhost.localdomain \
--to=osalvador@suse.de \
--cc=Chethan.Seshadri@catalinasystems.io \
--cc=abrestic@rivosinc.com \
--cc=alexghiti@rivosinc.com \
--cc=aou@eecs.berkeley.edu \
--cc=bjorn@kernel.org \
--cc=bjorn@rivosinc.com \
--cc=david@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-riscv@lists.infradead.org \
--cc=lstoakes@gmail.com \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=santosh.mamila@catalinasystems.io \
--cc=siva.munnangi@catalinasystems.io \
--cc=virtualization@lists.linux-foundation.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.