From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-183.mta0.migadu.com (out-183.mta0.migadu.com [91.218.175.183]) (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 7B3B3331A5B for ; Tue, 7 Jul 2026 09:07:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.183 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783415261; cv=none; b=c62lo1P1P5M/Vyfhzgm1O7/BZkicYijSxYPlBbpV3RLNhLrq1wKn6eKVa4zLkJoKlNePPBQ0exyir1tnvaRDCYL0Ve1ZYrdY2yPb8jXlsMaAM5BkRTuPPSFnuIT2fI10NYOs7JW4gXPj1cDV+hFnD0v2I9MD3Rb5eilgEsozAPk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783415261; c=relaxed/simple; bh=7H2Q+ccG4FafJJxkZJDBFQuwYv3flmr6hejcrIk4ExI=; h=Content-Type:Mime-Version:Subject:From:In-Reply-To:Date:Cc: Message-Id:References:To; b=aOoOBV6X/WQ6oWzyAnJXhhW4peQzjZ+f65ukYve65Sx/ieQ+fM6ezKX5J+ABj2VJu5gbheQqkAuBUhnknAHGKAdcbfKnCO/hX9Ksx4YdhLDUgcHtthZWatO5Y/5lphc55A+KqEQj23Z1NY0970w41ujx/Dd4WkoGKIlLuAt+xGw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=xQXJCbKA; arc=none smtp.client-ip=91.218.175.183 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="xQXJCbKA" Content-Type: text/plain; charset=us-ascii DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1783415257; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xr6g3bVCDzcHhHO6pC/xBWOeuWudquosOcZYH5S6bcw=; b=xQXJCbKAWMmYOnxQ+DB6kohB54dGQKI+UC+Zllio7pzZV4FSW94xuJt3hYJTpHXgVaRur/ BGvqlZk/gjTX5rAcHSBfmQ2+RxaeRAouBb9E5+a5un9CxUL1x00wcLXjDcUQT+nMhL46YA YHD71ej/Jbe34Gdc2tJsgdDOvRYpkCA= Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3864.600.51.1.1\)) Subject: Re: [PATCH v5] mm/sparse-vmemmap: flush_cache_vmap() after hotplugging vmemmap X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Muchun Song In-Reply-To: <99eac2ba-a4e5-4885-aa81-b0c43f6fc4b2@iscas.ac.cn> Date: Tue, 7 Jul 2026 17:07:00 +0800 Cc: Alexandre Ghiti , Andrew Morton , David Hildenbrand , "Liam R. Howlett" , Lorenzo Stoakes , Michal Hocko , Mike Rapoport , Palmer Dabbelt , Paul Walmsley , Suren Baghdasaryan , Vlastimil Babka , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-riscv@lists.infradead.org Content-Transfer-Encoding: 7bit Message-Id: <77B0BBBA-0CDF-49F4-9B07-D35D0D864612@linux.dev> References: <20260707-mark-after-vmemmap-populate-v5-1-77d1ded3cae3@iscas.ac.cn> <99eac2ba-a4e5-4885-aa81-b0c43f6fc4b2@iscas.ac.cn> To: Vivian Wang X-Migadu-Flow: FLOW_OUT > On Jul 7, 2026, at 13:03, Vivian Wang wrote: > > Please disregard. I made a mistake while submitting this patch. > > I'll send a fixed v6 later. Sorry. Please fix issues reported by Sashiko excluding pre-existing ones. Thanks. > > On 7/7/26 12:10, 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. >> >> Extend the RISC-V flush_cache_vmap() to also handle the vmemmap range, >> and call it after hotplugging vmemmap, which gets the possible spurious >> fault handled in the exception handler. >> >> At least for now, the only other architecture with both >> SPARSEMEM_VMEMMAP and flush_cache_vmap() is PowerPC, which has a similar >> problem with newly valid PTEs. But there flush_cache_vmap() is just a >> ptesync. So it should be safe to do this for generic code while having >> minimal performance impact. >> >> Suggested-by: Muchun Song >> Signed-off-by: Vivian Wang >> --- > [...]