From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-177.mta1.migadu.com (out-177.mta1.migadu.com [95.215.58.177]) (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 2B75140D58D for ; Thu, 18 Jun 2026 10:02:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781776931; cv=none; b=qts49GOKzDELlBeqRxpqg5+8tyO3FHUGeSB4u4upA5jgzm3uXruUP4bHcaBGnPYGB6tXFCpdCdv9YiVTnCYpmlcdnaNTKM7/gSxvsZdFu4ObuebNUhcE6FkTMZRLP5iXzvLDtyPoW/SoTHInAP4EjpT3L+PdNEqgUXUeWu+hc8o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781776931; c=relaxed/simple; bh=vVG4sCUZ9gIM9CtlGWS6D0aalQs37I2C/jNY4JDWYmQ=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=lciExnUPSRjc+bC7kaRq2Nm2Chx+yk8Uo/uuLnLWh4eCHStdZMCl3imvclj0xVztR/pf5mZVQITt2kEoyI3Gv2O57wO41jKWTw/R8OJEhXfOuPjPG6NxDpuCYyv57RsarCX5z1TKpemd8kqv0ULC2S+DECk1IJHw9Kr/FP8suIY= 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=sGjmNOWd; arc=none smtp.client-ip=95.215.58.177 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="sGjmNOWd" Message-ID: <22613c23-612b-4de0-8731-00ad2da63eae@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1781776925; 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=R16Ogh5jvmaUmgJr1ztCh+iI1i0epNMNlmxvIDVA/U4=; b=sGjmNOWdKUg2mfdWmssriggDsHQ5jiTV02hjScnP+E0ixPGuKgfuqytH/A1b6WV7VQdpEl oE9ZVeHD+/Q/+QfW+gQfnDG1XEA23RKulM2xNsxykh6KnOi6lLtcBJnV9Oo0Masi2Fup1r VY7UrwgQGpnhQrBEnsshlOKlf7GTIEM= Date: Thu, 18 Jun 2026 18:01:49 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH v4 02/12] mm/rmap: Add try_to_unmap_hugetlb_one Content-Language: en-US To: "David Hildenbrand (Arm)" , dev.jain@arm.com Cc: akpm@linux-foundation.org, ljs@kernel.org, chrisl@kernel.org, kasong@tencent.com, hughd@google.com, liam@infradead.org, riel@surriel.com, vbabka@kernel.org, harry@kernel.org, jannh@google.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, rppt@kernel.org, surenb@google.com, mhocko@suse.com, qi.zheng@linux.dev, shakeel.butt@linux.dev, baohua@kernel.org, axelrasmussen@google.com, yuanchu@google.com, weixugc@google.com, shikemeng@huaweicloud.com, nphamcs@gmail.com, bhe@redhat.com, youngjun.park@lge.com, baolin.wang@linux.alibaba.com, pfalcato@suse.de, ryan.roberts@arm.com, anshuman.khandual@arm.com References: <20260618074449.24974-1-lance.yang@linux.dev> <0fe2a584-c633-4f82-8c47-d204e3b39a57@linux.dev> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Lance Yang In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT On 2026/6/18 17:43, David Hildenbrand (Arm) wrote: > On 6/18/26 11:09, Lance Yang wrote: >> >> >> On 2026/6/18 15:55, David Hildenbrand (Arm) wrote: >>>>     return __rste_to_pte(pte_val(*ptep)); >>>> } >>>> >>>> >>>> So plain ptep_get() can feed raw huge-entry bits into pte_pfn(), and the >>>> derived subpage can be wrong. >>> >>> Good question which impact that might have in practice? >> >> The subpage check can warn, but we still pass that subpage to >> make_hwpoison_entry(). So the hwpoison marker can end up with the >> wrong PFN? >> >> +    subpage = folio_page(folio, pte_pfn(pteval) - folio_pfn(folio)); >> +    VM_WARN_ON(folio_page(folio, 0) != subpage); >> [...] >> +    pteval = swp_entry_to_pte(make_hwpoison_entry(subpage)); > > My s390x page table knowledge is a bit rusty. > > IIUC, it would be a problem if some PTE bits in segment/region entries (pmd/pud/ > ...) would pass the > > pte_pfn(x) -> (pte_val(x) >> PAGE_SHIFT) > > check. I don't think this applies, because > > While > #define _SEGMENT_ENTRY_ORIGIN_LARGE ~0xfffffUL > > We also have > > #define _SEGMENT_ENTRY_ORIGIN ~0x7ffUL > > So these bits are not actually used. > > What __rste_to_pte() primarily does is reshuffling present bits etc. > > So using any other bits besides the PFN would be problematic I guess. > > Am I wrong or isn't the present bit already at a different location? For > prot-none hugetlb folios there might be a real issue, as the PTE present bit > corresponds to the PMD/PUD read-permission bit. > > > Oh my :) > > So yeah, we should probably fix that ahead of time unless I am missing > something? Good that we separate that hugetlb crap out. Yeah, looks like this was already there before the split. Should this be fixed separately?