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]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 98213CCD187 for ; Sat, 11 Oct 2025 00:18:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5FC468E0020; Fri, 10 Oct 2025 20:18:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5A6168E001F; Fri, 10 Oct 2025 20:18:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 494A88E0020; Fri, 10 Oct 2025 20:18:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 32A478E001F for ; Fri, 10 Oct 2025 20:18:54 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id C53A411A3D3 for ; Sat, 11 Oct 2025 00:18:53 +0000 (UTC) X-FDA: 83983922946.19.2C6B9CB Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.13]) by imf28.hostedemail.com (Postfix) with ESMTP id EF36AC0006 for ; Sat, 11 Oct 2025 00:18:50 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=mZYx3rm8; dmarc=pass (policy=none) header.from=intel.com; spf=pass (imf28.hostedemail.com: domain of lkp@intel.com designates 192.198.163.13 as permitted sender) smtp.mailfrom=lkp@intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1760141931; 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:dkim-signature; bh=P9lWjlUYQ46zPfOzWViJ7aKzpLngFC0w2Ci0GhDVAJo=; b=Hmv5xnaDCumjIEvcNj0s3rP8ctKZLlWnverKSqeVNfWAo3PiAea89IiYXU37tANF+RIeMl y1//YCH7H7QZP27JqD7wm8eqRNiPOgWSQ7yYUjMMp4h0xMrIPf/t3tC37k4/eWEDl0Abte OROE37lmGcAX4eefZOx7Skw73yoARFI= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1760141931; a=rsa-sha256; cv=none; b=x++itSMmZKjUfmL1vGDWe9Xh6s4hVCruNJ3wQvyR8p7SBzG3tqgKwAlytPIWUQNGaBoN1u 2/NMkqT+fBaZ8p4sTeoAYOL4At9Bw1rh8gNQrW4juHam71vsRbEcyBBnf9aoh4WvPLAaOB ByBgROy+BTXTHtphqoOGNkTD0Tmgwz8= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=mZYx3rm8; dmarc=pass (policy=none) header.from=intel.com; spf=pass (imf28.hostedemail.com: domain of lkp@intel.com designates 192.198.163.13 as permitted sender) smtp.mailfrom=lkp@intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1760141931; x=1791677931; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=Z1HLkPNLXqEx6CBzT/O1i1dvLfQ37fBJBeUJtUKcJZI=; b=mZYx3rm86UUJ86RSyXKOFbnqsOKRXY0gAZziMCAR/BXeH7GBFpg1TlY/ YIJll5t/5bCXeQSuyOHVqUZ1w/avLOtmSSuEfsJGNpTP/qARhe8Kiguaf Dkn4WJgEBJUdWa2QFTSltulVE1gU12EsbSMOKTBOLTSIYWjRztUOx0NZ2 1t9Oln80zklS8H3cJ8EGPckoSRi+pvbu7M8/8qezSkog2bmS7zyrd+mrY WxTWsa3zANt87OXe73twbIL+smmbYoOTHuFY4+Q/0Ntu9ktbBMsopkGDI RFSb317FXePYjdcQEIlCIihN81R2blGvX2hyy6ZhFrPFOox+vv5H28tHk Q==; X-CSE-ConnectionGUID: h9lHizziRzCisUIukL0cOg== X-CSE-MsgGUID: bd4EJkwPR8eobxRT0d1ROg== X-IronPort-AV: E=McAfee;i="6800,10657,11578"; a="64985410" X-IronPort-AV: E=Sophos;i="6.19,220,1754982000"; d="scan'208";a="64985410" Received: from orviesa005.jf.intel.com ([10.64.159.145]) by fmvoesa107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Oct 2025 17:18:49 -0700 X-CSE-ConnectionGUID: oiYJHhVPRGaaZ9r7c+Bjnw== X-CSE-MsgGUID: P4E/t/uQToq3ZX6uIrXbbg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.19,220,1754982000"; d="scan'208";a="186217447" Received: from lkp-server01.sh.intel.com (HELO 6a630e8620ab) ([10.239.97.150]) by orviesa005.jf.intel.com with ESMTP; 10 Oct 2025 17:18:44 -0700 Received: from kbuild by 6a630e8620ab with local (Exim 4.96) (envelope-from ) id 1v7NJq-0003K3-0l; Sat, 11 Oct 2025 00:18:42 +0000 Date: Sat, 11 Oct 2025 08:18:05 +0800 From: kernel test robot To: Jakub Acs , aliceryhl@google.com, djwong@kernel.org Cc: oe-kbuild-all@lists.linux.dev, jhubbard@nvidia.com, acsjakub@amazon.de, akpm@linux-foundation.org, axelrasmussen@google.com, chengming.zhou@linux.dev, david@redhat.com, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, peterx@redhat.com, rust-for-linux@vger.kernel.org, xu.xin16@zte.com.cn Subject: Re: [PATCH] mm: use enum for vm_flags Message-ID: <202510110743.9G4osLTr-lkp@intel.com> References: <20251008125427.68735-1-acsjakub@amazon.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20251008125427.68735-1-acsjakub@amazon.de> X-Rspamd-Server: rspam01 X-Stat-Signature: 793m1s8dtmwj9x4yxufnju89tsmg1sn5 X-Rspam-User: X-Rspamd-Queue-Id: EF36AC0006 X-HE-Tag: 1760141930-230187 X-HE-Meta: U2FsdGVkX19oqdCvcSHfqvC3uBaUq6X16Te7+7pxsjr7lQ0iTOYGDiyj7NWCpkJ1SHHnl7OJ1zN5sB5HlEEjiV6YdkuB3uTqzX1kqzcOzujIZB2ec8vsy20PuuUakb2iO02Hv3dfPSMnxiN3gv8w8yV0sqrzb+mzGGhpMAKnV/WZsRT738hFfgzLzwWN0+DwveVSPOgwiuy7lxoPt8vyv0M3oKfJ63NqeFda2av2g22wXjZ4XOaxrFtaze4457VyYocCn5K4IjleCk50qRc6dDdSnZYLzp2EM990WMHqfv9yrycR6aLLY+iMH8oqvfMfS3pS0I3B12Xts30p0wqBMYQdHbNX3HTSQn1BKprwikGtfFRMh5IafEJz4nDUwNBZCVeE44ySKDU+jp7hK8GZSmeFD+KlX2HRxUOVJOSeO+kY8Gv2cIemnDcyHF71a4U5YJy6FDrBkGnGEF/l0Vc8ZRQzRIZpjSKhPIaEArlpBh/nO5N4ZzMugDc5XTqrr3dn+lK9g3Ep9a5dfHEertNDPC8K76YmtZdnHR3tp1QOE1PLEzD0k7uWYIPjHA2UllWN5S/CzvTbcA29OOXGyCNH4MEnUKdD9+5vaxaOZ8xdN4aRrUZyqxaPpALwAjrOFXY3lKXmewyc0mGr5QAs5tnNHrqvbXCERkPmU7YAPWfNtmWNdaqefj2NTitiIVOERx01efKYzYAFqyZ+9IrnBWhLcFjEhOjzGbKg8NNFPCzIPmw8rEl1vUT1/q51Y4Jhekr8Ir+UdfqAbRbH53zLB5dBTe0A0ZWauIJzADL2OXHjpeD+fX0KZo2FGSezi15pYxPizJM36iUubBwH+rI6i7dmDSxADbLJYPcsy4kE9W/+1Z7rYvvyoE5s3XlS2r3uXcZWNy/gWODQ/Lk/24xdm4Xo87Oc4d8SZsVEtvpQPTSKMHH0AlETeznqu+D96B4RI0M07kVqBORtn7sLBPGUhA4 +qhteG65 GcNX+t8f7N4z2otnHE5xw7hgrFIeJUA4wpRftcUZQhrshv0uYX9EF5Uyw1ZlQczJu9Z6gVeBa9ife0r1gmn6uBYnkMlxO9cr4fByIvNufqyam6TyaAJP6Tu+L/RuGT4V7pSMG/nff7OC/mFms7AOLc3sHkMLhfg1M9E1WcIJBrfoR21nL7FG6LXDCs40xoegK/KkcHo2+wUGyJUmiYexdAO5l5uDg5TGmeqCCIYq8y0oz4pR1LapPt2VhwJ6iAJ70F8bnqZXpIpAj7e1VnxAnitFbSv44PljJOXIOAhwMS66zCnKn/8XXfVwnB1XIJ0qcFQbQ860GL5aKvpwRa7pnpZcx3w== 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: Hi Jakub, kernel test robot noticed the following build errors: [auto build test ERROR on akpm-mm/mm-everything] url: https://github.com/intel-lab-lkp/linux/commits/Jakub-Acs/mm-use-enum-for-vm_flags/20251010-124738 base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything patch link: https://lore.kernel.org/r/20251008125427.68735-1-acsjakub%40amazon.de patch subject: [PATCH] mm: use enum for vm_flags config: s390-randconfig-001-20251011 (https://download.01.org/0day-ci/archive/20251011/202510110743.9G4osLTr-lkp@intel.com/config) compiler: s390-linux-gcc (GCC) 9.5.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251011/202510110743.9G4osLTr-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot | Closes: https://lore.kernel.org/oe-kbuild-all/202510110743.9G4osLTr-lkp@intel.com/ All error/warnings (new ones prefixed by >>): In file included from arch/s390/include/asm/mmu_context.h:11, from arch/s390/include/asm/elf.h:178, from include/linux/elf.h:6, from include/linux/module.h:20, from include/linux/device/driver.h:21, from include/linux/device.h:32, from include/linux/node.h:18, from include/linux/cpu.h:17, from include/linux/static_call.h:135, from include/linux/tracepoint.h:22, from include/linux/mm.h:39, from include/linux/pid_namespace.h:7, from include/linux/ptrace.h:10, from arch/s390/include/asm/stacktrace.h:7, from arch/s390/kernel/asm-offsets.c:15: arch/s390/include/asm/pgalloc.h: In function 'p4d_alloc_one_noprof': >> arch/s390/include/asm/pgalloc.h:62:2: error: implicit declaration of function 'pagetable_p4d_ctor' [-Werror=implicit-function-declaration] 62 | pagetable_p4d_ctor(virt_to_ptdesc(table)); | ^~~~~~~~~~~~~~~~~~ >> arch/s390/include/asm/pgalloc.h:62:21: error: implicit declaration of function 'virt_to_ptdesc'; did you mean 'virt_to_kpte'? [-Werror=implicit-function-declaration] 62 | pagetable_p4d_ctor(virt_to_ptdesc(table)); | ^~~~~~~~~~~~~~ | virt_to_kpte arch/s390/include/asm/pgalloc.h: In function 'p4d_free': >> arch/s390/include/asm/pgalloc.h:73:2: error: implicit declaration of function 'pagetable_dtor'; did you mean 'page_table_free'? [-Werror=implicit-function-declaration] 73 | pagetable_dtor(virt_to_ptdesc(p4d)); | ^~~~~~~~~~~~~~ | page_table_free arch/s390/include/asm/pgalloc.h: In function 'pud_alloc_one_noprof': >> arch/s390/include/asm/pgalloc.h:84:2: error: implicit declaration of function 'pagetable_pud_ctor' [-Werror=implicit-function-declaration] 84 | pagetable_pud_ctor(virt_to_ptdesc(table)); | ^~~~~~~~~~~~~~~~~~ arch/s390/include/asm/pgalloc.h: In function 'pmd_alloc_one_noprof': >> arch/s390/include/asm/pgalloc.h:106:7: error: implicit declaration of function 'pagetable_pmd_ctor' [-Werror=implicit-function-declaration] 106 | if (!pagetable_pmd_ctor(mm, virt_to_ptdesc(table))) { | ^~~~~~~~~~~~~~~~~~ arch/s390/include/asm/pgalloc.h: In function 'pgd_alloc_noprof': >> arch/s390/include/asm/pgalloc.h:143:2: error: implicit declaration of function 'pagetable_pgd_ctor' [-Werror=implicit-function-declaration] 143 | pagetable_pgd_ctor(virt_to_ptdesc(table)); | ^~~~~~~~~~~~~~~~~~ In file included from include/linux/pid_namespace.h:7, from include/linux/ptrace.h:10, from arch/s390/include/asm/stacktrace.h:7, from arch/s390/kernel/asm-offsets.c:15: include/linux/mm.h: At top level: >> include/linux/mm.h:3011:30: error: conflicting types for 'virt_to_ptdesc' 3011 | static inline struct ptdesc *virt_to_ptdesc(const void *x) | ^~~~~~~~~~~~~~ In file included from arch/s390/include/asm/mmu_context.h:11, from arch/s390/include/asm/elf.h:178, from include/linux/elf.h:6, from include/linux/module.h:20, from include/linux/device/driver.h:21, from include/linux/device.h:32, from include/linux/node.h:18, from include/linux/cpu.h:17, from include/linux/static_call.h:135, from include/linux/tracepoint.h:22, from include/linux/mm.h:39, from include/linux/pid_namespace.h:7, from include/linux/ptrace.h:10, from arch/s390/include/asm/stacktrace.h:7, from arch/s390/kernel/asm-offsets.c:15: arch/s390/include/asm/pgalloc.h:62:21: note: previous implicit declaration of 'virt_to_ptdesc' was here 62 | pagetable_p4d_ctor(virt_to_ptdesc(table)); | ^~~~~~~~~~~~~~ In file included from include/linux/pid_namespace.h:7, from include/linux/ptrace.h:10, from arch/s390/include/asm/stacktrace.h:7, from arch/s390/kernel/asm-offsets.c:15: >> include/linux/mm.h:3152:20: warning: conflicting types for 'pagetable_dtor' 3152 | static inline void pagetable_dtor(struct ptdesc *ptdesc) | ^~~~~~~~~~~~~~ >> include/linux/mm.h:3152:20: error: static declaration of 'pagetable_dtor' follows non-static declaration In file included from arch/s390/include/asm/mmu_context.h:11, from arch/s390/include/asm/elf.h:178, from include/linux/elf.h:6, from include/linux/module.h:20, from include/linux/device/driver.h:21, from include/linux/device.h:32, from include/linux/node.h:18, from include/linux/cpu.h:17, from include/linux/static_call.h:135, from include/linux/tracepoint.h:22, from include/linux/mm.h:39, from include/linux/pid_namespace.h:7, from include/linux/ptrace.h:10, from arch/s390/include/asm/stacktrace.h:7, from arch/s390/kernel/asm-offsets.c:15: arch/s390/include/asm/pgalloc.h:73:2: note: previous implicit declaration of 'pagetable_dtor' was here 73 | pagetable_dtor(virt_to_ptdesc(p4d)); | ^~~~~~~~~~~~~~ In file included from include/linux/pid_namespace.h:7, from include/linux/ptrace.h:10, from arch/s390/include/asm/stacktrace.h:7, from arch/s390/kernel/asm-offsets.c:15: >> include/linux/mm.h:3274:20: error: conflicting types for 'pagetable_pmd_ctor' 3274 | static inline bool pagetable_pmd_ctor(struct mm_struct *mm, | ^~~~~~~~~~~~~~~~~~ In file included from arch/s390/include/asm/mmu_context.h:11, from arch/s390/include/asm/elf.h:178, from include/linux/elf.h:6, from include/linux/module.h:20, from include/linux/device/driver.h:21, from include/linux/device.h:32, from include/linux/node.h:18, from include/linux/cpu.h:17, from include/linux/static_call.h:135, from include/linux/tracepoint.h:22, from include/linux/mm.h:39, from include/linux/pid_namespace.h:7, from include/linux/ptrace.h:10, from arch/s390/include/asm/stacktrace.h:7, from arch/s390/kernel/asm-offsets.c:15: arch/s390/include/asm/pgalloc.h:106:7: note: previous implicit declaration of 'pagetable_pmd_ctor' was here 106 | if (!pagetable_pmd_ctor(mm, virt_to_ptdesc(table))) { | ^~~~~~~~~~~~~~~~~~ In file included from include/linux/pid_namespace.h:7, from include/linux/ptrace.h:10, from arch/s390/include/asm/stacktrace.h:7, from arch/s390/kernel/asm-offsets.c:15: >> include/linux/mm.h:3303:20: warning: conflicting types for 'pagetable_pud_ctor' 3303 | static inline void pagetable_pud_ctor(struct ptdesc *ptdesc) | ^~~~~~~~~~~~~~~~~~ >> include/linux/mm.h:3303:20: error: static declaration of 'pagetable_pud_ctor' follows non-static declaration In file included from arch/s390/include/asm/mmu_context.h:11, from arch/s390/include/asm/elf.h:178, from include/linux/elf.h:6, from include/linux/module.h:20, from include/linux/device/driver.h:21, from include/linux/device.h:32, from include/linux/node.h:18, from include/linux/cpu.h:17, from include/linux/static_call.h:135, from include/linux/tracepoint.h:22, from include/linux/mm.h:39, from include/linux/pid_namespace.h:7, from include/linux/ptrace.h:10, from arch/s390/include/asm/stacktrace.h:7, from arch/s390/kernel/asm-offsets.c:15: arch/s390/include/asm/pgalloc.h:84:2: note: previous implicit declaration of 'pagetable_pud_ctor' was here 84 | pagetable_pud_ctor(virt_to_ptdesc(table)); | ^~~~~~~~~~~~~~~~~~ In file included from include/linux/pid_namespace.h:7, from include/linux/ptrace.h:10, from arch/s390/include/asm/stacktrace.h:7, from arch/s390/kernel/asm-offsets.c:15: >> include/linux/mm.h:3308:20: warning: conflicting types for 'pagetable_p4d_ctor' 3308 | static inline void pagetable_p4d_ctor(struct ptdesc *ptdesc) | ^~~~~~~~~~~~~~~~~~ >> include/linux/mm.h:3308:20: error: static declaration of 'pagetable_p4d_ctor' follows non-static declaration In file included from arch/s390/include/asm/mmu_context.h:11, from arch/s390/include/asm/elf.h:178, from include/linux/elf.h:6, from include/linux/module.h:20, from include/linux/device/driver.h:21, from include/linux/device.h:32, from include/linux/node.h:18, from include/linux/cpu.h:17, from include/linux/static_call.h:135, from include/linux/tracepoint.h:22, from include/linux/mm.h:39, from include/linux/pid_namespace.h:7, from include/linux/ptrace.h:10, from arch/s390/include/asm/stacktrace.h:7, from arch/s390/kernel/asm-offsets.c:15: arch/s390/include/asm/pgalloc.h:62:2: note: previous implicit declaration of 'pagetable_p4d_ctor' was here 62 | pagetable_p4d_ctor(virt_to_ptdesc(table)); | ^~~~~~~~~~~~~~~~~~ In file included from include/linux/pid_namespace.h:7, from include/linux/ptrace.h:10, from arch/s390/include/asm/stacktrace.h:7, from arch/s390/kernel/asm-offsets.c:15: >> include/linux/mm.h:3313:20: warning: conflicting types for 'pagetable_pgd_ctor' 3313 | static inline void pagetable_pgd_ctor(struct ptdesc *ptdesc) | ^~~~~~~~~~~~~~~~~~ >> include/linux/mm.h:3313:20: error: static declaration of 'pagetable_pgd_ctor' follows non-static declaration In file included from arch/s390/include/asm/mmu_context.h:11, from arch/s390/include/asm/elf.h:178, from include/linux/elf.h:6, from include/linux/module.h:20, from include/linux/device/driver.h:21, from include/linux/device.h:32, from include/linux/node.h:18, from include/linux/cpu.h:17, from include/linux/static_call.h:135, from include/linux/tracepoint.h:22, from include/linux/mm.h:39, from include/linux/pid_namespace.h:7, from include/linux/ptrace.h:10, from arch/s390/include/asm/stacktrace.h:7, from arch/s390/kernel/asm-offsets.c:15: arch/s390/include/asm/pgalloc.h:143:2: note: previous implicit declaration of 'pagetable_pgd_ctor' was here 143 | pagetable_pgd_ctor(virt_to_ptdesc(table)); | ^~~~~~~~~~~~~~~~~~ cc1: some warnings being treated as errors make[3]: *** [scripts/Makefile.build:182: arch/s390/kernel/asm-offsets.s] Error 1 shuffle=2098624972 make[3]: Target 'prepare' not remade because of errors. make[2]: *** [Makefile:1280: prepare0] Error 2 shuffle=2098624972 make[2]: Target 'prepare' not remade because of errors. make[1]: *** [Makefile:248: __sub-make] Error 2 shuffle=2098624972 make[1]: Target 'prepare' not remade because of errors. make: *** [Makefile:248: __sub-make] Error 2 shuffle=2098624972 make: Target 'prepare' not remade because of errors. vim +/virt_to_ptdesc +3011 include/linux/mm.h 522abd92279a8e Matthew Wilcox (Oracle 2025-09-08 3010) bf2d4334f72e4e Vishal Moola (Oracle 2023-08-07 @3011) static inline struct ptdesc *virt_to_ptdesc(const void *x) bf2d4334f72e4e Vishal Moola (Oracle 2023-08-07 3012) { bf2d4334f72e4e Vishal Moola (Oracle 2023-08-07 3013) return page_ptdesc(virt_to_page(x)); bf2d4334f72e4e Vishal Moola (Oracle 2023-08-07 3014) } bf2d4334f72e4e Vishal Moola (Oracle 2023-08-07 3015) 90ec2df9dd3165 Matthew Wilcox (Oracle 2025-09-08 3016) /** 90ec2df9dd3165 Matthew Wilcox (Oracle 2025-09-08 3017) * ptdesc_address - Virtual address of page table. 90ec2df9dd3165 Matthew Wilcox (Oracle 2025-09-08 3018) * @pt: Page table descriptor. 90ec2df9dd3165 Matthew Wilcox (Oracle 2025-09-08 3019) * 90ec2df9dd3165 Matthew Wilcox (Oracle 2025-09-08 3020) * Return: The first byte of the page table described by @pt. 90ec2df9dd3165 Matthew Wilcox (Oracle 2025-09-08 3021) */ bf2d4334f72e4e Vishal Moola (Oracle 2023-08-07 3022) static inline void *ptdesc_address(const struct ptdesc *pt) bf2d4334f72e4e Vishal Moola (Oracle 2023-08-07 3023) { bf2d4334f72e4e Vishal Moola (Oracle 2023-08-07 3024) return folio_address(ptdesc_folio(pt)); bf2d4334f72e4e Vishal Moola (Oracle 2023-08-07 3025) } bf2d4334f72e4e Vishal Moola (Oracle 2023-08-07 3026) bf2d4334f72e4e Vishal Moola (Oracle 2023-08-07 3027) static inline bool pagetable_is_reserved(struct ptdesc *pt) bf2d4334f72e4e Vishal Moola (Oracle 2023-08-07 3028) { 522abd92279a8e Matthew Wilcox (Oracle 2025-09-08 3029) return test_bit(PT_reserved, &pt->pt_flags.f); bf2d4334f72e4e Vishal Moola (Oracle 2023-08-07 3030) } bf2d4334f72e4e Vishal Moola (Oracle 2023-08-07 3031) bf2d4334f72e4e Vishal Moola (Oracle 2023-08-07 3032) /** bf2d4334f72e4e Vishal Moola (Oracle 2023-08-07 3033) * pagetable_alloc - Allocate pagetables bf2d4334f72e4e Vishal Moola (Oracle 2023-08-07 3034) * @gfp: GFP flags bf2d4334f72e4e Vishal Moola (Oracle 2023-08-07 3035) * @order: desired pagetable order bf2d4334f72e4e Vishal Moola (Oracle 2023-08-07 3036) * bf2d4334f72e4e Vishal Moola (Oracle 2023-08-07 3037) * pagetable_alloc allocates memory for page tables as well as a page table bf2d4334f72e4e Vishal Moola (Oracle 2023-08-07 3038) * descriptor to describe that memory. bf2d4334f72e4e Vishal Moola (Oracle 2023-08-07 3039) * bf2d4334f72e4e Vishal Moola (Oracle 2023-08-07 3040) * Return: The ptdesc describing the allocated page tables. bf2d4334f72e4e Vishal Moola (Oracle 2023-08-07 3041) */ 2c321f3f70bc28 Suren Baghdasaryan 2024-04-14 3042 static inline struct ptdesc *pagetable_alloc_noprof(gfp_t gfp, unsigned int order) bf2d4334f72e4e Vishal Moola (Oracle 2023-08-07 3043) { 2c321f3f70bc28 Suren Baghdasaryan 2024-04-14 3044 struct page *page = alloc_pages_noprof(gfp | __GFP_COMP, order); bf2d4334f72e4e Vishal Moola (Oracle 2023-08-07 3045) bf2d4334f72e4e Vishal Moola (Oracle 2023-08-07 3046) return page_ptdesc(page); bf2d4334f72e4e Vishal Moola (Oracle 2023-08-07 3047) } 2c321f3f70bc28 Suren Baghdasaryan 2024-04-14 3048 #define pagetable_alloc(...) alloc_hooks(pagetable_alloc_noprof(__VA_ARGS__)) bf2d4334f72e4e Vishal Moola (Oracle 2023-08-07 3049) bf2d4334f72e4e Vishal Moola (Oracle 2023-08-07 3050) /** bf2d4334f72e4e Vishal Moola (Oracle 2023-08-07 3051) * pagetable_free - Free pagetables bf2d4334f72e4e Vishal Moola (Oracle 2023-08-07 3052) * @pt: The page table descriptor bf2d4334f72e4e Vishal Moola (Oracle 2023-08-07 3053) * bf2d4334f72e4e Vishal Moola (Oracle 2023-08-07 3054) * pagetable_free frees the memory of all page tables described by a page bf2d4334f72e4e Vishal Moola (Oracle 2023-08-07 3055) * table descriptor and the memory for the descriptor itself. bf2d4334f72e4e Vishal Moola (Oracle 2023-08-07 3056) */ bf2d4334f72e4e Vishal Moola (Oracle 2023-08-07 3057) static inline void pagetable_free(struct ptdesc *pt) bf2d4334f72e4e Vishal Moola (Oracle 2023-08-07 3058) { bf2d4334f72e4e Vishal Moola (Oracle 2023-08-07 3059) struct page *page = ptdesc_page(pt); bf2d4334f72e4e Vishal Moola (Oracle 2023-08-07 3060) bf2d4334f72e4e Vishal Moola (Oracle 2023-08-07 3061) __free_pages(page, compound_order(page)); bf2d4334f72e4e Vishal Moola (Oracle 2023-08-07 3062) } bf2d4334f72e4e Vishal Moola (Oracle 2023-08-07 3063) 394290cba9664e David Hildenbrand 2024-07-26 3064 #if defined(CONFIG_SPLIT_PTE_PTLOCKS) 597d795a2a786d Kirill A. Shutemov 2013-12-20 3065 #if ALLOC_SPLIT_PTLOCKS b35f1819acd924 Kirill A. Shutemov 2014-01-21 3066 void __init ptlock_cache_init(void); f5ecca06b3a5d0 Vishal Moola (Oracle 2023-08-07 3067) bool ptlock_alloc(struct ptdesc *ptdesc); 6ed1b8a09deb0b Vishal Moola (Oracle 2023-08-07 3068) void ptlock_free(struct ptdesc *ptdesc); 539edb5846c740 Peter Zijlstra 2013-11-14 3069 1865484af6b2ce Vishal Moola (Oracle 2023-08-07 3070) static inline spinlock_t *ptlock_ptr(struct ptdesc *ptdesc) 539edb5846c740 Peter Zijlstra 2013-11-14 3071 { 1865484af6b2ce Vishal Moola (Oracle 2023-08-07 3072) return ptdesc->ptl; 539edb5846c740 Peter Zijlstra 2013-11-14 3073 } 597d795a2a786d Kirill A. Shutemov 2013-12-20 3074 #else /* ALLOC_SPLIT_PTLOCKS */ b35f1819acd924 Kirill A. Shutemov 2014-01-21 3075 static inline void ptlock_cache_init(void) b35f1819acd924 Kirill A. Shutemov 2014-01-21 3076 { b35f1819acd924 Kirill A. Shutemov 2014-01-21 3077 } b35f1819acd924 Kirill A. Shutemov 2014-01-21 3078 f5ecca06b3a5d0 Vishal Moola (Oracle 2023-08-07 3079) static inline bool ptlock_alloc(struct ptdesc *ptdesc) 49076ec2ccaf68 Kirill A. Shutemov 2013-11-14 3080 { 49076ec2ccaf68 Kirill A. Shutemov 2013-11-14 3081 return true; 49076ec2ccaf68 Kirill A. Shutemov 2013-11-14 3082 } 539edb5846c740 Peter Zijlstra 2013-11-14 3083 6ed1b8a09deb0b Vishal Moola (Oracle 2023-08-07 3084) static inline void ptlock_free(struct ptdesc *ptdesc) 49076ec2ccaf68 Kirill A. Shutemov 2013-11-14 3085 { 49076ec2ccaf68 Kirill A. Shutemov 2013-11-14 3086 } 49076ec2ccaf68 Kirill A. Shutemov 2013-11-14 3087 1865484af6b2ce Vishal Moola (Oracle 2023-08-07 3088) static inline spinlock_t *ptlock_ptr(struct ptdesc *ptdesc) 49076ec2ccaf68 Kirill A. Shutemov 2013-11-14 3089 { 1865484af6b2ce Vishal Moola (Oracle 2023-08-07 3090) return &ptdesc->ptl; 49076ec2ccaf68 Kirill A. Shutemov 2013-11-14 3091 } 597d795a2a786d Kirill A. Shutemov 2013-12-20 3092 #endif /* ALLOC_SPLIT_PTLOCKS */ 49076ec2ccaf68 Kirill A. Shutemov 2013-11-14 3093 49076ec2ccaf68 Kirill A. Shutemov 2013-11-14 3094 static inline spinlock_t *pte_lockptr(struct mm_struct *mm, pmd_t *pmd) 49076ec2ccaf68 Kirill A. Shutemov 2013-11-14 3095 { 1865484af6b2ce Vishal Moola (Oracle 2023-08-07 3096) return ptlock_ptr(page_ptdesc(pmd_page(*pmd))); 49076ec2ccaf68 Kirill A. Shutemov 2013-11-14 3097 } 49076ec2ccaf68 Kirill A. Shutemov 2013-11-14 3098 5f75cfbd6bb022 David Hildenbrand 2024-08-01 3099 static inline spinlock_t *ptep_lockptr(struct mm_struct *mm, pte_t *pte) 5f75cfbd6bb022 David Hildenbrand 2024-08-01 3100 { 5f75cfbd6bb022 David Hildenbrand 2024-08-01 3101 BUILD_BUG_ON(IS_ENABLED(CONFIG_HIGHPTE)); 5f75cfbd6bb022 David Hildenbrand 2024-08-01 3102 BUILD_BUG_ON(MAX_PTRS_PER_PTE * sizeof(pte_t) > PAGE_SIZE); 5f75cfbd6bb022 David Hildenbrand 2024-08-01 3103 return ptlock_ptr(virt_to_ptdesc(pte)); 5f75cfbd6bb022 David Hildenbrand 2024-08-01 3104 } 5f75cfbd6bb022 David Hildenbrand 2024-08-01 3105 75b25d49ca6638 Vishal Moola (Oracle 2023-08-07 3106) static inline bool ptlock_init(struct ptdesc *ptdesc) 49076ec2ccaf68 Kirill A. Shutemov 2013-11-14 3107 { 4c21e2f2441dc5 Hugh Dickins 2005-10-29 3108 /* 49076ec2ccaf68 Kirill A. Shutemov 2013-11-14 3109 * prep_new_page() initialize page->private (and therefore page->ptl) 49076ec2ccaf68 Kirill A. Shutemov 2013-11-14 3110 * with 0. Make sure nobody took it in use in between. 49076ec2ccaf68 Kirill A. Shutemov 2013-11-14 3111 * 49076ec2ccaf68 Kirill A. Shutemov 2013-11-14 3112 * It can happen if arch try to use slab for page table allocation: 1d798ca3f16437 Kirill A. Shutemov 2015-11-06 3113 * slab code uses page->slab_cache, which share storage with page->ptl. 4c21e2f2441dc5 Hugh Dickins 2005-10-29 3114 */ 75b25d49ca6638 Vishal Moola (Oracle 2023-08-07 3115) VM_BUG_ON_PAGE(*(unsigned long *)&ptdesc->ptl, ptdesc_page(ptdesc)); 75b25d49ca6638 Vishal Moola (Oracle 2023-08-07 3116) if (!ptlock_alloc(ptdesc)) 49076ec2ccaf68 Kirill A. Shutemov 2013-11-14 3117 return false; 75b25d49ca6638 Vishal Moola (Oracle 2023-08-07 3118) spin_lock_init(ptlock_ptr(ptdesc)); 49076ec2ccaf68 Kirill A. Shutemov 2013-11-14 3119 return true; 49076ec2ccaf68 Kirill A. Shutemov 2013-11-14 3120 } 49076ec2ccaf68 Kirill A. Shutemov 2013-11-14 3121 394290cba9664e David Hildenbrand 2024-07-26 3122 #else /* !defined(CONFIG_SPLIT_PTE_PTLOCKS) */ 4c21e2f2441dc5 Hugh Dickins 2005-10-29 3123 /* 4c21e2f2441dc5 Hugh Dickins 2005-10-29 3124 * We use mm->page_table_lock to guard all pagetable pages of the mm. 4c21e2f2441dc5 Hugh Dickins 2005-10-29 3125 */ 49076ec2ccaf68 Kirill A. Shutemov 2013-11-14 3126 static inline spinlock_t *pte_lockptr(struct mm_struct *mm, pmd_t *pmd) 49076ec2ccaf68 Kirill A. Shutemov 2013-11-14 3127 { 49076ec2ccaf68 Kirill A. Shutemov 2013-11-14 3128 return &mm->page_table_lock; 49076ec2ccaf68 Kirill A. Shutemov 2013-11-14 3129 } 5f75cfbd6bb022 David Hildenbrand 2024-08-01 3130 static inline spinlock_t *ptep_lockptr(struct mm_struct *mm, pte_t *pte) 5f75cfbd6bb022 David Hildenbrand 2024-08-01 3131 { 5f75cfbd6bb022 David Hildenbrand 2024-08-01 3132 return &mm->page_table_lock; 5f75cfbd6bb022 David Hildenbrand 2024-08-01 3133 } b35f1819acd924 Kirill A. Shutemov 2014-01-21 3134 static inline void ptlock_cache_init(void) {} 75b25d49ca6638 Vishal Moola (Oracle 2023-08-07 3135) static inline bool ptlock_init(struct ptdesc *ptdesc) { return true; } 6ed1b8a09deb0b Vishal Moola (Oracle 2023-08-07 3136) static inline void ptlock_free(struct ptdesc *ptdesc) {} 394290cba9664e David Hildenbrand 2024-07-26 3137 #endif /* defined(CONFIG_SPLIT_PTE_PTLOCKS) */ 4c21e2f2441dc5 Hugh Dickins 2005-10-29 3138 f0c92726e89f5c Matthew Wilcox (Oracle 2025-09-08 3139) static inline unsigned long ptdesc_nr_pages(const struct ptdesc *ptdesc) f0c92726e89f5c Matthew Wilcox (Oracle 2025-09-08 3140) { f0c92726e89f5c Matthew Wilcox (Oracle 2025-09-08 3141) return compound_nr(ptdesc_page(ptdesc)); f0c92726e89f5c Matthew Wilcox (Oracle 2025-09-08 3142) } f0c92726e89f5c Matthew Wilcox (Oracle 2025-09-08 3143) 11e2400b21a3e2 Kevin Brodsky 2025-01-03 3144 static inline void __pagetable_ctor(struct ptdesc *ptdesc) 2f569afd9ced9e Martin Schwidefsky 2008-02-08 3145 { f0c92726e89f5c Matthew Wilcox (Oracle 2025-09-08 3146) pg_data_t *pgdat = NODE_DATA(memdesc_nid(ptdesc->pt_flags)); 7e11dca14b27e1 Vishal Moola (Oracle 2023-08-07 3147) f0c92726e89f5c Matthew Wilcox (Oracle 2025-09-08 3148) __SetPageTable(ptdesc_page(ptdesc)); f0c92726e89f5c Matthew Wilcox (Oracle 2025-09-08 3149) mod_node_page_state(pgdat, NR_PAGETABLE, ptdesc_nr_pages(ptdesc)); 2f569afd9ced9e Martin Schwidefsky 2008-02-08 3150 } 2f569afd9ced9e Martin Schwidefsky 2008-02-08 3151 db6b435d731a8d Qi Zheng 2025-01-08 @3152 static inline void pagetable_dtor(struct ptdesc *ptdesc) 7e11dca14b27e1 Vishal Moola (Oracle 2023-08-07 3153) { f0c92726e89f5c Matthew Wilcox (Oracle 2025-09-08 3154) pg_data_t *pgdat = NODE_DATA(memdesc_nid(ptdesc->pt_flags)); 7e11dca14b27e1 Vishal Moola (Oracle 2023-08-07 3155) 7e11dca14b27e1 Vishal Moola (Oracle 2023-08-07 3156) ptlock_free(ptdesc); f0c92726e89f5c Matthew Wilcox (Oracle 2025-09-08 3157) __ClearPageTable(ptdesc_page(ptdesc)); f0c92726e89f5c Matthew Wilcox (Oracle 2025-09-08 3158) mod_node_page_state(pgdat, NR_PAGETABLE, -ptdesc_nr_pages(ptdesc)); 7e11dca14b27e1 Vishal Moola (Oracle 2023-08-07 3159) } 7e11dca14b27e1 Vishal Moola (Oracle 2023-08-07 3160) -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki