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 7E357C7115A for ; Thu, 19 Jun 2025 09:53:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 245456B00A1; Thu, 19 Jun 2025 05:53:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1D0096B00A8; Thu, 19 Jun 2025 05:53:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 070D46B00B5; Thu, 19 Jun 2025 05:53:45 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id E2DB96B00A1 for ; Thu, 19 Jun 2025 05:53:45 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id A80F1BC510 for ; Thu, 19 Jun 2025 09:53:45 +0000 (UTC) X-FDA: 83571688410.23.EBD5431 Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com [209.85.167.42]) by imf03.hostedemail.com (Postfix) with ESMTP id C4A4F20003 for ; Thu, 19 Jun 2025 09:53:43 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="WHWL6I8/"; spf=pass (imf03.hostedemail.com: domain of urezki@gmail.com designates 209.85.167.42 as permitted sender) smtp.mailfrom=urezki@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1750326823; 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=8lxye2GX1z6QI+SRVMkfZEngbWK9B27pd3eBJcWGrlg=; b=q+hP+23Pt2xAy4WaaZ0L10b4pL9+VmuCrtE6NBQ5VdJE9qzFQZpSp9h+vXwPBW68JvkVfx aRDuA+CsZC1hCEENEgvTycTkZsOVYSqezZdvPYoUhWFWzLoD2o869Rr7aVBjqhaysBl3Jg AL2TEXPsWGa2w4oPLVUYe0aQoH85264= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="WHWL6I8/"; spf=pass (imf03.hostedemail.com: domain of urezki@gmail.com designates 209.85.167.42 as permitted sender) smtp.mailfrom=urezki@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1750326823; a=rsa-sha256; cv=none; b=gS7ROA6yNcWq9DCeHH3qxT7L7UeE1JxDLo5mZGhGYeusPGiwMFoz1M6FsRilcoa4nxUlEY RplfssDfZoiav7brIkJM872cI41eG6VkiwyI/Z23z4f2zz6f/Ewj6WpvH3Q8VuZpH9hrag ZWdimHvFe3LNSo68KvlccnCTt9JN2FY= Received: by mail-lf1-f42.google.com with SMTP id 2adb3069b0e04-553c31542b1so493039e87.2 for ; Thu, 19 Jun 2025 02:53:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1750326822; x=1750931622; darn=kvack.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:date:from:from:to:cc:subject:date:message-id:reply-to; bh=8lxye2GX1z6QI+SRVMkfZEngbWK9B27pd3eBJcWGrlg=; b=WHWL6I8/xms9leMcLIZ9dnRRuN/wL20DFUclfRUMTw52iKKD4E+XK1lzkzidlUkeCN zuaPLoKYmBvx4xA3r3MRhZmA8sTkIplbBqQBw1weQ+S8bkZoXCISz6APsyI/7vWofLeX 0K8bBXvJARyzct51ITmBmyltl0fvrNP3s3E13jkYIgaWNWOG/jkriTt/trS6Cjw1aZzM H1itm55nAd85/2Va1YemAJY37KLAjxk9beVJ6OPaIspw6KGq9sbG07eah32byebexDBp +Z3HT2mMxJop0HaWKQz3Gb5KrSDlkh0HXMfifAPFOHGNAVvDeIFJhN6pSeN9FFqheo2Q W8+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1750326822; x=1750931622; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:date:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=8lxye2GX1z6QI+SRVMkfZEngbWK9B27pd3eBJcWGrlg=; b=hXDcwX4ZacFkrda01Xe8nGolK32R9UgMWpuxS42W9ZydKq3JjhjuCeUcOsDiv7KjO/ q4QmfWQ/5aGiVlpZIV12HoiyNNul04rtre8LYP6BwH95hK8dJTMhrDOxWLkTjvsTyGAX z+Sip4iIUeZSgQa1twkcO+We79UpIgokdtWnN2Kvc1TQcsCUz7NHnLmjYyspzlTUIYmj 3795AurRgXloy35bVson3HVwFWWmDA41aCgUqLNPteXKbBXcxQXxmmDbXby6HIpQaBRF tlQ+r5ZzrTiQnLpd0dDuEfrBuhyPLvEyytDzMFE7tTrvT6K7n5qu/IMoqeogOCeRtLAv wQjg== X-Forwarded-Encrypted: i=1; AJvYcCVAWmuIpLpVGrX1mss0P3Z9SgawUI3Toc60+kdRq7wKX0UtmafZ3UXr/0aJlqh58sVpDhwjGiMZjg==@kvack.org X-Gm-Message-State: AOJu0YxzyslH+aZydZdCOML0ET4sGxL/R3oR2qkuP+vbvo9KCDb+mr7K Jf0GgzVUqVfOyibb75VZNXT2pht7u+99+ZFiZc308WWiKDK3RcIUStvU X-Gm-Gg: ASbGncvuBEbXXRR5bFaNOWmJ0FzpBg/9lRBs4a37ofbyUjn81is3xQeM+5P1UCsaNUV tpmvda1qurUhb32+uIuacv+H7z1N849eK9qLz4U36nufQyZEGaPZMgaBMnLl4HFzjJ5qFqZ4VFA 6ei8xVQK3zFDnFWjPPM3UgaVRZGiQPAMSJNvcO9Cnj8dSIHnxyD3JIubIVyVMXDDx+krAZnQ69/ uDkxKdhh9NSRPKZUmd+agQLzoXwb8LeFOZQrFnHWhp67m46IvdhGR16P1NjyST7dYsE/5VFsypP s+uWI0imqfNbxXs5lMR6Mr9zMKl6kwRQ7nilCBl3PVNIR8Yh7Tc21SnA7VRscZPyWGYZMRzQMFa gzzD6s8NXacw= X-Google-Smtp-Source: AGHT+IEJV7RqZa9E1nD948cD6oSgemriE8btKJowGkw8tp48NbrB1jrcDoGclBvee7YrwcLZgS368g== X-Received: by 2002:a05:6512:1049:b0:553:1f90:cca4 with SMTP id 2adb3069b0e04-553b6e74ae6mr5656846e87.13.1750326821436; Thu, 19 Jun 2025 02:53:41 -0700 (PDT) Received: from pc636 (host-95-203-1-180.mobileonline.telia.com. [95.203.1.180]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-553ac1367e9sm2541889e87.79.2025.06.19.02.53.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Jun 2025 02:53:41 -0700 (PDT) From: Uladzislau Rezki X-Google-Original-From: Uladzislau Rezki Date: Thu, 19 Jun 2025 11:53:38 +0200 To: Dan Carpenter , Alexander Gordeev , Andrew Morton Cc: oe-kbuild@lists.linux.dev, Alexander Gordeev , Andrew Morton , lkp@intel.com, oe-kbuild-all@lists.linux.dev, Linux Memory Management List , linux-kernel@vger.kernel.org, sparclinux@vger.kernel.org, xen-devel@lists.xenproject.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, Hugh Dickins , Nicholas Piggin , Guenter Roeck , Juergen Gross , Jeremy Fitzhardinge , Ryan Roberts Subject: Re: [PATCH 2/6] mm: Lock kernel page tables before entering lazy MMU mode Message-ID: References: <7bd3a45dbc375dc2c15cebae09cb2bb972d6039f.1749747752.git.agordeev@linux.ibm.com> <0be7d42e-5898-4b94-829b-59c661c2f07b@suswa.mountain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0be7d42e-5898-4b94-829b-59c661c2f07b@suswa.mountain> X-Rspamd-Server: rspam11 X-Rspam-User: X-Rspamd-Queue-Id: C4A4F20003 X-Stat-Signature: ssskb7p3s84a1wxnzbdeb8nexhmtbrr1 X-HE-Tag: 1750326823-823494 X-HE-Meta: U2FsdGVkX1/MgfIjpaU1HskIVewhrt94TEbeVQSbcx5X7KYRidArBuJ/1fOI6TZn14s9AWIZH9pmLKJPcffQ4HE7sjtvHr9zIKmjT7KU5OaU85+AoHCnncxmh5aJxwK81uMG+lomGSxSh91P/w/F9FJfp0o+i45OvljdVm2AnAV0kmvsshbzO/5Sx9HFIMDqpXVrGsjCL5KhbFnVrwmYEUW/pYoYBfYK2WjHUhXDotwzbIUoFWL1mRAVBDGWECRTS77oaNFWnKilMVKbCjDWzwcNc7a2fRgoMItSuinRL+KosDwadr/k+jOxl4cIsvYvEi8yHF2ImYkVuYefxQYQXc9pHEwryqQhVa5zVAw7Z2y8+XVL+BL3FEigdwrWlnWrw+/+Edr+B6wLgBjTaddm2e+NaxKjd3eZ5CW8Jzc+LIx99J1mcB0K23Bq0rW2X42Rv5T9w8yBrUf4JtqPFJlhLj5utMEamRo/2eubQkJ6AD+iN/EUy+Kqg/hPOfLVDUVv/nS0w2es0uAaHw4Adwj3O4OneqeStQgaKxGCUsHbuXhVio+xsnatKGCxPEsMnn+H3u8tRbHZ5F5Ib2NViAvRW/I0tRdEvJq65gq1XFYqtuAA4SNQGs008Uzg9QwRAClvC2KQYAEpIvhz2e0ML5YAF1DtH0B/vNrWvBGJm7PxS9GpGt55jkMlgb/JWWn9uNCNOBbtG8CKttwgHcW7ylArYR/M6cnd+tySLnyp4TK6aBetPBR2gNV5eccECn8ZAZhbGFwGNXJfJYyTDZzMHdE80pkLAJ7eewr+dgY/OD8BZ9YvzePI3JRI5dbtvD7xmzcN5/DFTPoDuW5VKqemGOoxZbH9Rob5WKagq+IS9UFAda+OtXxN+yQvDcBylZO7A1gZiao2fBVpMAtQoqqciRoGTl5rj91NnvXBkFCRJFP9ymxj/9g8B9NYOGlSeUzApgp2EmkI8rPfv50fK+fog4v 8SKMAXNK Y3f5qH2QfzNsjZBoRBDTYw4Z4SjV/SlwARu5Cq9l4jsybFa8pMLhaB9wBmw== 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, Jun 18, 2025 at 08:32:28PM +0300, Dan Carpenter wrote: > Hi Alexander, > > kernel test robot noticed the following build warnings: > > url: https://github.com/intel-lab-lkp/linux/commits/Alexander-Gordeev/mm-Cleanup-apply_to_pte_range-routine/20250613-013835 > base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything > patch link: https://lore.kernel.org/r/7bd3a45dbc375dc2c15cebae09cb2bb972d6039f.1749747752.git.agordeev%40linux.ibm.com > patch subject: [PATCH 2/6] mm: Lock kernel page tables before entering lazy MMU mode > config: x86_64-randconfig-161-20250613 (https://download.01.org/0day-ci/archive/20250613/202506132017.T1l1l6ME-lkp@intel.com/config) > compiler: gcc-12 (Debian 12.2.0-14) 12.2.0 > > 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 > | Reported-by: Dan Carpenter > | Closes: https://lore.kernel.org/r/202506132017.T1l1l6ME-lkp@intel.com/ > > smatch warnings: > mm/vmalloc.c:552 vmap_pages_pte_range() warn: inconsistent returns 'global &init_mm.page_table_lock'. > > vim +552 mm/vmalloc.c > > 0a264884046f1ab Nicholas Piggin 2021-04-29 517 static int vmap_pages_pte_range(pmd_t *pmd, unsigned long addr, > 2ba3e6947aed9bb Joerg Roedel 2020-06-01 518 unsigned long end, pgprot_t prot, struct page **pages, int *nr, > 2ba3e6947aed9bb Joerg Roedel 2020-06-01 519 pgtbl_mod_mask *mask) > ^1da177e4c3f415 Linus Torvalds 2005-04-16 520 { > ^1da177e4c3f415 Linus Torvalds 2005-04-16 521 pte_t *pte; > ^1da177e4c3f415 Linus Torvalds 2005-04-16 522 > db64fe02258f150 Nicholas Piggin 2008-10-18 523 /* > db64fe02258f150 Nicholas Piggin 2008-10-18 524 * nr is a running index into the array which helps higher level > db64fe02258f150 Nicholas Piggin 2008-10-18 525 * callers keep track of where we're up to. > db64fe02258f150 Nicholas Piggin 2008-10-18 526 */ > db64fe02258f150 Nicholas Piggin 2008-10-18 527 > 2ba3e6947aed9bb Joerg Roedel 2020-06-01 528 pte = pte_alloc_kernel_track(pmd, addr, mask); > ^1da177e4c3f415 Linus Torvalds 2005-04-16 529 if (!pte) > ^1da177e4c3f415 Linus Torvalds 2005-04-16 530 return -ENOMEM; > 44562c71e2cfc9e Ryan Roberts 2025-04-22 531 > dac0cc793368851 Alexander Gordeev 2025-06-12 532 spin_lock(&init_mm.page_table_lock); > 44562c71e2cfc9e Ryan Roberts 2025-04-22 533 arch_enter_lazy_mmu_mode(); > 44562c71e2cfc9e Ryan Roberts 2025-04-22 534 > ^1da177e4c3f415 Linus Torvalds 2005-04-16 535 do { > db64fe02258f150 Nicholas Piggin 2008-10-18 536 struct page *page = pages[*nr]; > db64fe02258f150 Nicholas Piggin 2008-10-18 537 > c33c794828f2121 Ryan Roberts 2023-06-12 538 if (WARN_ON(!pte_none(ptep_get(pte)))) > db64fe02258f150 Nicholas Piggin 2008-10-18 539 return -EBUSY; > db64fe02258f150 Nicholas Piggin 2008-10-18 540 if (WARN_ON(!page)) > ^1da177e4c3f415 Linus Torvalds 2005-04-16 541 return -ENOMEM; > 4fcdcc12915c707 Yury Norov 2022-04-28 542 if (WARN_ON(!pfn_valid(page_to_pfn(page)))) > 4fcdcc12915c707 Yury Norov 2022-04-28 543 return -EINVAL; > > These error paths don't unlock &init_mm.page_table_lock? > > 4fcdcc12915c707 Yury Norov 2022-04-28 544 > ^1da177e4c3f415 Linus Torvalds 2005-04-16 545 set_pte_at(&init_mm, addr, pte, mk_pte(page, prot)); > db64fe02258f150 Nicholas Piggin 2008-10-18 546 (*nr)++; > ^1da177e4c3f415 Linus Torvalds 2005-04-16 547 } while (pte++, addr += PAGE_SIZE, addr != end); > 44562c71e2cfc9e Ryan Roberts 2025-04-22 548 > 44562c71e2cfc9e Ryan Roberts 2025-04-22 549 arch_leave_lazy_mmu_mode(); > dac0cc793368851 Alexander Gordeev 2025-06-12 550 spin_unlock(&init_mm.page_table_lock); > 2ba3e6947aed9bb Joerg Roedel 2020-06-01 551 *mask |= PGTBL_PTE_MODIFIED; > ^1da177e4c3f415 Linus Torvalds 2005-04-16 @552 return 0; > ^1da177e4c3f415 Linus Torvalds 2005-04-16 553 } > > -- > 0-DAY CI Kernel Test Service > https://github.com/intel/lkp-tests/wiki > > This patch introduce a huge performance degrade when testing this by the test_vmalloc.sh performance tool. We return back to a single, not serialized global spilock where we spend 90% of cycles: + 91.01% 1.67% [kernel] [k] _raw_spin_lock - 89.29% 89.25% [kernel] [k] native_queued_spin_lock_slowpath 69.82% ret_from_fork_asm - ret_from_fork - 69.81% kthread - 69.66% test_func - 26.31% full_fit_alloc_test - 19.11% __vmalloc_node_noprof - __vmalloc_node_range_noprof - 13.73% vmap_small_pages_range_noflush _raw_spin_lock native_queued_spin_lock_slowpath - 5.38% __get_vm_area_node alloc_vmap_area _raw_spin_lock native_queued_spin_lock_slowpath - 13.32% vfree.part.0 - 13.31% remove_vm_area - 13.27% __vunmap_range_noflush _raw_spin_lock native_queued_spin_lock_slowpath - 25.57% fix_size_alloc_test - 22.59% __vmalloc_node_noprof - __vmalloc_node_range_noprof - 17.34% vmap_small_pages_range_noflush _raw_spin_lock native_queued_spin_lock_slowpath - 5.25% __get_vm_area_node alloc_vmap_area _raw_spin_lock native_queued_spin_lock_slowpath - 11.59% vfree.part.0 - remove_vm_area - 11.55% __vunmap_range_noflush _raw_spin_lock native_queued_spin_lock_slowpath - 17.78% long_busy_list_alloc_test - 13.90% __vmalloc_node_noprof - __vmalloc_node_range_noprof - 9.95% vmap_small_pages_range_noflush _raw_spin_lock No, we can not take this patch. -- Uladzislau Rezki