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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9BC53C46467 for ; Sat, 14 Jan 2023 21:48:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229676AbjANVsj (ORCPT ); Sat, 14 Jan 2023 16:48:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230423AbjANVsi (ORCPT ); Sat, 14 Jan 2023 16:48:38 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6AB4B9EDF for ; Sat, 14 Jan 2023 13:48:37 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D1575B80A2B for ; Sat, 14 Jan 2023 21:48:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 42D9EC433D2; Sat, 14 Jan 2023 21:48:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1673732914; bh=Bx1bh3m/2K/2BYZQWHNllWka7QlP+yoy+cf+BQbYEjQ=; h=Date:To:From:Subject:From; b=aaG5ox3QJW5Gw1rv5zw75r3P21Oij3QpaOJ+mwlcxCSIUPu/qSDwFcV6sb31mJY9R Rt4bX4m8yqQ4ht7/FvvFJ+5d4nK3bWwaXPB/1MW/DP8iFq7QpiCBwI5d3cqdfoe08T jMBCwTbbClTQTfAIutNERo4MXWi52OS4QlRpJFPI= Date: Sat, 14 Jan 2023 13:48:33 -0800 To: mm-commits@vger.kernel.org, lkp@intel.com, david@redhat.com, akpm@linux-foundation.org From: Andrew Morton Subject: + mm-debug_vm_pgtable-more-pte_swp_exclusive-sanity-checks-fix.patch added to mm-unstable branch Message-Id: <20230114214834.42D9EC433D2@smtp.kernel.org> Precedence: bulk Reply-To: linux-kernel@vger.kernel.org List-ID: X-Mailing-List: mm-commits@vger.kernel.org The patch titled Subject: fixup: mm/debug_vm_pgtable: more pte_swp_exclusive() sanity checks has been added to the -mm mm-unstable branch. Its filename is mm-debug_vm_pgtable-more-pte_swp_exclusive-sanity-checks-fix.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-debug_vm_pgtable-more-pte_swp_exclusive-sanity-checks-fix.patch This patch will later appear in the mm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: David Hildenbrand Subject: fixup: mm/debug_vm_pgtable: more pte_swp_exclusive() sanity checks Date: Sat, 14 Jan 2023 16:47:12 +0100 generic_max_swapfile_size() is only available with CONFIG_SWAP -- which makes sense, because without SWAP there are no swap files. Let's simply probe manually which bits we can obtain after storing them in a PTE, and properly call it "max swap offset", which is more generic for a swap entry. Link: https://lkml.kernel.org/r/6aaad548-cf48-77fa-9d6c-db83d724b2eb@redhat.com Signed-off-by: David Hildenbrand Reported-by: kernel test robot Signed-off-by: Andrew Morton --- --- a/mm/debug_vm_pgtable.c~mm-debug_vm_pgtable-more-pte_swp_exclusive-sanity-checks-fix +++ a/mm/debug_vm_pgtable.c @@ -811,15 +811,17 @@ static void __init pmd_swap_soft_dirty_t static void __init pte_swap_exclusive_tests(struct pgtable_debug_args *args) { #ifdef __HAVE_ARCH_PTE_SWP_EXCLUSIVE - unsigned long max_swapfile_size = generic_max_swapfile_size(); + unsigned long max_swap_offset; swp_entry_t entry, entry2; pte_t pte; pr_debug("Validating PTE swap exclusive\n"); + /* See generic_max_swapfile_size(): probe the maximum offset */ + max_swap_offset = swp_offset(pte_to_swp_entry(swp_entry_to_pte(swp_entry(0, ~0UL)))); + /* Create a swp entry with all possible bits set */ - entry = swp_entry((1 << MAX_SWAPFILES_SHIFT) - 1, - max_swapfile_size - 1); + entry = swp_entry((1 << MAX_SWAPFILES_SHIFT) - 1, max_swap_offset); pte = swp_entry_to_pte(entry); WARN_ON(pte_swp_exclusive(pte)); _ Patches currently in -mm which might be from david@redhat.com are mm-userfaultfd-rely-on-vma-vm_page_prot-in-uffd_wp_range.patch mm-userfaultfd-rely-on-vma-vm_page_prot-in-uffd_wp_range-fix.patch mm-mprotect-drop-pgprot_t-parameter-from-change_protection.patch mm-mprotect-drop-pgprot_t-parameter-from-change_protection-fix.patch selftests-vm-cow-add-cow-tests-for-collapsing-of-pte-mapped-anon-thp.patch mm-nommu-factor-out-check-for-nommu-shared-mappings-into-is_nommu_shared_mapping.patch mm-nommu-dont-use-vm_mayshare-for-map_private-mappings.patch drivers-misc-open-dice-dont-touch-vm_mayshare.patch selftests-mm-define-madv_pageout-to-fix-compilation-issues.patch mm-debug_vm_pgtable-more-pte_swp_exclusive-sanity-checks.patch mm-debug_vm_pgtable-more-pte_swp_exclusive-sanity-checks-fix.patch alpha-mm-support-__have_arch_pte_swp_exclusive.patch arc-mm-support-__have_arch_pte_swp_exclusive.patch arm-mm-support-__have_arch_pte_swp_exclusive.patch csky-mm-support-__have_arch_pte_swp_exclusive.patch hexagon-mm-support-__have_arch_pte_swp_exclusive.patch ia64-mm-support-__have_arch_pte_swp_exclusive.patch loongarch-mm-support-__have_arch_pte_swp_exclusive.patch m68k-mm-remove-dummy-__swp-definitions-for-nommu.patch m68k-mm-support-__have_arch_pte_swp_exclusive.patch microblaze-mm-support-__have_arch_pte_swp_exclusive.patch mips-mm-support-__have_arch_pte_swp_exclusive.patch nios2-mm-refactor-swap-pte-layout.patch nios2-mm-support-__have_arch_pte_swp_exclusive.patch openrisc-mm-support-__have_arch_pte_swp_exclusive.patch parisc-mm-support-__have_arch_pte_swp_exclusive.patch powerpc-mm-support-__have_arch_pte_swp_exclusive-on-32bit-book3s.patch powerpc-nohash-mm-support-__have_arch_pte_swp_exclusive.patch riscv-mm-support-__have_arch_pte_swp_exclusive.patch sh-mm-support-__have_arch_pte_swp_exclusive.patch sparc-mm-support-__have_arch_pte_swp_exclusive-on-32bit.patch sparc-mm-support-__have_arch_pte_swp_exclusive-on-64bit.patch um-mm-support-__have_arch_pte_swp_exclusive.patch x86-mm-support-__have_arch_pte_swp_exclusive-also-on-32bit.patch xtensa-mm-support-__have_arch_pte_swp_exclusive.patch mm-remove-__have_arch_pte_swp_exclusive.patch