Message ID | 20230221023523.1498500-4-jeeheng.sia@starfivetech.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1633667wrn; Mon, 20 Feb 2023 18:38:31 -0800 (PST) X-Google-Smtp-Source: AK7set8MTHa5UVj7o+Rt2WrwTdP774OQ6PUdDyuPxpvTh7ZQYmYGltKAvSD8RmqSjmhToL2Xo3c/ X-Received: by 2002:a17:906:a96:b0:8b2:d30:e721 with SMTP id y22-20020a1709060a9600b008b20d30e721mr13578622ejf.71.1676947111515; Mon, 20 Feb 2023 18:38:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676947111; cv=none; d=google.com; s=arc-20160816; b=qjDkPVQ9XcvC/e71m+Av/bCuvo6B1qfQpD04O1V5nTpY2/WNtsjj5KC81ZKNEjIzHX 1wFCqpBhcJdx/McZ4VXRIWdkLbEejnmrNaZ/4b5dRVoSVvGNYfSrHrvy6VGF0kUwqLl9 hB4ZFhBSAh7rpV0yUiUxFd8CcyhJzEkY0xwNrc7TskcH/cMHg3x9b0I4SK8JPeR6TFlU pqjUJy/BjzfQVygnyLBBxatGxtZZnAiS9GSuiAstBexqGWj25e4SeaItxBd3xLkvPx8w kBlaANz1ce/pW6yJzhF3rZZ9oHU3tYwel1D9lmwjnIGyyC32OMSbOPiYH7cT+DKRLfSc gWPA== 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=vJoBMxZN6k1Mlc3SwopekwVLe51/jpVt8zpRk20REtI=; b=hvDycWvndfe4V8p10JxNr8XQvhtSyFUnH+MBhTAIiCbuEPbitrPgt1dOm2AV+FvCc7 OJc7LdNsyy34OwJNk26+S6tpctnP+TX+UHYGTfnHGl2DX0P+3UtUyn69IzTGsT7HBCSv 6ipYkUMjV9LUcobLnP+wg123tJG32GTJ0A0gjtMVS3VCntwZTurACUVGmR8QgoGd/XVs 0VJJrxxAFmE/KgrY7N8B9NQ15X5y69KQVpQaT2r3Bf99u4f6UvC4hiUdI5zcGKxzfzmm TQGHwyckbHbdWZhyXYZ5FD9mJafqVNZzEIs/YKTWCmkA0S6Bs9B8N2ZOGE4Vu+Z/JmKB ytWg== 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 gg35-20020a17090689a300b008c254523c3dsi7931489ejc.56.2023.02.20.18.38.08; Mon, 20 Feb 2023 18:38:31 -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 S233034AbjBUCgS convert rfc822-to-8bit (ORCPT <rfc822;kautuk.consul.80@gmail.com> + 99 others); Mon, 20 Feb 2023 21:36:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232965AbjBUCgO (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 20 Feb 2023 21:36:14 -0500 Received: from fd01.gateway.ufhost.com (fd01.gateway.ufhost.com [61.152.239.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B942511EB7 for <linux-kernel@vger.kernel.org>; Mon, 20 Feb 2023 18:35:42 -0800 (PST) Received: from EXMBX165.cuchost.com (unknown [175.102.18.54]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "EXMBX165", Issuer "EXMBX165" (not verified)) by fd01.gateway.ufhost.com (Postfix) with ESMTP id 911F724E2E7; Tue, 21 Feb 2023 10:35:41 +0800 (CST) Received: from EXMBX066.cuchost.com (172.16.7.66) by EXMBX165.cuchost.com (172.16.6.75) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Tue, 21 Feb 2023 10:35:41 +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; Tue, 21 Feb 2023 10:35:38 +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 v4 3/4] RISC-V: mm: Enable huge page support to kernel_page_present() function Date: Tue, 21 Feb 2023 10:35:22 +0800 Message-ID: <20230221023523.1498500-4-jeeheng.sia@starfivetech.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230221023523.1498500-1-jeeheng.sia@starfivetech.com> References: <20230221023523.1498500-1-jeeheng.sia@starfivetech.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [202.188.176.82] X-ClientProxiedBy: EXCAS066.cuchost.com (172.16.6.26) 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?1758406494705849232?= X-GMAIL-MSGID: =?utf-8?q?1758406494705849232?= |
Series |
RISC-V Hibernation Support
|
|
Commit Message
JeeHeng Sia
Feb. 21, 2023, 2:35 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. Fixes tag: commit 9e953cda5cdf ("riscv: Introduce huge page support for 32/64bit kernel") 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 | 8 ++++++++ 1 file changed, 8 insertions(+)
Comments
On Tue, Feb 21, 2023 at 10:35:22AM +0800, Sia Jee Heng wrote: > 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. > > Fixes tag: commit 9e953cda5cdf ("riscv: > Introduce huge page support for 32/64bit kernel") This should be formatted as below (no line wrap and no 'tag' in the tag) Fixes: 9e953cda5cdf ("riscv: Introduce huge page support for 32/64bit kernel") > > 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 | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/arch/riscv/mm/pageattr.c b/arch/riscv/mm/pageattr.c > index 86c56616e5de..ea3d61de065b 100644 > --- a/arch/riscv/mm/pageattr.c > +++ b/arch/riscv/mm/pageattr.c > @@ -217,18 +217,26 @@ bool kernel_page_present(struct page *page) > pgd = pgd_offset_k(addr); > if (!pgd_present(*pgd)) > return false; > + if (pgd_leaf(*pgd)) > + return true; > > p4d = p4d_offset(pgd, addr); > if (!p4d_present(*p4d)) > return false; > + if (p4d_leaf(*p4d)) > + return true; > > pud = pud_offset(p4d, addr); > if (!pud_present(*pud)) > return false; > + if (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); > -- > 2.34.1 > > Otherwise, Reviewed-by: Andrew Jones <ajones@ventanamicro.com> Thanks, drew
> -----Original Message----- > From: Andrew Jones <ajones@ventanamicro.com> > Sent: Thursday, 23 February, 2023 2:57 PM > To: JeeHeng Sia <jeeheng.sia@starfivetech.com> > Cc: paul.walmsley@sifive.com; palmer@dabbelt.com; aou@eecs.berkeley.edu; linux-riscv@lists.infradead.org; linux- > kernel@vger.kernel.org; Leyfoon Tan <leyfoon.tan@starfivetech.com>; Mason Huo <mason.huo@starfivetech.com> > Subject: Re: [PATCH v4 3/4] RISC-V: mm: Enable huge page support to kernel_page_present() function > > On Tue, Feb 21, 2023 at 10:35:22AM +0800, Sia Jee Heng wrote: > > 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. > > > > Fixes tag: commit 9e953cda5cdf ("riscv: > > Introduce huge page support for 32/64bit kernel") > > This should be formatted as below (no line wrap and no 'tag' in the tag) > > Fixes: 9e953cda5cdf ("riscv: Introduce huge page support for 32/64bit kernel") > > > > > 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 | 8 ++++++++ > > 1 file changed, 8 insertions(+) > > > > diff --git a/arch/riscv/mm/pageattr.c b/arch/riscv/mm/pageattr.c > > index 86c56616e5de..ea3d61de065b 100644 > > --- a/arch/riscv/mm/pageattr.c > > +++ b/arch/riscv/mm/pageattr.c > > @@ -217,18 +217,26 @@ bool kernel_page_present(struct page *page) > > pgd = pgd_offset_k(addr); > > if (!pgd_present(*pgd)) > > return false; > > + if (pgd_leaf(*pgd)) > > + return true; > > > > p4d = p4d_offset(pgd, addr); > > if (!p4d_present(*p4d)) > > return false; > > + if (p4d_leaf(*p4d)) > > + return true; > > > > pud = pud_offset(p4d, addr); > > if (!pud_present(*pud)) > > return false; > > + if (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); > > -- > > 2.34.1 > > > > > > Otherwise, > > Reviewed-by: Andrew Jones <ajones@ventanamicro.com> noted with thanks > > Thanks, > drew
On 2/21/23 03:35, Sia Jee Heng wrote: > 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. > > Fixes tag: commit 9e953cda5cdf ("riscv: > Introduce huge page support for 32/64bit kernel") > > 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 | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/arch/riscv/mm/pageattr.c b/arch/riscv/mm/pageattr.c > index 86c56616e5de..ea3d61de065b 100644 > --- a/arch/riscv/mm/pageattr.c > +++ b/arch/riscv/mm/pageattr.c > @@ -217,18 +217,26 @@ bool kernel_page_present(struct page *page) > pgd = pgd_offset_k(addr); > if (!pgd_present(*pgd)) > return false; > + if (pgd_leaf(*pgd)) > + return true; > > p4d = p4d_offset(pgd, addr); > if (!p4d_present(*p4d)) > return false; > + if (p4d_leaf(*p4d)) > + return true; > > pud = pud_offset(p4d, addr); > if (!pud_present(*pud)) > return false; > + if (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); Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com> Thanks, Alex
diff --git a/arch/riscv/mm/pageattr.c b/arch/riscv/mm/pageattr.c index 86c56616e5de..ea3d61de065b 100644 --- a/arch/riscv/mm/pageattr.c +++ b/arch/riscv/mm/pageattr.c @@ -217,18 +217,26 @@ bool kernel_page_present(struct page *page) pgd = pgd_offset_k(addr); if (!pgd_present(*pgd)) return false; + if (pgd_leaf(*pgd)) + return true; p4d = p4d_offset(pgd, addr); if (!p4d_present(*p4d)) return false; + if (p4d_leaf(*p4d)) + return true; pud = pud_offset(p4d, addr); if (!pud_present(*pud)) return false; + if (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);