From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 91BDCD5CC8E for ; Wed, 30 Oct 2024 10:59:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 06D296B00AC; Wed, 30 Oct 2024 06:59:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F3AC26B00AE; Wed, 30 Oct 2024 06:59:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DD8846B00AF; Wed, 30 Oct 2024 06:59:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id BA0196B00AC for ; Wed, 30 Oct 2024 06:59:01 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 62356ABE1C for ; Wed, 30 Oct 2024 10:59:01 +0000 (UTC) X-FDA: 82729970148.19.6BD1750 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf24.hostedemail.com (Postfix) with ESMTP id C6DF4180011 for ; Wed, 30 Oct 2024 10:58:55 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf24.hostedemail.com: domain of catalin.marinas@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=catalin.marinas@arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1730285809; a=rsa-sha256; cv=none; b=056bunnuyNqAgfa2b+pC/6rHkBr2XR0Gztdga6yBRCb8l1mSYMKqrOZypQVZt63Yt/tC82 VMcnrOJJKBStgQYchNa5LJLzTJcC6v8B7rduyc3LRWQKs1lsksSkEcGDxDqwvrhmlYnQ2I 07sRkQVtzmahglgEcB0goBmlTNdHO4M= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf24.hostedemail.com: domain of catalin.marinas@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=catalin.marinas@arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1730285809; h=from:from:sender: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: in-reply-to:in-reply-to:references:references; bh=rx5hEGYhCwnjcrEUXNXiqNpuEw2e9+Lp7xuRkMHf/O8=; b=Sfilnot6xfPFIxkn7qqmZkbnsil4lUHWJ3cYdXNX+5FlB6EYvI8xQEjuj7Ggkczx+PRLms +5tRAW9GJb69JJEZZNG9W0UEq4zNe6fiAPFET/zU0aLVC0yhmbpMOddUtmdyY16ZkvMn0Q khL3Uc75wgzn1C8rKEz0FuFtfqqga84= Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 408BF113E; Wed, 30 Oct 2024 03:59:28 -0700 (PDT) Received: from arm.com (RQ4T19M611.cambridge.arm.com [10.1.32.47]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B9D703F66E; Wed, 30 Oct 2024 03:58:55 -0700 (PDT) Date: Wed, 30 Oct 2024 10:58:53 +0000 From: Catalin Marinas To: Vlastimil Babka Cc: Lorenzo Stoakes , Andrew Morton , "Liam R . Howlett" , Jann Horn , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Linus Torvalds , Peter Xu , Will Deacon , Mark Brown , "David S . Miller" , Andreas Larsson , "James E . J . Bottomley" , Helge Deller , Yang Shi Subject: Re: [PATCH hotfix 6.12 v4 4/5] mm: refactor arch_calc_vm_flag_bits() and arm64 MTE handling Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: C6DF4180011 X-Stat-Signature: 63547dciz597o1si7b16hzcmjni9urtn X-Rspam-User: X-HE-Tag: 1730285935-381555 X-HE-Meta: U2FsdGVkX1+lZitaJpr7Dbzt0d0fJAHhQJfNzeNBUTf8AHEjBN0oTOqoooWCyCefyhzdny+F/5+MwLCxrn6btcTNJbfXATE+vjOir3FurmjPLpwZwHzGmekfsRQZhY4xtTdsHR6cZTx3HDk+5t4OJXoZCufr7DeKFNqbOgAqxDqp1jeAuEK+RJPlNhwSye/Yc7NbXjb1H0vGSJqRQz2Jkdi1PYWa8e3bpTm47ZOzATUq86vEYoahXe2nkhkrHV2kOPgDKTN4L9lRR0Hxv0x4l/YQsCOmMjsYhKu5V0KYqjnIlIm4YnFW+rrKP8cUUPDpU2aKOIT7qg6W8i+rYZrTAZbbJ/G9/KKD9wTrb+HtTNa09laSZtANlERTLo6tYa4XlmMIHAH33pDTDmBcind2FL/R3BY8OScqydfbKOd77LU94MyMNQGYas3DfnP/2fJFLKa37aTipDOSfxK2X3SQF7mmRA9vQxlxOUvzkWfqNjk9RlvC7IxDuGVUidQoB053MeXQxNuRmBHprsH5weTN/U5et3zRHariOlRgsD8Mh7xDkI6WN8hrqcn2u1IYTtOLD7l4+LL7ueqWIAD6vkL8RLYLT8vvV5VnlkmAOYVGKoYbu5Ce1FWTsZP1nXDq/XFotLRN5GWDyfgGastn760cwS0zx4rGho/44MHSBztIJ4DezB/T82s8WgRfxpthnLTa5yXkcm9URkDKqBJxfW00HCu6AVY9g4xkBjQiYV0qYcGA/phgpK/TwoT+/0h9ckHheRDykTbpXpKpnAvSSNz4UlMU9PQLzj+npuCHcnwBewBcb2NRGw787hDIwH9jBS9VhPD7bzxGYU1zXw9Pfauw79V1ObdDgJVAdeGFu4uOJ4MyN3BcDalVizqEfB6JSMwY0vROUErZEAzDOqvL2vW1OynRcR2n7hMFUxy+qOXRoR6hsyIyAGnTDyOyMv6qUjKpvVGho0/nJApUU6fy+wW FrLwz12x SZZRv6moFUdVSL40DG7hprCOwQDGkgv+Gggl7zqvA04ksprIXBoP6hv4UgANUF0G7WI3Nvbn18WoBuvYYBsvm2QuBjbKw5HBkxLyqBC4G9HrDsea0Gd7P31ciBE8BoCRUQ3xX5NHLsGinzBDvgMwCRa+X/anuA4EpJ2pVx8OhapWVKMP/wInDESQV0wbk5nULaXYL X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Wed, Oct 30, 2024 at 10:18:27AM +0100, Vlastimil Babka wrote: > On 10/29/24 19:11, Lorenzo Stoakes wrote: > > --- a/arch/arm64/include/asm/mman.h > > +++ b/arch/arm64/include/asm/mman.h > > @@ -6,6 +6,8 @@ > > > > #ifndef BUILD_VDSO > > #include > > +#include > > +#include > > #include > > > > static inline unsigned long arch_calc_vm_prot_bits(unsigned long prot, > > @@ -31,19 +33,21 @@ static inline unsigned long arch_calc_vm_prot_bits(unsigned long prot, > > } > > #define arch_calc_vm_prot_bits(prot, pkey) arch_calc_vm_prot_bits(prot, pkey) > > > > -static inline unsigned long arch_calc_vm_flag_bits(unsigned long flags) > > +static inline unsigned long arch_calc_vm_flag_bits(struct file *file, > > + unsigned long flags) > > { > > /* > > * Only allow MTE on anonymous mappings as these are guaranteed to be > > * backed by tags-capable memory. The vm_flags may be overridden by a > > * filesystem supporting MTE (RAM-based). > > We should also eventually remove the last sentence or even replace it with > its negation, or somebody might try reintroducing the pattern that won't > work anymore (wasn't there such a hugetlbfs thing in -next?). I agree, we should update this comment as well though as a fix this patch is fine for now. There is indeed a hugetlbfs change in -next adding VM_MTE_ALLOWED. It should still work after the above change but we'd need to move it over here (and fix the comment at the same time). We'll probably do it around -rc1 or maybe earlier once this fix hits mainline. I don't think we have an equivalent of shmem_file() for hugetlbfs, we'll need to figure something out. > > */ > > - if (system_supports_mte() && (flags & MAP_ANONYMOUS)) > > + if (system_supports_mte() && > > + ((flags & MAP_ANONYMOUS) || shmem_file(file))) > > return VM_MTE_ALLOWED; > > > > return 0; > > } This will conflict with the arm64 for-next/core tree as it's adding a MAP_HUGETLB check. Trivial resolution though, Stephen will handle it. -- Catalin