Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp7502537rwl; Thu, 23 Mar 2023 05:22:10 -0700 (PDT) X-Google-Smtp-Source: AK7set/sWPkWeEZgiMMwbSJT3cTM0wrXv/63u70c/9HdIsJtEJtGBzP+XixUI6M8x4d9L6IYwlFJ X-Received: by 2002:a17:906:15d5:b0:8b1:7e23:5041 with SMTP id l21-20020a17090615d500b008b17e235041mr10570162ejd.39.1679574130103; Thu, 23 Mar 2023 05:22:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679574130; cv=none; d=google.com; s=arc-20160816; b=ObfEUTdexYkRL5Ap+3kPzv+EnrmP3oNR4BcpthRGGxQV8Yc71sERmAvtsrrkv9QK31 BOKTIhGVSdFZ9cesvza/Uc4js0LXZf8xg2n0Goz0fpMvJs4ldwPUw7xWjc1pgDtPXuCH 2hjb5VZnndpH8VmM7ns5exK2ZC/DbnfJEuBvNYHAiTUw5JCyg8MOQp2NmlrCyZ9MvLFX EX69uHPXrdNW3AiJmvnMuB9sw0KiFuoSOCncQKyLq+08fFy/iXAz9GAYdr9duUGgJdYv qXhrVWTIdk5vSP2CH5fCGuY8CeUk22ELFyZDDC9I8K4VgEf1Zg2DKx5ChVVuL0QrSgQc /ocA== 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=GUGGmJNIiB2tF8GpRaO2v6aJCn8Q0P89mXNxX4DzMis=; b=q90yEbnfa6/cp1OUCmEJIxcHOud0rxyVT5XF9LCgebzuGk3kojTTaR3aKjMGP2M611 bmYbmOgJqyMLnBv/8ZSrdo8y09jqUfFSNGMTz79nsVejmrPgUePC33vJstnt6GQwyaqF OuyEWPvg6Uzui2nxOHv23sdyMvWkOj9DJagQS4gaQPScBl4oHD3f/DTAhFOlDCwcKHSf wtuQuSQOJxcNuaV2dYm3y54lqb9aE52nlRBHd3alOvPZFiTgdq3EcrLicbQPoBfzuDT5 U6VPAcrnWIx4x5OIueCA21YD9TJvOxxu364AAICiOHJddeQHIzRtrL3qtuvhMsX+Q7on r9lA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=mPuBjeJh; 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 21-20020a170906225500b0092554df06ffsi19784813ejr.286.2023.03.23.05.21.46; Thu, 23 Mar 2023 05:22:10 -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=@ventanamicro.com header.s=google header.b=mPuBjeJh; 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 S231843AbjCWMTp (ORCPT + 99 others); Thu, 23 Mar 2023 08:19:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231526AbjCWMTM (ORCPT ); Thu, 23 Mar 2023 08:19:12 -0400 Received: from mail-ua1-x932.google.com (mail-ua1-x932.google.com [IPv6:2607:f8b0:4864:20::932]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8395E2B2BF for ; Thu, 23 Mar 2023 05:18:29 -0700 (PDT) Received: by mail-ua1-x932.google.com with SMTP id x33so14797192uaf.12 for ; Thu, 23 Mar 2023 05:18:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1679573908; 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=GUGGmJNIiB2tF8GpRaO2v6aJCn8Q0P89mXNxX4DzMis=; b=mPuBjeJhfwjWVU2IiF589l1xztdu4iLvv5rYXSrDnDEmnOEfiaXr3e+6o21DzYJE6d TLtJGe7ge2fz5OHM6vcRKkB/g2EBVZBkguKaL7J491mqY/k7sqn3fSj4HW0nW3/NvB8S wrHnPIn9cbH+Ho2ekBbbo8KoaI7vNCQmWhyDxjnh5XXLzx5XFFeHFhi9pwsv+CypJv3V aZU5xlXrc8pmPv1fAu8dCvL7E4OQ04FpN0t0EcS7UE9vqVHzROz4LXn2DSKws//RaUJr cJ/U1kxwksVsO4tpBlDs6C8Zc/SDPt+TopdFtXa/7qhGmQd9ofI7MN/6uQ02tCpZZm6V R9mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679573908; 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=GUGGmJNIiB2tF8GpRaO2v6aJCn8Q0P89mXNxX4DzMis=; b=E5LslAvFq3eTUi9nvDzHsOFplkwdWsvSsqgPz30GriE+9lbO9dBtB6ECdR/JifY/QP 8uMCK+gEY8s0t82QK8aZP0Z2+2qymlanIu3SiwFHKz0tVtKyXodxq5mkxaKzTZOEHndB QmbnxKLBT2IiR12y8gTQrvtxh9qh42JjVJmcQLpqkOg3RFyZRLhQWMq8mrw+u1XXRgP+ bpwd143cJB36/rI0ef05DF15aUjOutYhRSS9Yy4d1rzbwdwxMZxtaH6+1P5bFmslTW8V 4KREFBrfcxkqyan8flLggX3mReB9oU+l0+WsCoet6bqHal62wfCy+Dt1CtSase81Hyp8 OTBQ== X-Gm-Message-State: AAQBX9fApqq1JUoxCjF6H/zugDGu7rDd46UYLZyJvYvngwHeEl3NvlAc 5MeuObbcTOEJH1yFj7ILwuiibMTOY1K5N/ItBcQw8Q== X-Received: by 2002:a05:6130:c0b:b0:755:9b3:fef8 with SMTP id cg11-20020a0561300c0b00b0075509b3fef8mr5092826uab.2.1679573908493; Thu, 23 Mar 2023 05:18:28 -0700 (PDT) MIME-Version: 1.0 References: <20230316131711.1284451-1-alexghiti@rivosinc.com> In-Reply-To: <20230316131711.1284451-1-alexghiti@rivosinc.com> From: Anup Patel Date: Thu, 23 Mar 2023 17:48:16 +0530 Message-ID: Subject: Re: [PATCH v8 0/4] riscv: Use PUD/P4D/PGD pages for the linear mapping To: Alexandre Ghiti Cc: Catalin Marinas , Will Deacon , Paul Walmsley , Palmer Dabbelt , Albert Ou , Rob Herring , Frank Rowand , Mike Rapoport , Andrew Morton , Anup Patel , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-mm@kvack.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 Hi Alex, On Thu, Mar 16, 2023 at 6:48=E2=80=AFPM Alexandre Ghiti wrote: > > This patchset intends to improve tlb utilization by using hugepages for > the linear mapping. > > As reported by Anup in v6, when STRICT_KERNEL_RWX is enabled, we must > take care of isolating the kernel text and rodata so that they are not > mapped with a PUD mapping which would then assign wrong permissions to > the whole region: it is achieved by introducing a new memblock API. > > Another patch makes use of this new API in arm64 which used some sort of > hack to solve this issue: it was built/boot tested successfully. > > base-commit-tag: v6.3-rc1 > > v8: > - Fix rv32, as reported by Anup > - Do not modify memblock_isolate_range and fixes comment, as suggested by= Mike > - Use the new memblock API for crash kernel too in arm64, as suggested by= Andrew > - Fix arm64 double mapping (which to me did not work in v7), but ends up = not > being pretty at all, will wait for comments from arm64 reviewers, but > this patch can easily be dropped if they do not want it. > > v7: > - Fix Anup bug report by introducing memblock_isolate_memory which > allows us to split the memblock mappings and then avoid to map the > the PUD which contains the kernel as read only > - Add a patch to arm64 to use this newly introduced API > > v6: > - quiet LLVM warning by casting phys_ram_base into an unsigned long > > v5: > - Fix nommu builds by getting rid of riscv_pfn_base in patch 1, thanks > Conor > - Add RB from Andrew > > v4: > - Rebase on top of v6.2-rc3, as noted by Conor > - Add Acked-by Rob > > v3: > - Change the comment about initrd_start VA conversion so that it fits > ARM64 and RISCV64 (and others in the future if needed), as suggested > by Rob > > v2: > - Add a comment on why RISCV64 does not need to set initrd_start/end that > early in the boot process, as asked by Rob > > Alexandre Ghiti (4): > riscv: Get rid of riscv_pfn_base variable > mm: Introduce memblock_isolate_memory > arm64: Make use of memblock_isolate_memory for the linear mapping > riscv: Use PUD/P4D/PGD pages for the linear mapping Kernel boot fine on RV64 but there is a failure which is still not addressed. You can see this failure as following message in kernel boot log: 0.000000] Failed to add a System RAM resource at 80200000 Regards, Anup > > arch/arm64/mm/mmu.c | 25 +++++++++++------ > arch/riscv/include/asm/page.h | 19 +++++++++++-- > arch/riscv/mm/init.c | 53 ++++++++++++++++++++++++++++------- > arch/riscv/mm/physaddr.c | 16 +++++++++++ > drivers/of/fdt.c | 11 ++++---- > include/linux/memblock.h | 1 + > mm/memblock.c | 20 +++++++++++++ > 7 files changed, 119 insertions(+), 26 deletions(-) > > -- > 2.37.2 >