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 2864CC6FD1F for ; Sat, 11 Mar 2023 11:24:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 255B96B0071; Sat, 11 Mar 2023 06:24:55 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 206C86B0074; Sat, 11 Mar 2023 06:24:55 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0D1718E0001; Sat, 11 Mar 2023 06:24:55 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id F01C16B0071 for ; Sat, 11 Mar 2023 06:24:54 -0500 (EST) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id C4A7916017A for ; Sat, 11 Mar 2023 11:24:54 +0000 (UTC) X-FDA: 80556385308.10.0DDF30E Received: from mail-ed1-f48.google.com (mail-ed1-f48.google.com [209.85.208.48]) by imf02.hostedemail.com (Postfix) with ESMTP id E401C80006 for ; Sat, 11 Mar 2023 11:24:52 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=brainfault-org.20210112.gappssmtp.com header.s=20210112 header.b=xoi23uGW; dmarc=none; spf=none (imf02.hostedemail.com: domain of anup@brainfault.org has no SPF policy when checking 209.85.208.48) smtp.mailfrom=anup@brainfault.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1678533893; 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=o2nk19RWJ3FFxQfThP1IJnCcqh4Rha1T966ziWyQOag=; b=C+xtmwVccJKuU+wfN8+Ay0KbZOQi2W9g/qHpY4Ho+JW5iK7jk3SHyOd8IZHI1yni7SQC6u 0/41Tt4YW1Yk/b+iphk8EjfqMmrDt7WT9spRA2upaHDBDPrPy59TuT/0bfaqHN2TrfZVO8 NirCtYi3N7qp34uvT2urUpPMnoyGwUw= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=brainfault-org.20210112.gappssmtp.com header.s=20210112 header.b=xoi23uGW; dmarc=none; spf=none (imf02.hostedemail.com: domain of anup@brainfault.org has no SPF policy when checking 209.85.208.48) smtp.mailfrom=anup@brainfault.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1678533893; a=rsa-sha256; cv=none; b=tbE5DyzZxGsXASgvZ0e9zyHr7jp2pjcnCjw6UiE2p4wSiwLbAUVGrHCU2cfeaKqG8Jen5c oUpzwQz6z524XjmBYHlC+o5emDcZmWZ/bpym2aVRZIhOJvrnulG+byZDO673wXv6kehQrH Hk9vHR2lEunwMGSFBJdT6TaSGDssbUw= Received: by mail-ed1-f48.google.com with SMTP id y4so1329953edo.2 for ; Sat, 11 Mar 2023 03:24:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brainfault-org.20210112.gappssmtp.com; s=20210112; t=1678533891; 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=o2nk19RWJ3FFxQfThP1IJnCcqh4Rha1T966ziWyQOag=; b=xoi23uGWoVBMERLqg6d4ZCon4Umfwkx1isVhxM80MHOqn8Gy/MlUGfQG5TYs+Qbl5F zjtDXJxxde9ZrMKRmC/0ermLtUdoBz18vmGQMl3i+olvsTcsIJmXFcKyj0dhY2Twdfjj Qb8g2LFX6014DGKCz4WX/H6pdnc3Fx2D30jyY1QV93Y8vyuEqSsG5l70wTzyAoJg0d7E KpEU+gYQnlC8w1MmJv1GUlHIUvpfe2YDkhekUfubaFPyTSFh4ItLn/ZeA32AwSS82c/s 1yUs4tAM6L2u2MkMmMlGEeJIVgiZmgRJI5WHjdJ8IidUjizOfyhqdmDEMAFl+CNWND7U ZinA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678533891; 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=o2nk19RWJ3FFxQfThP1IJnCcqh4Rha1T966ziWyQOag=; b=CzUyxSszvRk7iZNCm2bqqt4m7m1S214oWybQYRL07f8yyRNsa1mDk8j22Nky0BKrFi scb5ue0u7JpnPamycJaD04Nlh1G4bWoTNrbQZ9sEJH0UrRb5ZVAH0EyA8SjHmAOOLnjr IQvQOMQvNxyGYILMLjtNlP5jxMVhtIgU1IyqT4uJq7uTpNlKqdXEro8xxhBBlGhuwVSx YWqN1lM8RP3TB1GwNEMQ2b3N0QRwUC0FBJVUT9d6jLIqdMZOoq0kvSTUxY6E6lq0dKpu edhLFvCMK4ucUSi5bC3P2UpNhjK1r8IfMQB84biAuLtqCWDmQ7H1Nn1NyYOdlu0DtFq9 1PQQ== X-Gm-Message-State: AO0yUKV04AT0pp1STKyMgYhiqPiSshtZW06O/0J0gUELmWEKLEpzQBzZ rBR1oBSSm5ueseULn/3sbeCTICyDgpyjrKzuRm440Q== X-Google-Smtp-Source: AK7set8a/pblYINKWh29is0KEdgqlAFOzRPVSYLjlA+rojWgWrbyCHnWQa3g8iViKoePj4aeVOWZbZX+sXfjSy8EGPU= X-Received: by 2002:a17:906:a4b:b0:879:9c05:f5fb with SMTP id x11-20020a1709060a4b00b008799c05f5fbmr14921391ejf.5.1678533891185; Sat, 11 Mar 2023 03:24:51 -0800 (PST) MIME-Version: 1.0 References: <20230310094539.764357-1-alexghiti@rivosinc.com> In-Reply-To: <20230310094539.764357-1-alexghiti@rivosinc.com> From: Anup Patel Date: Sat, 11 Mar 2023 16:54:39 +0530 Message-ID: Subject: Re: [PATCH v7 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 , 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-Rspamd-Queue-Id: E401C80006 X-Rspamd-Server: rspam09 X-Rspam-User: X-Stat-Signature: yzouxuekb3t49yo1ugixy33sfqxp6qkz X-HE-Tag: 1678533892-169921 X-HE-Meta: U2FsdGVkX1/GX974j5IcvgnP1OsRfxC6UUXjA8QxwB/q6hOYtrwYOdpvTnczhMx2Y0P1ZctH+UTGmvEQHi9/FanlhGV6wrDFDWK1AYFkOQq7sug1/OgbMFRFKK4v9Vt8GNHXkwW7rdCXn6mWduJtmZ8rX5AYO2W7TPZi6SvaznRAhz+OVpcm5OQmj6Ti+r6oKSPajav5kTbqUB0M688TPW5VRTyBMq6J1XRMoMPiTN21Fq+5JFiMCvtA/cjP8l2cmQLDxU9PytrjRGhJtLOWf/7ZCc+RzWz1GvSiDXmhYNlDWhYHvIaOxJCYACl9nGrGMjJtVkRszy01h5WOAsScCgSUf9Qv2iYsVJ6uI9kwN0/8cyslYwjOznHblQW6XMqzSKYF8L6boApZW4XQzcJQhlqHealJYifi/vESsgzVXqpv6BTX89WapWNEfer+QN4EKFW/gjMbuSyZo89lHn74nU7vhO4PN8kTrl6hSd8QhlEudd5IaYTrQyr8nZoz2RmmreS5xjRtjW3ruOcAg/D7p1DYR0F/RGuBwS5Odf59GOTbqSk19sMOzRiTrvI3/p5TiIh2xzjBiXWytMEOwSUkuc0OJLiJbOnxz1NrTWcgfQEvdSQfAY9S/Z3D4bhdZjhnURPYck3c7XkGZcac027zvMohKVEHUMGNeKEPzSRiTF8kcdP+K8FpKjXoMiIpv4LTGyNrY7Uk1Q7e18XLhepKylUwXvUbFX/oscZeWCEKvHZGRn7QKEQrvhKXJ11K2HS9rMrx1VonEp5yvBltoGfU1NM7PqM5yQ2uRVWL5by5nfpVCccwa+j1kRxNs0oc9W6jtuRuNW4005FLsHDjjHWqmjJkZcrhVBwDylYJ4Z94uS0xXa5KNoQ+W1ep1m5HeNk/9nbHOploaB50CktrwNADv1P7pJK/jLkMEoX8DREkAv4AzD3mvaPJOuNIIJpnDvkX5NzYfoVIXBHupClTRuS YJxQ6hTd /XUmwVZOuEDS2UZ6LNXYUxYFhogtk0u9QGAgowKpnahVEFYaehCcGgwISYMno4HfC6TrKY8MY6s1sauWREEjxsMkwZgfAJ1YJPh/KdFa1IHRayCwrdiJlvGdOjdkYWrLYCp89Kztx/IUXnDFUj9eBfDSpcyNRaS+zXrulkdLDUAzAkioFaRN7XUCoK94oRpLsbhJ6nli6O4WsUcJTrssNK8uX9ciZARHyizqUiUkqRyvr2eINnP9by/Trfbkvqvk3QdlTozTPdvpnx557JOOAqrwJ46+JDWBFd61sfdrs0BnDLfETYzoLWUJvK3Q8T8yvS/6onNmEK3lfI5YEgSCKgDYdq9e+n6ZjVIQZ7lhUW/ST05WfRMd1COVL8o+rOLLrLECaHoVJ/L1B85rsFh4h7TwygBSGcEZ0QxOCD+kRZOaS9XMRk2OI2TzfF3SO9zA2jlHEGLBay3UoExTkY6jiymnA6s8M47EwljrJ 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: On Fri, Mar 10, 2023 at 3:15=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 > > 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 This works fine on QEMU RV64. I have tested on QEMU RV64 with busybox and Fedora rootfs. I also tested KVM RV64 which works fine as well. But, QEMU RV32 with busybox rootfs is broken so you might want to try that. In any case, I have reviewed and tested this series at my end. Reviewed-by: Anup Patel Tested-by: Anup Patel Regards, Anup > > arch/arm64/mm/mmu.c | 4 ++-- > arch/riscv/include/asm/page.h | 19 +++++++++++++++-- > arch/riscv/mm/init.c | 39 ++++++++++++++++++++++++++--------- > arch/riscv/mm/physaddr.c | 16 ++++++++++++++ > drivers/of/fdt.c | 11 +++++----- > include/linux/memblock.h | 1 + > mm/memblock.c | 22 +++++++++++++++++++- > 7 files changed, 92 insertions(+), 20 deletions(-) > > -- > 2.37.2 >