Message ID | 20230106060535.104321-3-jeeheng.sia@starfivetech.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp668372wrt; Thu, 5 Jan 2023 22:15:16 -0800 (PST) X-Google-Smtp-Source: AMrXdXsPJ7Fg6HgcFWS9UbnlvWEgQYYQzvf6wsypZV2w/x4kWfbixD86YKWmqrJZhYmwoAX52q/5 X-Received: by 2002:a05:6402:3787:b0:48f:a9a2:29f4 with SMTP id et7-20020a056402378700b0048fa9a229f4mr7010694edb.1.1672985716836; Thu, 05 Jan 2023 22:15:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672985716; cv=none; d=google.com; s=arc-20160816; b=x4Krz5oBvRvPXfTFY+6FFn//MZuYEGcp7FuTdzsarikf7F0BlJ4owlFdAMrGaQ2DG4 JRB+DxRMOqjeHxr8VUlSFDVccgds3RMiIImTScWr/K0u3VSBzPWBp02UKcbhBG9RVO+W cUFDEgv8H2FGxgFITygDENAmmOhTusfg5NUFKLK8KdlY8aHlg0XNl9gBaHslTHkB3IIp sahqmTy8aJ0Msb5aOaI3wpGkPjHPjWL5MYvRHEYt+qa9zpVkoK6ge3zuiApntRq1YXXj 4CY/DoQJYs0d66FfNqaV6lw1GSbkUB0YoNcCAkA7aSfnzLQpR523rmLOm5BMg1tc9jjw RoZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=mFlxVqZIOdv3euFwLyuuaJdG6cZPX5ZgtTg+Jd3OndQ=; b=WOiA30EPE9tfOT72qycRdZNrrIiU+U9ZwbKDwqYWu333kzEuEdSBaOk0KIu5AdLx5d FbFRD+Z0w/DuHigaFqeZ//taAp6IqOK3VCYUojbwILgKJpem2ytI23KbskgqEWWAuccH 9uMg9cDyEv2EvOubJAQDt5ojPkhvUfYjHjHhvW3QwCrbms6UJaqUmyKub49uHW3Ya6LI lvHevBMZA7Ije+Sf/UOxz0HptMVHN3pjLj6QwNPyzc/nZfS3Fr6EDHJ9hJE1rdAYggYT vki6jRzCXFLeAmHbbRHBlNBfl4SvEv/TqOwH9XiEt3Yqt7zSzb0+KFOY/HL3KFZFfvnh en+w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y10-20020a056402134a00b00458e689f41fsi571699edw.415.2023.01.05.22.14.50; Thu, 05 Jan 2023 22:15:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231496AbjAFGGD convert rfc822-to-8bit (ORCPT <rfc822;tmhikaru@gmail.com> + 99 others); Fri, 6 Jan 2023 01:06:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230344AbjAFGF6 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 6 Jan 2023 01:05:58 -0500 Received: from fd01.gateway.ufhost.com (fd01.gateway.ufhost.com [61.152.239.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B8C91C41E for <linux-kernel@vger.kernel.org>; Thu, 5 Jan 2023 22:05:57 -0800 (PST) Received: from EXMBX166.cuchost.com (unknown [175.102.18.54]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "EXMBX166", Issuer "EXMBX166" (not verified)) by fd01.gateway.ufhost.com (Postfix) with ESMTP id 8FBB424E1B3; Fri, 6 Jan 2023 14:05:55 +0800 (CST) Received: from EXMBX066.cuchost.com (172.16.7.66) by EXMBX166.cuchost.com (172.16.6.76) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Fri, 6 Jan 2023 14:05:55 +0800 Received: from jsia-virtual-machine.localdomain (202.188.176.82) by EXMBX066.cuchost.com (172.16.6.66) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Fri, 6 Jan 2023 14:05:51 +0800 From: Sia Jee Heng <jeeheng.sia@starfivetech.com> To: <paul.walmsley@sifive.com>, <palmer@dabbelt.com>, <aou@eecs.berkeley.edu> CC: <linux-riscv@lists.infradead.org>, <linux-kernel@vger.kernel.org>, <jeeheng.sia@starfivetech.com>, <leyfoon.tan@starfivetech.com>, <mason.huo@starfivetech.com> Subject: [PATCH 2/3] RISC-V: mm: Enable huge page support to kernel_page_present() function Date: Fri, 6 Jan 2023 14:05:34 +0800 Message-ID: <20230106060535.104321-3-jeeheng.sia@starfivetech.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230106060535.104321-1-jeeheng.sia@starfivetech.com> References: <20230106060535.104321-1-jeeheng.sia@starfivetech.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [202.188.176.82] X-ClientProxiedBy: EXCAS061.cuchost.com (172.16.6.21) To EXMBX066.cuchost.com (172.16.6.66) X-YovoleRuleAgent: yovoleflag Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_MSPIKE_H2, SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754252671288429542?= X-GMAIL-MSGID: =?utf-8?q?1754252671288429542?= |
Series |
RISC-V Hibernation Support
|
|
Commit Message
JeeHeng Sia
Jan. 6, 2023, 6:05 a.m. UTC
Currently kernel_page_present() function doesn't support huge page detection causes the function to mistakenly return false to the hibernation core. Add huge page detection to the function to solve the problem. Signed-off-by: Sia Jee Heng <jeeheng.sia@starfivetech.com> Reviewed-by: Ley Foon Tan <leyfoon.tan@starfivetech.com> Reviewed-by: Mason Huo <mason.huo@starfivetech.com> --- arch/riscv/mm/pageattr.c | 6 ++++++ 1 file changed, 6 insertions(+)
Comments
Hi Sia, Thank you for the patch! Yet something to improve: [auto build test ERROR on 1f5abbd77e2c1787e74b7c2caffac97def78ba52] url: https://github.com/intel-lab-lkp/linux/commits/Sia-Jee-Heng/RISC-V-Change-suspend_save_csrs-and-suspend_restore_csrs-to-public-function/20230106-140835 base: 1f5abbd77e2c1787e74b7c2caffac97def78ba52 patch link: https://lore.kernel.org/r/20230106060535.104321-3-jeeheng.sia%40starfivetech.com patch subject: [PATCH 2/3] RISC-V: mm: Enable huge page support to kernel_page_present() function config: riscv-randconfig-r023-20230106 compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 8d9828ef5aa9688500657d36cd2aefbe12bbd162) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # install riscv cross compiling tool for clang build # apt-get install binutils-riscv-linux-gnu # https://github.com/intel-lab-lkp/linux/commit/c0a75e6ecfccdcd52d39b80c09dc6b10d32ea435 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Sia-Jee-Heng/RISC-V-Change-suspend_save_csrs-and-suspend_restore_csrs-to-public-function/20230106-140835 git checkout c0a75e6ecfccdcd52d39b80c09dc6b10d32ea435 # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=riscv olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=riscv SHELL=/bin/bash arch/riscv/mm/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> All errors (new ones prefixed by >>): >> arch/riscv/mm/pageattr.c:224:6: error: use of undeclared identifier 'pgtable_l5_enabled'; did you mean 'pgtable_l4_enabled'? if (pgtable_l5_enabled && p4d_leaf(*pud)) ^~~~~~~~~~~~~~~~~~ pgtable_l4_enabled arch/riscv/include/asm/pgtable.h:819:13: note: 'pgtable_l4_enabled' declared here extern bool pgtable_l4_enabled; ^ 1 error generated. vim +224 arch/riscv/mm/pageattr.c 207 208 bool kernel_page_present(struct page *page) 209 { 210 unsigned long addr = (unsigned long)page_address(page); 211 pgd_t *pgd; 212 pud_t *pud; 213 p4d_t *p4d; 214 pmd_t *pmd; 215 pte_t *pte; 216 217 pgd = pgd_offset_k(addr); 218 if (!pgd_present(*pgd)) 219 return false; 220 221 p4d = p4d_offset(pgd, addr); 222 if (!p4d_present(*p4d)) 223 return false; > 224 if (pgtable_l5_enabled && p4d_leaf(*pud))
Hi Sia, Thank you for the patch! Yet something to improve: [auto build test ERROR on 1f5abbd77e2c1787e74b7c2caffac97def78ba52] url: https://github.com/intel-lab-lkp/linux/commits/Sia-Jee-Heng/RISC-V-Change-suspend_save_csrs-and-suspend_restore_csrs-to-public-function/20230106-140835 base: 1f5abbd77e2c1787e74b7c2caffac97def78ba52 patch link: https://lore.kernel.org/r/20230106060535.104321-3-jeeheng.sia%40starfivetech.com patch subject: [PATCH 2/3] RISC-V: mm: Enable huge page support to kernel_page_present() function config: riscv-rv32_defconfig compiler: riscv32-linux-gcc (GCC) 12.1.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/intel-lab-lkp/linux/commit/c0a75e6ecfccdcd52d39b80c09dc6b10d32ea435 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Sia-Jee-Heng/RISC-V-Change-suspend_save_csrs-and-suspend_restore_csrs-to-public-function/20230106-140835 git checkout c0a75e6ecfccdcd52d39b80c09dc6b10d32ea435 # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=riscv olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=riscv SHELL=/bin/bash If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> All errors (new ones prefixed by >>): arch/riscv/mm/pageattr.c: In function 'kernel_page_present': >> arch/riscv/mm/pageattr.c:224:13: error: 'pgtable_l5_enabled' undeclared (first use in this function); did you mean 'pgtable_l4_enabled'? 224 | if (pgtable_l5_enabled && p4d_leaf(*pud)) | ^~~~~~~~~~~~~~~~~~ | pgtable_l4_enabled arch/riscv/mm/pageattr.c:224:13: note: each undeclared identifier is reported only once for each function it appears in vim +224 arch/riscv/mm/pageattr.c 207 208 bool kernel_page_present(struct page *page) 209 { 210 unsigned long addr = (unsigned long)page_address(page); 211 pgd_t *pgd; 212 pud_t *pud; 213 p4d_t *p4d; 214 pmd_t *pmd; 215 pte_t *pte; 216 217 pgd = pgd_offset_k(addr); 218 if (!pgd_present(*pgd)) 219 return false; 220 221 p4d = p4d_offset(pgd, addr); 222 if (!p4d_present(*p4d)) 223 return false; > 224 if (pgtable_l5_enabled && p4d_leaf(*pud))
diff --git a/arch/riscv/mm/pageattr.c b/arch/riscv/mm/pageattr.c index 86c56616e5de..fb59d494d708 100644 --- a/arch/riscv/mm/pageattr.c +++ b/arch/riscv/mm/pageattr.c @@ -221,14 +221,20 @@ bool kernel_page_present(struct page *page) p4d = p4d_offset(pgd, addr); if (!p4d_present(*p4d)) return false; + if (pgtable_l5_enabled && p4d_leaf(*pud)) + return true; pud = pud_offset(p4d, addr); if (!pud_present(*pud)) return false; + if (pgtable_l4_enabled && pud_leaf(*pud)) + return true; pmd = pmd_offset(pud, addr); if (!pmd_present(*pmd)) return false; + if (pmd_leaf(*pmd)) + return true; pte = pte_offset_kernel(pmd, addr); return pte_present(*pte);