From patchwork Tue Oct 15 01:33:28 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: 13835651 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 89473CFC501 for ; Tue, 15 Oct 2024 01:34:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 189226B0099; Mon, 14 Oct 2024 21:34:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 138E26B009A; Mon, 14 Oct 2024 21:34:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EF3F76B009B; Mon, 14 Oct 2024 21:34:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id D13A76B0099 for ; Mon, 14 Oct 2024 21:34:14 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 161251405E4 for ; Tue, 15 Oct 2024 01:34:06 +0000 (UTC) X-FDA: 82674115818.26.68889D5 Received: from mail-pg1-f178.google.com (mail-pg1-f178.google.com [209.85.215.178]) by imf15.hostedemail.com (Postfix) with ESMTP id E02E4A0002 for ; Tue, 15 Oct 2024 01:34:05 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=a11lXroS; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf15.hostedemail.com: domain of ritesh.list@gmail.com designates 209.85.215.178 as permitted sender) smtp.mailfrom=ritesh.list@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1728955936; a=rsa-sha256; cv=none; b=nUb4Qehyc6UFbpaiSHirW84lVJUH0QHrHQHdkDrapTGue+QPXwUiOLAt3u0cBp4fOics/K aQVroYWX+ZUe2kUmkO60v7aO4/SSwB8ck6zost6JsjrVaBeFFWUjyC5ltUhwLDDRIYyRhS qyi3bjFdfGQsT6B2onxl1Zc9zn41C9A= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=a11lXroS; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf15.hostedemail.com: domain of ritesh.list@gmail.com designates 209.85.215.178 as permitted sender) smtp.mailfrom=ritesh.list@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1728955936; 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=U+q0qzhvgy5Htf+jNoj0jpwh62QEw37SjQucvD3DcJc=; b=mWopg5rQK/rtzbDIgMBsU4ESwHCabSL5jeLmz0zcLkiGru0NRWtVQFO2DoQ6Py/wbEZqqE 9LU9W7b1roMAso6nbjB8lsRr6bEM0SpjLkynHbvysfSTn6mqBQiKWTeevx0LO3JDVhSrFm ZxzxsfoiUijCzk7Izfd9XpnI4T4c7ZY= Received: by mail-pg1-f178.google.com with SMTP id 41be03b00d2f7-7ea80863f12so678343a12.1 for ; Mon, 14 Oct 2024 18:34:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728956051; x=1729560851; 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=U+q0qzhvgy5Htf+jNoj0jpwh62QEw37SjQucvD3DcJc=; b=a11lXroSvi6mTF/QpmmymGVb+3gCRRHKlwaQmCmFfu3weugzJM2LIcJ3+j3ijyV21d 7ZulGfW1brvpcJAY/59CSClKtY4Kt7I38A/Mt1ABuD9yj69uGr/a2YFWL89aiRxtqF3P LQCxH0VD78qKEHKDCazLtkNl59UqcCUtd8EVsRWjk13dWzJNl+Vu4SWfyOXTEwFmzzj8 LREgqJ4nPNuOMHFF7RTk3aGGbNCoR7W3DmQVJB7keGPV7ggZU/600dt3CpPK1kpKdBCo SkQeu0p8poPKoWT8Qz/OwTQmvw3TdAeCruaGoh9myj0fhaB00UBwI5lcKyHZ0yzZqPEq FKYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728956051; x=1729560851; 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=U+q0qzhvgy5Htf+jNoj0jpwh62QEw37SjQucvD3DcJc=; b=IMrcJ0wqAe6qz3KhuIVyiAr+Fa+6Mzfgb31C2a3m5fisLPmS1R0JUMH+yEfJvlItsJ e1gJUKZB8fcLUmR5dyQ2iscBlpFyAlr+LdX3KXLO79do8ni7eQ5DyJ6iHRaxoj0zUoSs ee5bR+NF12RVyyOXZSYyD7H4zZnmvM4ttbEEYf08ErMu24pxYJndYqK/kt/SHevSvPXA z5jQUabs0z0SrZSRaaTBJUBEmMneyXXU2hzgrJI0OxJU+YGF7u3KMDA1WxmaPvUEUaBX ZJ7Sp7ee9vJS7eTmHTe2oILXWPESZNi1QfMtp7ol6btzHmQ1kL8B08RZESAIuOu2bGL4 OCtg== X-Forwarded-Encrypted: i=1; AJvYcCUCPYB8YVGsMZvN+AN8L8vlSd/gLeKj3+/92MCJriwMO0RFlZ1G4O+ENiq5ottt71F+7/0I8HGjGw==@kvack.org X-Gm-Message-State: AOJu0YyaAkotZU8/+gj2B+78AEs9o6jf+UCSkN35AJWxvv48RLHnnYFj q/NWYusVk9D6ttawitp/x3FxxEW3GZjxZiJes9nwWHDQXjhUfIKmLwAYYQ== X-Google-Smtp-Source: AGHT+IEG9dZAng0ihOIRx501nnz2kIcPdMnvgADTGVh5vNpZ9v3ZsQlVB5geCgNicOYeTFxr8a+CGw== X-Received: by 2002:a05:6a21:710a:b0:1cf:9a86:6cb7 with SMTP id adf61e73a8af0-1d8bcf2c37bmr19861897637.20.1728956051333; Mon, 14 Oct 2024 18:34:11 -0700 (PDT) Received: from dw-tp.. ([171.76.80.151]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71e77508562sm189349b3a.186.2024.10.14.18.34.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Oct 2024 18:34:10 -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: [RFC RESEND v2 05/13] book3s64/hash: Add hash_debug_pagealloc_add_slot() function Date: Tue, 15 Oct 2024 07:03:28 +0530 Message-ID: <7fc9a78423fceda0bfd07f80583a7c9c0938e339.1728954719.git.ritesh.list@gmail.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: References: MIME-Version: 1.0 X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: E02E4A0002 X-Stat-Signature: x475h1heuwocsmjdu1538to3jqwbqiqc X-Rspam-User: X-HE-Tag: 1728956045-762464 X-HE-Meta: U2FsdGVkX196PMquxsoedeZX4nyp/MCwXywoXI4fqzhMAQGhIZ6vRwwY1VgyF5ip/rfnhBoFwfD9b6xDrCrEe7vcm19r/YMvAM9GDTXLv0M7bAxZ8g8Ua1H8ePPVfejDCvHhQE6ElBAfjn4HbpJ8UDtid4slMyCEl7reTcgedgZAxlp0hMFSb0gos00r5MS8Z0V2r1SE5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mSCin1XHyp3S45ANDyzT7vUhbb5Wy6aFH5vNZ+xbwiBZTQ== 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 82151fff9648..6e3860224351 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; }