From mboxrd@z Thu Jan 1 00:00:00 1970 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 423DBC6FD1C for ; Thu, 23 Mar 2023 12:18:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D5A746B0075; Thu, 23 Mar 2023 08:18:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D09E86B0078; Thu, 23 Mar 2023 08:18:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BFA2C6B007B; Thu, 23 Mar 2023 08:18:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id B226B6B0075 for ; Thu, 23 Mar 2023 08:18:31 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 69E201A06CE for ; Thu, 23 Mar 2023 12:18:31 +0000 (UTC) X-FDA: 80600066022.27.C01A5DC Received: from mail-ua1-f47.google.com (mail-ua1-f47.google.com [209.85.222.47]) by imf07.hostedemail.com (Postfix) with ESMTP id 9D82640019 for ; Thu, 23 Mar 2023 12:18:29 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=ventanamicro.com header.s=google header.b=mPuBjeJh; spf=pass (imf07.hostedemail.com: domain of apatel@ventanamicro.com designates 209.85.222.47 as permitted sender) smtp.mailfrom=apatel@ventanamicro.com; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1679573909; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=GUGGmJNIiB2tF8GpRaO2v6aJCn8Q0P89mXNxX4DzMis=; b=Hfy9HZRxkZhsKWxWMhY6dgk4xiNHv77U2Lq4mBzJNV9vNsSw0HI0tOOzv0GmPmw8YaauLF D1qf57c/BV7y0oKKouWbbHBrbn3lG2Kv8qZoe/zP8U8Y7WuPj1Y8yYRmTJSFtv2+sx5La3 fjNCGrJ4YIPzQJCd9p2vOH6gCmQ/NuI= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=ventanamicro.com header.s=google header.b=mPuBjeJh; spf=pass (imf07.hostedemail.com: domain of apatel@ventanamicro.com designates 209.85.222.47 as permitted sender) smtp.mailfrom=apatel@ventanamicro.com; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1679573909; a=rsa-sha256; cv=none; b=EdcxZsnVy2SoJZzSlHmVX71xCIx2N9FqikJCZmNe/dm8r3UVWGoWJkVCf0CGo3OabNr0xN zqRpT6oxPMga7BNJPIU+GqvK2gq+lq5DKas8btxxko9pXKe3mlgSFESa/cxFk721988//y R4LplOjY/tR/Fb5O5ZxZTTPiAkU9MN0= Received: by mail-ua1-f47.google.com with SMTP id i22so14819371uat.8 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=l5mHDHz5h5qghuaNTlt3MwTvtsf5QyCUKRwzTcJlEKR4tDSYtL2cAmqXymckoVqO6T +TOcxCL79jxavNPS4y9cQLs2+b5hiCjIK4snoThL4TKCRmTwkrVeHrMNCso2E+yP9lt1 25s4QmqDxFjPICfhgivmwos0LSGg3QmibWj+rVWfyma7RW5iFG5QI9Zq+qjCsF1IZ/WK 8X/+nuPvorXdjHQGiFdNe83/BaHCz0Z7TlVwXKPfyX/xIyx4xmv3v4ocLc0aRHP5kaXJ dshMK/TeLXtCvSDQokldOQjXmSW/Uhfx8vL6Oz8pyCYKJ73XCVMAr2R/Yu1Vpd/0aFzq Ixeg== X-Gm-Message-State: AAQBX9e/Y5/sxoVCjlRZcqfwWnp+KcoZjsm++dv4Agl/QfnbCUZ5DwWM YFAm+cerl2UlHYywAdqMCAUSrw8hHXaVIwtaSy1yyA== X-Google-Smtp-Source: AK7set9Ku140oLgFHLDCQ0mGT17Dc0+6TsKKP+riuE/qzlt8WH/QLk5OUjHO552MQkVQo+HaNEH3OYbtH5GCZ93/ARU= 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-Stat-Signature: yoxmbnd7ru6s1utrojoys861i5kcioun X-Rspam-User: X-Rspamd-Queue-Id: 9D82640019 X-Rspamd-Server: rspam06 X-HE-Tag: 1679573909-453541 X-HE-Meta: U2FsdGVkX1/jwBOzbZa8beVFHxvDkAJF22Mvu8Qo4dlKYiEQQJEM7x/9wGSv5F95IiwtRLF/v63F/e21vTOYV9aHpFTEmXOWvmeZyljCCNovkw9QK17YMMehojEae1FcItIN78UewX5hSRZwQjVHlGJM4VKmDR9aa1s0tq38kzKqa46POGbhV0Hr+v8WS3NTp5H5z/QNufgW0lBig1u5AECrJkjv6yZD6BneUNTTLO86nUhZ1yeYx54yd0kGxIZMEXxkSJM3be+idMyhlxLRhb4WSUQNPgPyVZFFNNHUcp10SiuyCSnYcrHUyG5eIprbziKLNNQnrS7/vXGiyGSxTxe5FMngSbPSSin7W1kyN07LbwSDPs4puUc0UtX3aKkeMfUmznrD4LTiPYumH+h7FhHD66Rmqx1i7Tct2IkWV1N4mQ7AkkVqgOh0hbnkRK13pkjGBFsoFs9kabjW3Bnuhfsf16AZx/FAVpCb6Cqa1UoD+pvhHaT55nIF0asfO3IdWAoW1tdt74am7VN5+DSDJ4NknG6bbQUiBhNBId85lnj/F/1NJC+QEzFaT2awhijM8L1xPaYzJVCbeplqJp5jp30sv7vcDF1ZrcRhl4/2P37UBivGhNXnLTu95xAZ/dtr5c9pXhbPQZUpcrG3mGV3z0upaHmVZKK7T2zH3vXzD7GTz9prLzM7AiqH9JvtsTZb3VTezC/5qNbCKDK7bD9QuMjbPwULJfpqhWegM2LXBWascaMjF2n9/xOC0C2543jbYVamLqPamIjBbGFDXl6TcNJqBF1tgIj6ALpvuNSc8qZ4vxx2GhG/vTvcbzoN4z45J1MsK23UbvoHlnD6F0MQ2PSjPAJtgP5M+SmDzEPXoh/aCeQkfHBYTSLGnAJRZODeNSLx7MKdwAfFbVSm1DQXXm+0aoCGumi39jqutQaPM5KJJKC5tCJbNcvWmIKhe9ZnsDwxsAGXvu0xyMOk5jK bVp0o0P9 HcCkLtvDFkT6s8gaGcSz6DbF+KSXm8B1mXP25xTfjgHJVgedUH1+5L9P8zv96tCFEG9yX0UwOSFzhgQ7C9K7aBvIvYfngXfm72i8KWBPcW9MmxhVjzG5kI14nLZFJpeIJnPexzoFgqQcOLi7lWTSDbA4G2nUUXFNJDV8N3XRhRY2aUPsouLCRQqMcl1oZ63dTuBX1xAu3vodyUskVN6P5NclR4X0XJIv4BcUl/2sa6lUCYvxmhnZuVrkrNRvPNWMSzUxNKtYWyBCKwgXsu79LIAhH+Mp57mu6XXScbDL4jAASsIN6O743s5CZe1q3jvFgo1x1QyC2koqsv89g7LZeOVQGl0KyTMsoZ9AS2paMKJBACIVHbX1pTVaOfYU7/0isByiO 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: 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 >