From patchwork Fri Oct 11 15:00:04 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: 13832632 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 6DDDAD0D7B8 for ; Fri, 11 Oct 2024 15:07:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 003DE6B00B0; Fri, 11 Oct 2024 11:07:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EF63D6B00B1; Fri, 11 Oct 2024 11:07:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D96D46B00B2; Fri, 11 Oct 2024 11:07:32 -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 BAC936B00B0 for ; Fri, 11 Oct 2024 11:07:32 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 635BDC13D1 for ; Fri, 11 Oct 2024 15:07:27 +0000 (UTC) X-FDA: 82661650260.12.96BF26A Received: from mail-oi1-f179.google.com (mail-oi1-f179.google.com [209.85.167.179]) by imf22.hostedemail.com (Postfix) with ESMTP id BF0B4C0011 for ; Fri, 11 Oct 2024 15:07:27 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=j+5Upp+4; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf22.hostedemail.com: domain of ritesh.list@gmail.com designates 209.85.167.179 as permitted sender) smtp.mailfrom=ritesh.list@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1728659137; a=rsa-sha256; cv=none; b=ix7I7ZEauee1KEthUM06goP4V/UAAHx9TFqfKtPozsyzjSqWgH+pVw8w6PyTGgst7kPQco vnqWQPKBTLJUiKe5HG86bROSbZRHiig7cnwGS2TOPL8j8xfKkgEEEBdgAhGmnWKTU5D48y sE/NuBSAOxFkYfvzw8MWFkA0Gq1ps+4= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=j+5Upp+4; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf22.hostedemail.com: domain of ritesh.list@gmail.com designates 209.85.167.179 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=1728659137; 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:references:dkim-signature; bh=GxJ3a4GJ9kmYrP2J+wqTevzfvJ84If+iUVZIlsVHzAQ=; b=lZlJCDJRpWjrM1sOFSOMU9274EHXMcG8aTWy74YhK/0YGEecm22ayTG9T/dp9jkXHb7244 jqcd9rXkQbPwQJs0k8Hi8uASpXxtNeZ7mOLZHmDRjTFlCXd4Xcc2IKZVxqrinIFq5n8Wqt Jbz1zZrLJU46HCm7HxbL9w7WG3zXVMg= Received: by mail-oi1-f179.google.com with SMTP id 5614622812f47-3e3e0a8aaabso778913b6e.3 for ; Fri, 11 Oct 2024 08:07:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728659249; x=1729264049; darn=kvack.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=GxJ3a4GJ9kmYrP2J+wqTevzfvJ84If+iUVZIlsVHzAQ=; b=j+5Upp+4NIlr8VKPpJrQLZgkU62atGyQBrejKpyCIY8QDcsBXwPp6tsPTv3pTMdhlj e/qgm3VXU0sn4ai1dlCMc0jfvUYVN8y6Fvjkr7oioFbFmvpzUuoJLUN7uguoXLri9L6D hQMJmTK7qq0Czc0tGR7OmllloqiZ5kHBUmWmEYJbzmLjDwD+XBPxZuDryA/T610n29U6 MMy5V139uq11yLKAnAQ+AT5hQgOQwAeEr6/mouvfkqgElQTvUxa8vsZBWU2YfNtHmoAF vmkKwKiYJOIUDnVclpNj9u6bCcAIueNbS8IjdiZjWUPJn+hDEFDO64h2zadKh9pjov7O 5sdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728659249; x=1729264049; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=GxJ3a4GJ9kmYrP2J+wqTevzfvJ84If+iUVZIlsVHzAQ=; b=IqEocSRfjyWR6K7a//pUHGdspc6OxHGK6EEYUyGwX+3eQz+wx1/fvOW3ld90/pIggR 4Vl4DGerJJuCgQykNvH+y8kBaaKl4xOzQhBPMso70BKp0O8aHeaHU+rJjm8NqQFBdT9U jxCWSRPw2ll26+rbf+wAFtdFg+wd6auV48uYaysxs7Y4WXQJPkcK6oEYIWQeOPE4CCcT 5jKtjciVfUWvSUup98C+8yNtE6hjAjQDQIRgOGe0YduyGkfn1DvP5G6FpoY06xdpldZi eUTocZbLzC2tkiI/T3GQ7g35MKlLCiVK+pPSp4sF3RQrlDgVwMIaw3uSfV4lgAJflnyR qqYw== X-Gm-Message-State: AOJu0YwEIR/eYBLWN0LHVvahIERUzfMU2sU4OSExzUrue2pRCl5KRy8S YBt7QUovO8tiZwxdUpUkqCuQLXXdWhX50mblmnQpE41T9YtskBabrq8VIg== X-Google-Smtp-Source: AGHT+IFbjpvOtZ/4fnGnu1qPpet8fqGoBC1EXvpTqBB5vCO3GdLz4J1XYWVfGZyMKj/vHw3RhywtBA== X-Received: by 2002:a05:6a00:84c:b0:71d:eb7d:20e4 with SMTP id d2e1a72fcca58-71e37e4e13emr4618936b3a.8.1728658815997; Fri, 11 Oct 2024 08:00:15 -0700 (PDT) Received: from dw-tp.. ([171.76.85.106]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71e4a2c9767sm146561b3a.85.2024.10.11.08.00.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Oct 2024 08:00:15 -0700 (PDT) From: "Ritesh Harjani (IBM)" To: linuxppc-dev@lists.ozlabs.org Cc: linux-mm@kvack.org, Sourabh Jain , Hari Bathini , Zi Yan , David Hildenbrand , "Kirill A . Shutemov" , Mahesh J Salgaonkar , Michael Ellerman , Madhavan Srinivasan , "Aneesh Kumar K . V" , Donet Tom , LKML , Sachin P Bappalige , "Ritesh Harjani (IBM)" Subject: [RFC v3 1/3] fadump: Refactor and prepare fadump_cma_init for late init Date: Fri, 11 Oct 2024 20:30:04 +0530 Message-ID: <030b6d46fddac126a6cf7e119bea48055338f0ed.1728658614.git.ritesh.list@gmail.com> X-Mailer: git-send-email 2.46.0 MIME-Version: 1.0 X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: BF0B4C0011 X-Stat-Signature: xtae1hf5bekgm6r1dtis53ab5p8qermy X-Rspam-User: X-HE-Tag: 1728659247-897357 X-HE-Meta: U2FsdGVkX1/eL4NdSfCpNTgAG371EjZ4YInGo+lfpS+NmDWtAHOnx9objm+giibwse8zjEH/OE6LCF1zNsyoGtYLx/iWd90czeLi0/w4Rx4l50ubD9O9dWzDbs4unVVlncJJPeKhdYmjiRv0+ozFxO9a8G+l4Q3mb/AdiJLsg7NjNv50JQyuWh5wiQY/NLok1NUOOvpzrvHZ4vhw4Wr3MJ5y4pu0opMo88GcLYS8HggHoSVxCov4KaWw2fPoJ1BUfLTmlT4s1i4duxRYAauKnc5IbwNiM2Ck4Xv3pLepS4u2KH1t8lnThPt6FvCwTWwR281jwDRF+eAx9naXJjUrd2kZk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ZtXjB4yuX/nk1lPgjg/o1Pzq04CvhsOIGx9k7AEt2yDkENwK02KW3T/R4BARADpyfREvXumprJiFHIahOHvZSupXte8WCEX7LCpMMJVITAplaaFhUye8yo0PA/AV5ag6VU/SWutV47/Ikr2vwTErGM 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: We anyway don't use any return values from fadump_cma_init(). Since fadump_reserve_mem() from where fadump_cma_init() gets called today, already has the required checks. This patch makes this function return type as void. Let's also handle extra cases like return if fadump_supported is false or dump_active, so that in later patches we can call fadump_cma_init() separately from setup_arch(). Acked-by: Hari Bathini Signed-off-by: Ritesh Harjani (IBM) Reviewed-by: Madhavan Srinivasan for the series. --- v2 -> v3: Separated the series into 2 as discussed in v2. [v2]: https://lore.kernel.org/linuxppc-dev/cover.1728585512.git.ritesh.list@gmail.com/ arch/powerpc/kernel/fadump.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) -- 2.46.0 diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c index a612e7513a4f..162327d66982 100644 --- a/arch/powerpc/kernel/fadump.c +++ b/arch/powerpc/kernel/fadump.c @@ -78,27 +78,23 @@ static struct cma *fadump_cma; * But for some reason even if it fails we still have the memory reservation * with us and we can still continue doing fadump. */ -static int __init fadump_cma_init(void) +static void __init fadump_cma_init(void) { unsigned long long base, size; int rc; - if (!fw_dump.fadump_enabled) - return 0; - + if (!fw_dump.fadump_supported || !fw_dump.fadump_enabled || + fw_dump.dump_active) + return; /* * Do not use CMA if user has provided fadump=nocma kernel parameter. - * Return 1 to continue with fadump old behaviour. */ - if (fw_dump.nocma) - return 1; + if (fw_dump.nocma || !fw_dump.boot_memory_size) + return; base = fw_dump.reserve_dump_area_start; size = fw_dump.boot_memory_size; - if (!size) - return 0; - rc = cma_init_reserved_mem(base, size, 0, "fadump_cma", &fadump_cma); if (rc) { pr_err("Failed to init cma area for firmware-assisted dump,%d\n", rc); @@ -108,7 +104,7 @@ static int __init fadump_cma_init(void) * blocked from production system usage. Hence return 1, * so that we can continue with fadump. */ - return 1; + return; } /* @@ -125,10 +121,9 @@ static int __init fadump_cma_init(void) cma_get_size(fadump_cma), (unsigned long)cma_get_base(fadump_cma) >> 20, fw_dump.reserve_dump_area_size); - return 1; } #else -static int __init fadump_cma_init(void) { return 1; } +static void __init fadump_cma_init(void) { } #endif /* CONFIG_CMA */ /* @@ -638,7 +633,7 @@ int __init fadump_reserve_mem(void) pr_info("Reserved %lldMB of memory at %#016llx (System RAM: %lldMB)\n", (size >> 20), base, (memblock_phys_mem_size() >> 20)); - ret = fadump_cma_init(); + fadump_cma_init(); } return ret;