From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 354BC371D14 for ; Wed, 1 Jul 2026 04:11:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782879068; cv=none; b=OZLmUESYnmHDXTvMReVzdrJeAedm0au6B0owk67TmzldvZZzVvCaVLjRN6h7oOnP+qeVBJSUigtDFxywTQAO7a95rWUIArTjljWDzypE5nxVJeWNZjMFkihdoA7Nq7pT+5Dwgac11QHJiqxpZNwne5qPbLOwbHqctCIGLijqKy4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782879068; c=relaxed/simple; bh=x69GYTGkrvkQGFVu8E64465Ma4dpJ9D1SAgMTrMbbQw=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=Qi8OrGxZTA6E3pj+aScK1OT8ODhC1HqwR9VEtTJF7onW6M1Rky1uzjf3jEAPaEvuaTuCFaM/g/Dmqfth79x2cd16O3OCYx2C/fHqVgbDQJvDvJWGGzlc44edlICA2r3DS/I4Ze53FtHkhEY73/1Mp9pcu4xGVdKGsWmD5GS5z+U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=GPyx1cYE; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="GPyx1cYE" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 526721F000E9; Wed, 1 Jul 2026 04:11:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=korg; t=1782879061; bh=TXA8RlSa/ySOffaRQxajF3YzcMmO1kdzghoHZdVSV3A=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=GPyx1cYEKJXIKV2oq2tH///hWtfrI2LnBlc9oEs9czLfviIheJ0WakRy7pxhmwoa6 L3A0DfYu8AyFzvushJmVn/Q0ptLbJJVE7m2kTIkSXaFlyCsYpnzOoJQ1+zVgFvxw0R 9dpQfQdRyU82Lg0GvjvkzkLry+R1IJeHv8ld2mW4= Date: Tue, 30 Jun 2026 21:11:00 -0700 From: Andrew Morton To: Vivian Wang Cc: Paul Walmsley , Palmer Dabbelt , Alexandre Ghiti , David Hildenbrand , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v4] riscv: mm: Avoid spurious fault after hotplugging vmemmap Message-Id: <20260630211100.5c8f09c607595fbb5bca0a74@linux-foundation.org> In-Reply-To: <20260630-mark-after-vmemmap-populate-v4-1-febbc15da028@iscas.ac.cn> References: <20260630-mark-after-vmemmap-populate-v4-1-febbc15da028@iscas.ac.cn> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Tue, 30 Jun 2026 15:51:59 +0800 Vivian Wang wrote: > section_activate() does not flush TLB after populating new vmemmap > pages. On most architectures, this is okay. However it is a problem on > RISC-V since there the TLB caching non-present entries is permitted, > which causes spurious faults on some hardwares. > > This seems to be most easily reproduced with DEBUG_VM=y and > PAGE_POISONING=y, which causes these newly mapped struct pages to be > poisoned i.e. written to immediately after mapping. > > Add a hook vmemmap_populate_finalize() in __populate_section_memmap() > after population, to allow architectures to handle such situations as > needed. Then implement it on RISC-V to arrange for the existing > exception handler code to deal with these faults if they happen. Thanks, I'll get this into linux-next for some testing exposure. I'd of course prefer that the riscv maintainers review and merge this, or I can upstream it with their ack? btw, AI review suggests that there's a missing barrier in there (a pre-existing thing) https://sashiko.dev/#/patchset/20260630-mark-after-vmemmap-populate-v4-1-febbc15da028@iscas.ac.cn