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 29140409106 for ; Thu, 28 May 2026 18:29:57 +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=1779992999; cv=none; b=Yp0zs+gAAAZOUkfDxOUWNPdX2LsW0xkIb4Cb72XpZbh3XFKXlfroL5CPeDXikLfB0bPW4kwTRr0iSLnVgjFlnQ2vuhoj81UVd9k09UiqMvpWlmYEMxN99pgzOOszfVhadFAlMi6EDeoz5Sc+AUBTY4D190ckNr6zMcPRXUdvx4Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779992999; c=relaxed/simple; bh=LNxGskT7dyg2MBIUCt1ULESM2mz5+jGKBjxBmdo9OnE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=OvHNaJjcPcdcSyRQiFXS8axMRrvAfskArW7tBBXOMRGn76pAi9vmY6vxuavS8lvCDieqJr+OLmONm4Il4c0Tj2dfmWg46lTjYGgJicbbj6mki3Robyp37TvI0wsCSCsojAs61IZK1ZigLcSolCFjbpc0Aw29t4jx/QMalDSrbc4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=YFlOu+HX; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="YFlOu+HX" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EAC731F00A3A; Thu, 28 May 2026 18:29:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1779992997; bh=JHxKrIHeJU3sg/edF3r6NX4gBETjgiw9TNGEvxgUQ+8=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=YFlOu+HXNnoQN8osREHhda3zNvyEmCHgTYqcncUKosWfmD+px7Ymz8SFtRN9Rv9+H HVcRn246+bojhY1DZyqr3V4hF7qxxHO8KkZ+l4xXwdEaw6VH2i1cLCd6ehe8B3PBDR E6eRaLE7p8SbWJrdIjsUvOKwRP4rUzDapwe/plLo+65fEBC3gSf0gY2xhzaYaH47HL JC2STC/QXl684fjHMolOiLg4BnvBN/h2l63wnhUobASDryQrUdBoLbRkj6kD+KIeAx Ev1Gs2nsPLGFjg5g3BYsxABclg8VdZL0ztl0Tj9Vp1uNYrps9hZCCcmUNU2NMdjXNJ Pl4PPLCS3UKzQ== Date: Thu, 28 May 2026 20:29:51 +0200 From: "Oscar Salvador (SUSE)" To: Borislav Petkov Cc: Dave Hansen , Karsten Desler , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Thomas Gleixner , Ingo Molnar , Dave Hansen , "H. Peter Anvin" Subject: Re: [REGRESSION] x86/hugetlb: AMD F15h VA alignment offset breaks MAP_HUGETLB alignment Message-ID: References: <20260527143643.GO31091@soohrt.org> <5f70e840-9d0e-4cef-8574-b355cf26e0c4@intel.com> <20260528153118.GBahhfxo0BmTjX72Qr@fat_crate.local> 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-Disposition: inline In-Reply-To: <20260528153118.GBahhfxo0BmTjX72Qr@fat_crate.local> On Thu, May 28, 2026 at 08:31:18AM -0700, Borislav Petkov wrote: > On Thu, May 28, 2026 at 04:03:12PM +0200, Oscar Salvador (SUSE) wrote: > > On Thu, May 28, 2026 at 02:45:01PM +0200, Oscar Salvador (SUSE) wrote: > > > The only thing bugging is, should not the same happen for THP-file-backed mappings? > > > > Aha, no, for THP we do not set align_mask (at least on x86), and the masking off is being > > done in __thp_get_unmapped_area(). > > I hope you found this in the proces: > > dfb09f9b7ab0 ("x86, amd: Avoid cache aliasing penalties on AMD family 15h") Ei Boris, thanks for pointing it out. Actually, checking the other arches that have their own get_align_mask() for setting the mask (s390 and sparc), they both skip info.align_offset if we are dealing with hugetlb, e.g: s390: info.align_mask = get_align_mask(filp, flags); if (!(filp && is_file_hugepages(filp))) info.align_offset = pgoff << PAGE_SHIFT; So, maybe for the time being we can do the same in x86 in order to fix the regression (although the refactoring is 2 years old and first time we heard about it was yesterday) and then we can think of a nicer way to handle this in non-arch code so s390 and sparc would get cleaned up as well. Thoughts? -- Oscar Salvador SUSE Labs