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 A6A08C77B7C for ; Wed, 25 Jun 2025 06:08:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3616C6B00A5; Wed, 25 Jun 2025 02:08:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 311BD6B00A8; Wed, 25 Jun 2025 02:08:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1B29B6B00AB; Wed, 25 Jun 2025 02:08:41 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 040346B00A5 for ; Wed, 25 Jun 2025 02:08:41 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 8E3981A181F for ; Wed, 25 Jun 2025 06:08:40 +0000 (UTC) X-FDA: 83592894000.07.DE0EF51 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf11.hostedemail.com (Postfix) with ESMTP id B68E840002 for ; Wed, 25 Jun 2025 06:08:38 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=none; spf=pass (imf11.hostedemail.com: domain of anshuman.khandual@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=anshuman.khandual@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1750831719; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rs5qv26zbhZgpGvpN9RH2fv1bA62+llFCmQW4ABeOto=; b=3Y32gENdVcGqncRAqQMVHz3Ua5Tr04d6IM+bXmeH9kl6CpJeSqlpLDpjNdr6U/XT38DxTw y6PkfiRTHxoY6rKaWQiwuhiTiwJmHAsDJCHxYyf8EOSQYpNlpEoGITyPElXuJaCO+FU6DF 38Rpf0uM2C6X0FRG7CgBp+EzfCr3BuE= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1750831719; a=rsa-sha256; cv=none; b=edEGbAcCIra1Jm+wlDelFdY5XRt+1dQguFHyaAXs+75s7XJI4de3UQax3VF+fPq8DAbyPv 0NRa1kh5BMXCqDJTCbiTkCuYkCUmogoas/1lI9P+iT5Z0vjRT3uKKvXrsHJ07gnVTpWP94 LcAYemXiIdYNrxtLBdK1inL6J1cvxJ0= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=none; spf=pass (imf11.hostedemail.com: domain of anshuman.khandual@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=anshuman.khandual@arm.com; dmarc=pass (policy=none) header.from=arm.com 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 6B278106F; Tue, 24 Jun 2025 23:08:19 -0700 (PDT) Received: from [10.164.146.16] (J09HK2D2RT.blr.arm.com [10.164.146.16]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 448623F63F; Tue, 24 Jun 2025 23:08:18 -0700 (PDT) Message-ID: <52e6b931-3371-4adc-a680-add7413ab71c@arm.com> Date: Wed, 25 Jun 2025 11:38:15 +0530 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 3/3] mm: update architecture and driver code to use vm_flags_t To: Lorenzo Stoakes , Andrew Morton Cc: Russell King , Catalin Marinas , Will Deacon , Madhavan Srinivasan , Michael Ellerman , Nicholas Piggin , Christophe Leroy , "David S . Miller" , Andreas Larsson , Jarkko Sakkinen , Dave Hansen , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H . Peter Anvin" , Andy Lutomirski , Peter Zijlstra , Alexander Viro , Christian Brauner , Jan Kara , Kees Cook , Peter Xu , David Hildenbrand , Zi Yan , Baolin Wang , "Liam R . Howlett" , Nico Pache , Ryan Roberts , Dev Jain , Barry Song , Xu Xin , Chengming Zhou , Hugh Dickins , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Rik van Riel , Harry Yoo , Dan Williams , Matthew Wilcox , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Jason Gunthorpe , John Hubbard , Muchun Song , Oscar Salvador , Jann Horn , Pedro Falcato , Johannes Weiner , Qi Zheng , Shakeel Butt , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, kvm@vger.kernel.org, sparclinux@vger.kernel.org, linux-sgx@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, nvdimm@lists.linux.dev, linux-trace-kernel@vger.kernel.org References: Content-Language: en-US From: Anshuman Khandual In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: B68E840002 X-Stat-Signature: fu865pyxad7ez8mecof975dw738kcncj X-Rspam-User: X-HE-Tag: 1750831718-17742 X-HE-Meta: U2FsdGVkX188AH02G4XyDpizIwWEvxY/lRqsa2IebIyhvIiTFGpynKMtTkSlQKWulZh8Gc3y21yFXiugNkzV5re1mR97C1jbYHstNFDxq4eiOqKuDe0offf39D1xG7DfwnlUzOEIYXcaRYxATQvF3bapU+/XMLWhsNSKWCTfBe5MJsmnyGpCwhPKob448Fd9jklnUTbRwDW2gTrv7RC4w+dkilrB0pd8BW/kH6yeNcH79shGTawXnhEs0kkYkau5T95ML3XLK/CaQm6rOHs7o+BB6jGMPHt1o09Q2WkktiNiKOWt4E2Ok1AG3dROKMtZIOw/I15bR1E9a1shp0sB8zIQ43YSV8D5lWCgfkYL/VRuJtEAD+nm3VrTAqKhvIV7vpomsy1u4VqzI6EMZ2ozAgUJErDBMt/5cgvQniijViCs+1/2hUlUeCtIosN6oVtR8xjGpiuLZsiK+H6wBESIakkerAgpSVXRUce1BZEIZL44omcYZSoh0L9hyoQMUUN0q12b1KR5eZiRQ8l2wzdAJEneyd4vGv6+FAB6UGqQ5fu2F4MWLNBOp9K+O6+K/TYluEm1+lKH+ET3ewgXErqMzHKUm7G9gGKS8zdsI5PP+hCfUiY+RAh/zDvaNqnMLFl92SYV3SYNrkjtf9+YhrLj9psOZ5qiG2xGUO8Q7vq/Sfqjz4nla+5TXx2ZpgBazRav+D7dnocpUKoCjU3Yuk66IDOFPIH3SPTSbTR8rUr/rxstF0a4Vk1N2cc7bgchxVhus8FvIcAPM2o6yW5NCqRgX3pBav2t3bnHn89btoaKiIKM1fitwAzW92GILhNbbE4fgKamdgDESPm320/zoD9Bz/0ciUGHLMUk5IMnFgBIGDS7gVcK8oDzH5/slB4MIFQ1+bDSiEoI8GfyonG5RaawPm/Tu1xZDxnRQsH0ZWgFOwRFqmcaIXHudCStBVZrAYYlXPUFJRZraPhsL+N1hW2 RuPvJV6d vWAH3r77ki6AQt0fJHrmAGyVEJg8tQym1z+mWzxijh7hAXk0shFaPdhnt3epywnO7M4QbcbRxBZINN3q4Olb6Nie9/aMD54rendfbGbzftTHEuJ+HsHQP0YlpTzRqgl1/lynAmlOeUoWlMMzqNe48QRozoXN92tsAODi5XMxfTNEKbmvOB6nuO1fJwUCMp9Csuycu8+jE3PdJK2FHfFw0/onVFD3JBSNt8IROHdyLUSrD3w38wJhts2/PHYFedF1DJ5msCXoy59ePHLEiFxnUqmsI6CBUNMiopnMo0tPXZAxHTqPVp520qEl0uA== 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 19/06/25 1:12 AM, Lorenzo Stoakes wrote: > In future we intend to change the vm_flags_t type, so it isn't correct for > architecture and driver code to assume it is unsigned long. Correct this > assumption across the board. > > Overall, this patch does not introduce any functional change. > > Signed-off-by: Lorenzo Stoakes > --- > arch/arm/mm/fault.c | 2 +- > arch/arm64/include/asm/mman.h | 10 +++++----- > arch/arm64/mm/fault.c | 2 +- > arch/arm64/mm/mmu.c | 2 +- > arch/powerpc/include/asm/mman.h | 2 +- > arch/powerpc/include/asm/pkeys.h | 4 ++-- > arch/powerpc/kvm/book3s_hv_uvmem.c | 2 +- > arch/sparc/include/asm/mman.h | 4 ++-- > arch/x86/kernel/cpu/sgx/encl.c | 8 ++++---- > arch/x86/kernel/cpu/sgx/encl.h | 2 +- > tools/testing/vma/vma_internal.h | 2 +- > 11 files changed, 20 insertions(+), 20 deletions(-) > > diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c > index ab01b51de559..46169fe42c61 100644 > --- a/arch/arm/mm/fault.c > +++ b/arch/arm/mm/fault.c > @@ -268,7 +268,7 @@ do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs) > int sig, code; > vm_fault_t fault; > unsigned int flags = FAULT_FLAG_DEFAULT; > - unsigned long vm_flags = VM_ACCESS_FLAGS; > + vm_flags_t vm_flags = VM_ACCESS_FLAGS; > > if (kprobe_page_fault(regs, fsr)) > return 0; > diff --git a/arch/arm64/include/asm/mman.h b/arch/arm64/include/asm/mman.h > index 21df8bbd2668..8770c7ee759f 100644 > --- a/arch/arm64/include/asm/mman.h > +++ b/arch/arm64/include/asm/mman.h > @@ -11,10 +11,10 @@ > #include > #include > > -static inline unsigned long arch_calc_vm_prot_bits(unsigned long prot, > +static inline vm_flags_t arch_calc_vm_prot_bits(unsigned long prot, > unsigned long pkey) > { > - unsigned long ret = 0; > + vm_flags_t ret = 0; > > if (system_supports_bti() && (prot & PROT_BTI)) > ret |= VM_ARM64_BTI; > @@ -34,8 +34,8 @@ 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(struct file *file, > - unsigned long flags) > +static inline vm_flags_t arch_calc_vm_flag_bits(struct file *file, > + unsigned long flags) > { > /* > * Only allow MTE on anonymous mappings as these are guaranteed to be > @@ -68,7 +68,7 @@ static inline bool arch_validate_prot(unsigned long prot, > } > #define arch_validate_prot(prot, addr) arch_validate_prot(prot, addr) > > -static inline bool arch_validate_flags(unsigned long vm_flags) > +static inline bool arch_validate_flags(vm_flags_t vm_flags) > { > if (system_supports_mte()) { > /* > diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c > index ec0a337891dd..24be3e632f79 100644 > --- a/arch/arm64/mm/fault.c > +++ b/arch/arm64/mm/fault.c > @@ -549,7 +549,7 @@ static int __kprobes do_page_fault(unsigned long far, unsigned long esr, > const struct fault_info *inf; > struct mm_struct *mm = current->mm; > vm_fault_t fault; > - unsigned long vm_flags; > + vm_flags_t vm_flags; > unsigned int mm_flags = FAULT_FLAG_DEFAULT; > unsigned long addr = untagged_addr(far); > struct vm_area_struct *vma; > diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c > index 8fcf59ba39db..248d96349fd0 100644 > --- a/arch/arm64/mm/mmu.c > +++ b/arch/arm64/mm/mmu.c > @@ -720,7 +720,7 @@ void mark_rodata_ro(void) > > static void __init declare_vma(struct vm_struct *vma, > void *va_start, void *va_end, > - unsigned long vm_flags) > + vm_flags_t vm_flags) > { > phys_addr_t pa_start = __pa_symbol(va_start); > unsigned long size = va_end - va_start; > diff --git a/arch/powerpc/include/asm/mman.h b/arch/powerpc/include/asm/mman.h > index 42a51a993d94..912f78a956a1 100644 > --- a/arch/powerpc/include/asm/mman.h > +++ b/arch/powerpc/include/asm/mman.h > @@ -14,7 +14,7 @@ > #include > #include > > -static inline unsigned long arch_calc_vm_prot_bits(unsigned long prot, > +static inline vm_flags_t arch_calc_vm_prot_bits(unsigned long prot, > unsigned long pkey) > { > #ifdef CONFIG_PPC_MEM_KEYS > diff --git a/arch/powerpc/include/asm/pkeys.h b/arch/powerpc/include/asm/pkeys.h > index 59a2c7dbc78f..28e752138996 100644 > --- a/arch/powerpc/include/asm/pkeys.h > +++ b/arch/powerpc/include/asm/pkeys.h > @@ -30,9 +30,9 @@ extern u32 reserved_allocation_mask; /* bits set for reserved keys */ > #endif > > > -static inline u64 pkey_to_vmflag_bits(u16 pkey) > +static inline vm_flags_t pkey_to_vmflag_bits(u16 pkey) > { > - return (((u64)pkey << VM_PKEY_SHIFT) & ARCH_VM_PKEY_FLAGS); > + return (((vm_flags_t)pkey << VM_PKEY_SHIFT) & ARCH_VM_PKEY_FLAGS); > } > > static inline int vma_pkey(struct vm_area_struct *vma) > diff --git a/arch/powerpc/kvm/book3s_hv_uvmem.c b/arch/powerpc/kvm/book3s_hv_uvmem.c > index 3a6592a31a10..03f8c34fa0a2 100644 > --- a/arch/powerpc/kvm/book3s_hv_uvmem.c > +++ b/arch/powerpc/kvm/book3s_hv_uvmem.c > @@ -393,7 +393,7 @@ static int kvmppc_memslot_page_merge(struct kvm *kvm, > { > unsigned long gfn = memslot->base_gfn; > unsigned long end, start = gfn_to_hva(kvm, gfn); > - unsigned long vm_flags; > + vm_flags_t vm_flags; > int ret = 0; > struct vm_area_struct *vma; > int merge_flag = (merge) ? MADV_MERGEABLE : MADV_UNMERGEABLE; > diff --git a/arch/sparc/include/asm/mman.h b/arch/sparc/include/asm/mman.h > index af9c10c83dc5..3e4bac33be81 100644 > --- a/arch/sparc/include/asm/mman.h > +++ b/arch/sparc/include/asm/mman.h > @@ -28,7 +28,7 @@ static inline void ipi_set_tstate_mcde(void *arg) > } > > #define arch_calc_vm_prot_bits(prot, pkey) sparc_calc_vm_prot_bits(prot) > -static inline unsigned long sparc_calc_vm_prot_bits(unsigned long prot) > +static inline vm_flags_t sparc_calc_vm_prot_bits(unsigned long prot) > { > if (adi_capable() && (prot & PROT_ADI)) { > struct pt_regs *regs; > @@ -58,7 +58,7 @@ static inline int sparc_validate_prot(unsigned long prot, unsigned long addr) > /* arch_validate_flags() - Ensure combination of flags is valid for a > * VMA. > */ > -static inline bool arch_validate_flags(unsigned long vm_flags) > +static inline bool arch_validate_flags(vm_flags_t vm_flags) > { > /* If ADI is being enabled on this VMA, check for ADI > * capability on the platform and ensure VMA is suitable > diff --git a/arch/x86/kernel/cpu/sgx/encl.c b/arch/x86/kernel/cpu/sgx/encl.c > index 279148e72459..308dbbae6c6e 100644 > --- a/arch/x86/kernel/cpu/sgx/encl.c > +++ b/arch/x86/kernel/cpu/sgx/encl.c > @@ -279,7 +279,7 @@ static struct sgx_encl_page *__sgx_encl_load_page(struct sgx_encl *encl, > > static struct sgx_encl_page *sgx_encl_load_page_in_vma(struct sgx_encl *encl, > unsigned long addr, > - unsigned long vm_flags) > + vm_flags_t vm_flags) > { > unsigned long vm_prot_bits = vm_flags & VM_ACCESS_FLAGS; > struct sgx_encl_page *entry; > @@ -520,9 +520,9 @@ static void sgx_vma_open(struct vm_area_struct *vma) > * Return: 0 on success, -EACCES otherwise > */ > int sgx_encl_may_map(struct sgx_encl *encl, unsigned long start, > - unsigned long end, unsigned long vm_flags) > + unsigned long end, vm_flags_t vm_flags) > { > - unsigned long vm_prot_bits = vm_flags & VM_ACCESS_FLAGS; > + vm_flags_t vm_prot_bits = vm_flags & VM_ACCESS_FLAGS; > struct sgx_encl_page *page; > unsigned long count = 0; > int ret = 0; > @@ -605,7 +605,7 @@ static int sgx_encl_debug_write(struct sgx_encl *encl, struct sgx_encl_page *pag > */ > static struct sgx_encl_page *sgx_encl_reserve_page(struct sgx_encl *encl, > unsigned long addr, > - unsigned long vm_flags) > + vm_flags_t vm_flags) > { > struct sgx_encl_page *entry; > > diff --git a/arch/x86/kernel/cpu/sgx/encl.h b/arch/x86/kernel/cpu/sgx/encl.h > index f94ff14c9486..8ff47f6652b9 100644 > --- a/arch/x86/kernel/cpu/sgx/encl.h > +++ b/arch/x86/kernel/cpu/sgx/encl.h > @@ -101,7 +101,7 @@ static inline int sgx_encl_find(struct mm_struct *mm, unsigned long addr, > } > > int sgx_encl_may_map(struct sgx_encl *encl, unsigned long start, > - unsigned long end, unsigned long vm_flags); > + unsigned long end, vm_flags_t vm_flags); > > bool current_is_ksgxd(void); > void sgx_encl_release(struct kref *ref); > diff --git a/tools/testing/vma/vma_internal.h b/tools/testing/vma/vma_internal.h > index 7919d7141537..b9eb8c889f96 100644 > --- a/tools/testing/vma/vma_internal.h > +++ b/tools/testing/vma/vma_internal.h > @@ -1220,7 +1220,7 @@ static inline void vma_set_page_prot(struct vm_area_struct *vma) > WRITE_ONCE(vma->vm_page_prot, vm_page_prot); > } > > -static inline bool arch_validate_flags(unsigned long) > +static inline bool arch_validate_flags(vm_flags_t) > { > return true; > } Reviewed-by: Anshuman Khandual