Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp27695088rwd; Tue, 4 Jul 2023 06:39:37 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7PQOi7MQ8239F9+tz1oTNNyqb2dgffNtQKwLHSvSAc4aqh4n5CXeDQmW7u1zwAKWyBqcym X-Received: by 2002:a05:6808:1445:b0:3a1:eb7c:21d8 with SMTP id x5-20020a056808144500b003a1eb7c21d8mr17242409oiv.39.1688477977507; Tue, 04 Jul 2023 06:39:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688477977; cv=none; d=google.com; s=arc-20160816; b=Mx97wzA+olw5fgJ2agjOO8IvXRN8DCKl2QGwJ0kPXDPg+l+tEn26IlWxhLSbikWwj1 lM10h5ZisJ+WsqpPQVu2cprRR8ZbX18+ZYeekuQjsFCOsx/pPqDCVscfkR4sBD4dSqv4 bQnoQrckqlJ/0kSDp2Mknrc7UgmOqPdBcjbnifoACRAEePn78JIvYopr5fnmVeJjaT90 igpCjR+lKTBSJb8AtRbj0wxbKO9pFA2ejQwe+6kWoIgtEONbF1EDSUaNvEe/UqkIjgfz 9Ij6x0O8jglhI3OYyGOa/dABG50bwTPTCkOcualsGspdlOOgmbNC3eRdpXudrtknHMC4 Uf4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=XTZLLHkFTBtSMOJnP8CLim0/TijHiGLdbtLujLrTJFk=; fh=FXjyl2X36qs8zaJst07vXsEtiGObZePQB3eCXdUUeuU=; b=hq8Oy1esdmp12ruRwzNhG1TO0lKH9qlCopbugD8g943SamEXsAvPzJmk37ALzjAni2 V6DLxFVw3BxtzAet5D5MXL4IXQxxtpncpBNRlKQS5/9TiBanJW7G9GLne+VDCQzm4miN H8HphRCYRAkSqCAcxFMG1ZC9xTpQIAv/SkmBpUkwO/bfnly8afiueopjOiknMsfcZbo8 S/ie/0AFwzFKIFDTLbktA+oYK5uYiCQym9w9WX/gz+caTakkThCHpb3OSopTUVtqSmGy R/F4LaOscm7Rjy5QxrW/5WAgqAWYb/4TnC93j6XXO2U6vfV0OYylR3C5uxB8AHo+IR+r K70Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rivosinc-com.20221208.gappssmtp.com header.s=20221208 header.b=a8BjrrHY; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h22-20020a056a001a5600b00666eb3ab9e3si20125610pfv.387.2023.07.04.06.39.20; Tue, 04 Jul 2023 06:39:37 -0700 (PDT) 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; dkim=pass header.i=@rivosinc-com.20221208.gappssmtp.com header.s=20221208 header.b=a8BjrrHY; 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 S230469AbjGDNSB (ORCPT + 99 others); Tue, 4 Jul 2023 09:18:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231338AbjGDNR6 (ORCPT ); Tue, 4 Jul 2023 09:17:58 -0400 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 38CDD1737 for ; Tue, 4 Jul 2023 06:17:16 -0700 (PDT) Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-3143798f542so2252520f8f.2 for ; Tue, 04 Jul 2023 06:17:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20221208.gappssmtp.com; s=20221208; t=1688476613; x=1691068613; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=XTZLLHkFTBtSMOJnP8CLim0/TijHiGLdbtLujLrTJFk=; b=a8BjrrHYfZMyz6yrmzXkUQ8MdIVci4LJxe4cdhZUl/5LFBPZ5PEzheK1kIBrgpRGWg DepKSRrGwybfjUMLKtQ1DzLD4er/RC9rEEilDlaNE9uKSx+iqFITmKcrPtHXWVlTT6Pm 96XI2v6C2G+crKr1K1YVSLYiB2CnYblHXYqinyVdfh53SCM8TzMjHxZpvgi+KHiHzKDq XrjTFmeV8qE3mcOIYZDJnxp+vZsPi5AoSSXosEdRDkQc6SrbOonIGn1sXNPQPFdGl5ET yyPNLSaezl7UTju75iKCyfC+8y1/Af+9r8i/C+B3qOjkebNRw3pHCaRAC2LetQKTWlW3 FHSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688476613; x=1691068613; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XTZLLHkFTBtSMOJnP8CLim0/TijHiGLdbtLujLrTJFk=; b=eJosVGg1VUJyGFufjOQjENIdmEVaJVFJcVDmd4fO+LZdAxWSk8tYYNMiXMNc0YJI7G EWS5gXoxJSy40wlg7f/1oYMjsqJcA+L1DDK7RHr4d+RIU7CC7XD6P9YHbIVmw8P72B// DLJof05FrstVdKZdV5j/Y9xAtIak+/tGo6bVax8AvTKjVxbQKtRsE0xEfgmppZafKsSe Yynqh8dk76IlZ5pMHg+vhIiQJJXNJ7fnNvyjrgsvK8Qy2FwjXL//Hs/lggL/P5n6d+/a Qh7zrMdywgeN+b1BI6ictvP95D8epTGCdx0EQfn/6erElWLNZe1aWvK6CspVM0j0XeDE Qo5Q== X-Gm-Message-State: ABy/qLYocilgAiTWtKDZqstl5a32FeqaeECL07rKqX8XyWNU4pX0JH+d 2Fs2oDoKriRqAaqmLRVd1PKAcMdtts/Xcxiz01sIiw== X-Received: by 2002:a5d:670a:0:b0:313:eadf:b82d with SMTP id o10-20020a5d670a000000b00313eadfb82dmr9469272wru.69.1688476613446; Tue, 04 Jul 2023 06:16:53 -0700 (PDT) MIME-Version: 1.0 References: <20230704121837.248976-1-alexghiti@rivosinc.com> <20230704-emblem-rubble-e4a3a87cb98e@wendy> In-Reply-To: <20230704-emblem-rubble-e4a3a87cb98e@wendy> From: Alexandre Ghiti Date: Tue, 4 Jul 2023 15:16:42 +0200 Message-ID: Subject: Re: [PATCH] riscv: Start of DRAM should at least be aligned on PMD size for the direct mapping To: Conor Dooley Cc: Paul Walmsley , Palmer Dabbelt , Albert Ou , Song Shuai , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 4, 2023 at 2:26=E2=80=AFPM Conor Dooley wrote: > > Hey Alex, > > On Tue, Jul 04, 2023 at 02:18:37PM +0200, Alexandre Ghiti wrote: > > So that we do not end up mapping the whole linear mapping using 4K > > pages, which is slow at boot time, and also very likely at runtime. > > > > So make sure we align the start of DRAM on a PMD boundary. > > > > Signed-off-by: Alexandre Ghiti > > Obviously correct me if I am wrong here, but was this not reported by > Song Shuai as a regression? > Accordingly, should this not have Reported-by, Closes/Link & Fixes tags? Sure we should add the reported by from Song as he did the proper report :) Reported-by: Song Shuai Closes: https://lore.kernel.org/linux-riscv/20230625140931.1266216-1-songsh= uaishuai@tinylab.org/ And yes sorry, I thought it was there before, but it was actually when I retrieved the first 2MB that the problem appeared, so: Fixes: 3335068f8721 ("riscv: Use PUD/P4D/PGD pages for the linear mapping") Thanks! > > Cheers, > Conor. > > > --- > > arch/riscv/mm/init.c | 7 ++++++- > > 1 file changed, 6 insertions(+), 1 deletion(-) > > > > diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c > > index 4fa420faa780..4a43ec275c6d 100644 > > --- a/arch/riscv/mm/init.c > > +++ b/arch/riscv/mm/init.c > > @@ -214,8 +214,13 @@ static void __init setup_bootmem(void) > > memblock_reserve(vmlinux_start, vmlinux_end - vmlinux_start); > > > > phys_ram_end =3D memblock_end_of_DRAM(); > > + > > + /* > > + * Make sure we align the start of the memory on a PMD boundary s= o that > > + * at worst, we map the linear mapping with PMD mappings. > > + */ > > if (!IS_ENABLED(CONFIG_XIP_KERNEL)) > > - phys_ram_base =3D memblock_start_of_DRAM(); > > + phys_ram_base =3D memblock_start_of_DRAM() & PMD_MASK; > > > > /* > > * In 64-bit, any use of __va/__pa before this point is wrong as = we > > -- > > 2.39.2 > >