From patchwork Fri Oct 18 17:29:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ritesh Harjani (IBM)" X-Patchwork-Id: 13842086 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 EF6DFD3DEA2 for ; Fri, 18 Oct 2024 17:30:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 770076B009B; Fri, 18 Oct 2024 13:30:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 720896B009C; Fri, 18 Oct 2024 13:30:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5C1B06B009D; Fri, 18 Oct 2024 13:30:45 -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 300E06B009B for ; Fri, 18 Oct 2024 13:30:45 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 59375A174C for ; Fri, 18 Oct 2024 17:30:22 +0000 (UTC) X-FDA: 82687412514.12.638B564 Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) by imf06.hostedemail.com (Postfix) with ESMTP id A682A180020 for ; Fri, 18 Oct 2024 17:30:34 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=NGpOZLXX; spf=pass (imf06.hostedemail.com: domain of ritesh.list@gmail.com designates 209.85.210.176 as permitted sender) smtp.mailfrom=ritesh.list@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=1729272448; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Jw41Uo4vlK/av70SyuzQ/EcBacKxJaXG8uVQm7tNSaA=; b=BOqWB9F1boG9v14HznEDB68p99tbbFafAcLTdIKjRAMh1pIga6tcsYgvwGdX0O6ydjnkQo Nxw6KgQqbAi8QPSc9cJ7dehN2JjQWifdXwGz3j1kPhqCRRrjTjR4MnGv2KVRky5ZUulLPy j8fXK2k1JJXgeKonFt1iFUsjTOlEfkA= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=NGpOZLXX; spf=pass (imf06.hostedemail.com: domain of ritesh.list@gmail.com designates 209.85.210.176 as permitted sender) smtp.mailfrom=ritesh.list@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729272448; a=rsa-sha256; cv=none; b=6OFlynr/KbbQGNfTQ2COMSj0t/AepMzLOlEtqmuA0CZP2K0twrWPAc/84HZEfRtLl4n9Th z9JprC2N4dNXqsrFFFutuTjVsYj91xD37c5DGSASA1BtHduEJplsjbk+K3tTXu8PhUUm0E cLy23LglI6P4uirfQbF/Ume9eU3Gl08= Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-71eb1d0e3c2so29085b3a.2 for ; Fri, 18 Oct 2024 10:30:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729272641; x=1729877441; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Jw41Uo4vlK/av70SyuzQ/EcBacKxJaXG8uVQm7tNSaA=; b=NGpOZLXXSdLEDJstsPOhnpEAhyQMUOozzcKHcOHYjEchpkU44O653qLqYwUk3SJFWW vBojdPZmUPKnA67BGnUj6vNbedyIKRREYtcySV9LrMoDDHBup6svixh82xa8OLiqb8xY fq+NclVREmwoYUdS+JS0PQZT0xb31BOgPuwMN1HL21vuFbAQiXwteWad8NwHks10lClm 7zcEPRc/glHbqVYxYxwhMKMFUKiJz0WLG4fyZJCtNKneIXMFYUf9Q7JbTWAA0yBrgyrr l/utUqyBB6vYeAkecDCAAfpSyGdQRxu+/1Sgfj3zfwvQ1sYH27mAR/WTp7rYRXZdGuA6 nACg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729272641; x=1729877441; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Jw41Uo4vlK/av70SyuzQ/EcBacKxJaXG8uVQm7tNSaA=; b=svZNlfzVPYojZVANMxXDCOjywrs1QvDLHV938B5HLhL8lPEyLVOsjpYv989nhKTZed /snHWdr/8248jzTFwJhOAYxf37AusFL9kV3iLwNfpC0Cbb2wFiBbv6DKQSwGe9uKYD6S /hl94XY7zGRiK7s672212ZNfmwd0gCVSqF/uECiiNc+oE4/5+riA5U3od41A9MHdz6Ze M24bDA0VysdB0UDw3qC7g9KR6RwfoqYmq7FSD7YxYhd3c8mgPLZnCvcMKRZUDhk9VJj3 4CdWZBdz4obrOOpIBIg1DmtR4fyANQWQrMKVbKt1umkur6aLSy0kYBPEY69vC3Mc+03k DEfg== X-Forwarded-Encrypted: i=1; AJvYcCVZCtK1UkDqjt7Rqq76b7OSKmzZBFT4camkaMWQp13sjeFd0Gsa/L3p3O8btoSdNHlMaexi+Ocn5w==@kvack.org X-Gm-Message-State: AOJu0Yz46c4UDiOZ+peLvzt7EHBZHW2VFEz28987toskHxKFkBQ+s5Wb baEN+r2Mbt8jbtsXWmydvbwOunVnggRLJUIXBVcKBGM20iCUhks8 X-Google-Smtp-Source: AGHT+IHA05XWUstb450eeCq2YkOYG3UKP/gDh/dgZ6794ND1I3UZATF+JDsVTkAs4xXtweTSIyj5Uw== X-Received: by 2002:aa7:86da:0:b0:71e:b1dc:f255 with SMTP id d2e1a72fcca58-71eb1dcf5e7mr118528b3a.9.1729272641491; Fri, 18 Oct 2024 10:30:41 -0700 (PDT) Received: from dw-tp.ibmuc.com ([171.76.80.151]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71ea3311f51sm1725242b3a.36.2024.10.18.10.30.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2024 10:30:40 -0700 (PDT) From: "Ritesh Harjani (IBM)" To: linuxppc-dev@lists.ozlabs.org Cc: kasan-dev@googlegroups.com, linux-mm@kvack.org, Marco Elver , Alexander Potapenko , Heiko Carstens , Michael Ellerman , Nicholas Piggin , Madhavan Srinivasan , Christophe Leroy , Hari Bathini , "Aneesh Kumar K . V" , Donet Tom , Pavithra Prakash , LKML , "Ritesh Harjani (IBM)" Subject: [PATCH v3 04/12] book3s64/hash: Add hash_debug_pagealloc_add_slot() function Date: Fri, 18 Oct 2024 22:59:45 +0530 Message-ID: <026f0aaa1dddd89154dc8d20ceccfca4f63ccf79.1729271995.git.ritesh.list@gmail.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: References: MIME-Version: 1.0 X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: A682A180020 X-Stat-Signature: r9e59f7bjmn5qjsga86xhgfp67o7f7iw X-Rspam-User: X-HE-Tag: 1729272634-374611 X-HE-Meta: U2FsdGVkX198PifKHcH7y/d5Ug+Ytt2iEuDktI105zfmlDPYBccwD7+HuqFsK+rtbOvGpm4H7TC0+Z7tCu9yN08Z0z64x3doVWsAEwOt62eVa8NffFw+zgAz8DiYJjDx10rUrpOAr2JfQ0FIi7VH9oTVY94qOkMIi5Rj5+WSF1tKB4PFEEUbbuLnFr7rcTxsSIctx9ny70R7ldHcodGUGbBSyPIfAX4O674vSBcXY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Ib0qErxN2mPeK7yWoHA== 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: This adds hash_debug_pagealloc_add_slot() function instead of open coding that in htab_bolt_mapping(). This is required since we will be separating kfence functionality to not depend upon debug_pagealloc. No functionality change in this patch. Signed-off-by: Ritesh Harjani (IBM) --- arch/powerpc/mm/book3s64/hash_utils.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/mm/book3s64/hash_utils.c b/arch/powerpc/mm/book3s64/hash_utils.c index fb2f717e9e74..de3cabd66812 100644 --- a/arch/powerpc/mm/book3s64/hash_utils.c +++ b/arch/powerpc/mm/book3s64/hash_utils.c @@ -328,6 +328,14 @@ static void kernel_unmap_linear_page(unsigned long vaddr, unsigned long lmi) mmu_kernel_ssize, 0); } +static inline void hash_debug_pagealloc_add_slot(phys_addr_t paddr, int slot) +{ + if (!debug_pagealloc_enabled()) + return; + if ((paddr >> PAGE_SHIFT) < linear_map_hash_count) + linear_map_hash_slots[paddr >> PAGE_SHIFT] = slot | 0x80; +} + int hash__kernel_map_pages(struct page *page, int numpages, int enable) { unsigned long flags, vaddr, lmi; @@ -353,6 +361,7 @@ int hash__kernel_map_pages(struct page *page, int numpages, { return 0; } +static inline void hash_debug_pagealloc_add_slot(phys_addr_t paddr, int slot) {} #endif /* CONFIG_DEBUG_PAGEALLOC */ /* @@ -513,9 +522,7 @@ int htab_bolt_mapping(unsigned long vstart, unsigned long vend, break; cond_resched(); - if (debug_pagealloc_enabled() && - (paddr >> PAGE_SHIFT) < linear_map_hash_count) - linear_map_hash_slots[paddr >> PAGE_SHIFT] = ret | 0x80; + hash_debug_pagealloc_add_slot(paddr, ret); } return ret < 0 ? ret : 0; }