From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-171.mta1.migadu.com (out-171.mta1.migadu.com [95.215.58.171]) (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 5D3201F1537 for ; Sat, 4 Jul 2026 02:43:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783133013; cv=none; b=EvfdwKk3iQvt7QkApdWSWi3CgMF4etvdLK3gpCL1TWoywLD9+GjH05lSkK8haCcnb8vN/98CNuFJS/T3BL/lm7hXRxl8+l83CrDOAHbvFUXWsmRSkT8sVoZYkCWPuyGMiX5ShYuAZvJPotVHLVPunchL/n9L6RmofG5EgkwhLuE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783133013; c=relaxed/simple; bh=y/w2//o9tLFu8D1YyHGm3x2nl7TT2wWydLVFSqS1msQ=; h=Content-Type:Mime-Version:Subject:From:In-Reply-To:Date:Cc: Message-Id:References:To; b=CAn/8xW1KTwJjU0R3n0aXptvjvfVyi8JDXRqA5w1PMH6WNTWwDCxs+DIHjNjA0SMnT7qRl+TvVIubP3wZ1Lk+F95Urbk13neZ/PMXQCaPri/e6XbofkbE/pcLpXDy/RjDkJTThTS3OATdjg6F1vL7iGH26QBwRK/Yb3gbAAC+z0= 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=Z6AXqHVA; arc=none smtp.client-ip=95.215.58.171 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="Z6AXqHVA" Content-Type: text/plain; charset=us-ascii DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1783133008; 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=y/w2//o9tLFu8D1YyHGm3x2nl7TT2wWydLVFSqS1msQ=; b=Z6AXqHVA+9nAVYfSa3QbdfPfvb43qNaCDbGVGpDJitxEZRu/+WHXiZt1uJm2m9gWRYnLBn rrMBGuwNRW8WoE+9qA6G/xghPUPVLiysithLQ4EAtBTx6p4nsscEq1kQqKczHWOE40wXsn Q29B2m+VxuTz6Z/bm0e5ix4C/1bn3MQ= 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 v3 1/6] arm64: make huge_ptep_get handled unaligned addresses X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Muchun Song In-Reply-To: <20260703114202.365553-2-dev.jain@arm.com> Date: Sat, 4 Jul 2026 10:42:45 +0800 Cc: osalvador@suse.de, akpm@linux-foundation.org, ljs@kernel.org, david@kernel.org, liam@infradead.org, riel@surriel.com, vbabka@kernel.org, harry@kernel.org, jannh@google.com, lance.yang@linux.dev, kas@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, apopple@nvidia.com, rcampbell@nvidia.com, ziy@nvidia.com, matthew.brost@intel.com, joshua.hahnjy@gmail.com, rakie.kim@sk.com, byungchul@sk.com, gourry@gourry.net, ying.huang@linux.alibaba.com, ak@linux.intel.com, nao.horiguchi@gmail.com, mel@csn.ul.ie, j-nomura@ce.jp.nec.com, pfalcato@suse.de, tglx@kernel.org, dave.hansen@intel.com, jpoimboe@kernel.org, catalin.marinas@arm.com, will@kernel.org, linux-arm-kernel@lists.infradead.org, ryan.roberts@arm.com, anshuman.khandual@arm.com, stable@vger.kernel.org Content-Transfer-Encoding: quoted-printable Message-Id: <58500686-A4A0-45FD-872D-AB0EE2AD2ACC@linux.dev> References: <20260703114202.365553-1-dev.jain@arm.com> <20260703114202.365553-2-dev.jain@arm.com> To: Dev Jain X-Migadu-Flow: FLOW_OUT > On Jul 3, 2026, at 19:41, Dev Jain wrote: >=20 > huge_ptep_get() can be handed a virtual address pointing to the middle = of > a contpmd/contpte mapped hugetlb folio (examples of callers are > pagemap_hugetlb_range, page_mapped_in_vma). >=20 > The arm64 helper rewalks the pgtables in find_num_contig to answer = whether > the huge pte we have maps a contpmd or a contpte hugetlb folio, and > returns CONT_PMDS or CONT_PTES, so that it can collect a/d bits over = the > contiguous ptes. We can falsely return CONT_PTES instead of CONT_PMDS > if the addr is not aligned. >=20 > Fix this by aligning the pmdp pointer down to a contpmd base before > checking equality with the passed huge pte pointer, to correctly = answer > whether the huge pte is the base of a contpmd block. >=20 > Fixes: 29cb80519689 ("arm64: hugetlb: Cleanup huge_pte size discovery = mechanisms") > Cc: stable@vger.kernel.org > Acked-by: David Hildenbrand (Arm) > Signed-off-by: Dev Jain Acked-by: Muchun Song Thanks.