From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-170.mta0.migadu.com (out-170.mta0.migadu.com [91.218.175.170]) (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 7D86922D7B9 for ; Mon, 22 Jun 2026 08:14:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782116094; cv=none; b=r07cBDbK2YjbWnjbRl0lKX3Wq5IDiG/tv3DSZc4bsk7z+mUSBJ4hHpHiD3aNZXBAsz+px/LxdXFa31zgh1uRrafX1b4R6TbbjXw1SknUpFqTyX5f/Gb07cYso9+B//f68gtj9JAxzZQNZEqToqLCMM3+adD1DbnhWT9n4fWUBIM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782116094; c=relaxed/simple; bh=93ByyT8BapFfrpcin9680Hr6UtpIM4QcJCo8RD4U7n4=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=osMG3tSsTA4fe6RcAo8stwwVz7UtZw6DXz5CW6DrQdGXSeIUUWMmYRpjBdnbcvUZb8nWdRtWsHNki0X82WEsnRpi6UoKO8abVBRwRwl6O31aD4prB06nluLvh/wmGa+kblGo/+ju6yQZB4gzSDQVXsi+h7ZsCgs5BlBtC8HbFKE= 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=w4htQ3HE; arc=none smtp.client-ip=91.218.175.170 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="w4htQ3HE" Message-ID: <2021e00b-2943-479b-8309-4f6dc97131d7@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1782116090; 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=3h1tz/dJ9kRilDDcZ539pJ47xNMN6AhgjIhHbqlewzg=; b=w4htQ3HEU9Rzbt7I5wvpTk37qhZ+QsSfLijIP2mn8RiggNHxe8KlkxdI/KIYAsfFAHtqdZ rTrX+GtW4pCVWmyFKlInAc0NWeHhAJDgSVG5P2wSjn436VVa+rRrk/2iepmMUxHhzR5kYB 3fiYYqpHWQoHrjvy3mp0nP117HpmnEo= Date: Mon, 22 Jun 2026 16:14:35 +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: Dev Jain , "David Hildenbrand (Arm)" 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> <22613c23-612b-4de0-8731-00ad2da63eae@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/22 16:13, Dev Jain wrote: > > > On 18/06/26 3:31 pm, Lance Yang wrote: >> >> >> 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? > > Same bug is there in try_to_migrate_one(), check_pte(), remove_migration_pte() > and prot_none_hugetlb_entry() :) Oh my :)