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 0838BC7619A for ; Thu, 23 Mar 2023 14:55:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 422E96B0072; Thu, 23 Mar 2023 10:55:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3D35E6B0074; Thu, 23 Mar 2023 10:55:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 29BD36B0075; Thu, 23 Mar 2023 10:55:45 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 1A99C6B0072 for ; Thu, 23 Mar 2023 10:55:45 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 9DE931A0722 for ; Thu, 23 Mar 2023 14:55:44 +0000 (UTC) X-FDA: 80600462208.29.D885F33 Received: from mail-vs1-f50.google.com (mail-vs1-f50.google.com [209.85.217.50]) by imf16.hostedemail.com (Postfix) with ESMTP id C2B44180017 for ; Thu, 23 Mar 2023 14:55:42 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=ventanamicro.com header.s=google header.b=LTBfqwlf; spf=pass (imf16.hostedemail.com: domain of apatel@ventanamicro.com designates 209.85.217.50 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=1679583342; 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=N+oTlLkGu4XBg7D9GQLxh6VnC+XUJIJTBF8fUhsoTP8=; b=wDALMTJSdjG7Flx4vo/+3Bd9vCdEfvOLVVT9u/a5RVVgcA/SeGxsQ+nfKJHPbwRvDkeOaB zHADUDMZCPG4S4Lnfd607pgIVscZfLrDHKhIaWc4EX/bHHqg4V0EaSZ45lbJE4M4Erojmq cVnE0MgeQ6KbbbPmS4KCo9c5EIovSJg= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=ventanamicro.com header.s=google header.b=LTBfqwlf; spf=pass (imf16.hostedemail.com: domain of apatel@ventanamicro.com designates 209.85.217.50 as permitted sender) smtp.mailfrom=apatel@ventanamicro.com; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1679583342; a=rsa-sha256; cv=none; b=0t0NVk3QZYwhpRmgGvMGghUuUjuByJLvME73J3Xer0HDIwQ+l3hL9LjdSefrdQFBUK+JFe eQ+xuglBlOM/Dy5FxvKomo9tpHKnDfoCOjcA+BqrmmiASccMej515/LJgz9wzDJqv2lPZ/ mJ9ZPfgH8lhHtVCyMnTFbgFIYV3coe4= Received: by mail-vs1-f50.google.com with SMTP id g17so1311694vst.10 for ; Thu, 23 Mar 2023 07:55:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1679583342; 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=N+oTlLkGu4XBg7D9GQLxh6VnC+XUJIJTBF8fUhsoTP8=; b=LTBfqwlf/M9rJPjcbZEXH/wbqe1ZOqjIzjST3UXornybx+R7J7pGQpUrAHtHTzDGvu cL7EpEXBe23GlAZa7FOxq38BNNXRVgmUXNdIQBCuStekUCBhCTybk3WfGhWfZTKSChWD JnbCIa60L1xcSOqFe1o8B9d3fnK5bQT7zYWnp6T2+O+g66fM53F/t0PL2q+FzqlKML8O fTgKD2u4V0j+0KxM4ylNAg8sWdHs65ZORGm4UfB01kqzI9HXoSclY2mcKnpT1xLnQFlM nXCDrYU7AiJ4IL73YeAi0M4yLsQmhK2hvdB662T2PEHkxhthJAZ+8H9Iy13bi3HAzPEL IAQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679583342; 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=N+oTlLkGu4XBg7D9GQLxh6VnC+XUJIJTBF8fUhsoTP8=; b=kWvIFRdT3Xe5DSCkiaIknRMJGwb6HI3LfVslADiRO4u17jwlSAfqVPZn/dAwVek4WB krgElwByHpit5iq2zO8Qn8EFqOl9OOePpKzO0w9GQHDsEbqXWgF46drh46NcZxmT9pta KCWfnKhvxYRGpQ3NgSL9Q16EanUxs4983+zAG7eb8bHzYgXNnzpr04tW1bJj+ZJ7mm4r c0DnudCONfqefnscnn+jStXUYe4plY8dEVxo98SjLR2L47XAHSFbcaryt7Z6Xw8g7eVq xLV8rjJTCRATZrpTVdJiu5/6d8vB+AK8ekq4744ZTSaDCMRm9U64zCqvB3VpYs6CdczU 7TGQ== X-Gm-Message-State: AO0yUKWbGDTRxRrYk98pxCewtCcYpQrCREKYeA1bFsiqzDgZBV5CryDa Rj3HIPYibd18HBP/xohsoh3Og6RJUsaRtiKyQZr0Pg== X-Google-Smtp-Source: AK7set9i+OocmGY8L3enlKAK0g0CHDPShP25dec9yB6zEMC739pzT/6c96zssGZJJoRlEi9hIXGwiBLNEQySgGEkvRo= X-Received: by 2002:a67:d71d:0:b0:425:dd21:acc8 with SMTP id p29-20020a67d71d000000b00425dd21acc8mr2013668vsj.7.1679583341611; Thu, 23 Mar 2023 07:55:41 -0700 (PDT) MIME-Version: 1.0 References: <20230316131711.1284451-1-alexghiti@rivosinc.com> In-Reply-To: From: Anup Patel Date: Thu, 23 Mar 2023 20:25:29 +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-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: w5bkrhp1z5yciurum984476rhzg1nim6 X-Rspamd-Queue-Id: C2B44180017 X-HE-Tag: 1679583342-837428 X-HE-Meta: U2FsdGVkX18oqTkNHFEGmFUmslIMQMMbpXStW/AUceABonYb7nry2JcIh9aFPDJc8aSw7+8h3YSx8DOmsp7se3o2QEeALVfyrahQb8OLw244amutQEaUyj7wj5rSpHdjKUf1nkItqNAAmf4qQZlHvRvdDBi1Vo55Z44fsSNQ2XWkuhtzB6KowQBCVFqBE7jT2D2+ZTNf1Ev7Ji9Eebh0+l4tYrS+nUYGG4wLa4Dpu+4wnkRuGlfgYe2xtxnnCNnk8BSt87Wh1mj8vUDDAN5JJ3FY58eEEqG4hh/pc5daIB0Fd6HkZ8q8JC86K3TmQEVvi9H5yFnMUk8JDmK0VngGfG6uthePWbum6VJhT5soB+WB6+q1u5JLLdaQftFdHGJkphtMc3CkF/+8hmBz+JCsUKUx66W/RDzn0QZR6Y77Sw8dSN7ZYG0OTtGNCVy4OFqj0EyUL9/ChauB9HWwH/UGGrYcO7ICBywAm+u5uUIN43IQxlhgPx/95yzTW+po9gKOC72N69RxPN9+GDbZ8KobSx1tZFhGDUTjDXVPulxBZsDqQd5QiYKgbSkcNYFVyJMH5uDCV6dDIeVO8cBUwbN8TlN/PolIsstxx0tOsP8dS4sRK5CFgFijvaGfm0ZBdcFXy2X4+pnNBJ/wKJti0T0n2awvBALKR1tR80lzyfTQEi1Ssuijzlhaq3AUzssr7vZcsETBTb9X/U2gFsFiQ/4iylhfCvP4bOXBu87uguoWvYNGx0AAFcFCUXwP8yQlwQdHSVyjMddpWJtFW2MariAzJEvISJim3Taph5NqE9rlulX3WB01V3XjioXnHSQupAGGHxEbS0NINJEYtDwlDmc+XInVzLRTlt+FZA72DgqMnv6EnrQ2Ls9HEvk7NaRKgnccc2dH8OI3LFZXpzHywgmZOiRzv/t76qo3mYPEYVrAtaHv1hViwzqTq2xbvq/i/L/fKFQL7wOk8ofXgGAkXrn AFW57CU4 Ai/8bohPKPopYnP2R/MjKH/8+iO2bDm1tbME+FaGOc0+nD4d6DJxLUCRZjEGckp/NAuPcimciAdVq46mz8dv8njpniwHICQ+66k+HzQhpjwe693KsIjajDRr+WaFOHVfPxryet/VYDC+KNEd3q3bGp0UMqwXrMDmJn0EcMieLcAoVdgXw4JmEEV8BUHOYutxAB3vGcojyrJ/snEKp7hn1CvqnnFg/PIQkUhnzidD9gwMSAxhhnYbpaGfXg1UaxI65Bzx9f8gjSfZ3GFtzLwoWng7mIaqv5pe0Tb8Ff//H3TxNTIUNZSHIme18if+65fffLZOfmvfrk6K6cxZFgsa6sQO0WjLz5azJk6Z93qDvSNKjriY3idVogNk23dba3Vw7tJ2F+AVtfNBvfK7Ysf7soRC4SHzTe7R/vpLRG+Y6Yz2J27KQ5UIUbGCNAr/gEJqih8TkdZrcfgR5gSg= 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 Thu, Mar 23, 2023 at 6:24=E2=80=AFPM Alexandre Ghiti wrote: > > Hi Anup, > > On Thu, Mar 23, 2023 at 1:18=E2=80=AFPM Anup Patel wrote: > > > > 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 f= or > > > 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 no= t > > > mapped with a PUD mapping which would then assign wrong permissions t= o > > > 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 suggeste= d by Mike > > > - Use the new memblock API for crash kernel too in arm64, as suggeste= d 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, b= ut > > > 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, thank= s > > > 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 suggeste= d > > > 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 > > Hmmm I don't get that in any of my test configs, would you mind > sharing yours and your qemu command line? Try alexghiti_test branch at https://github.com/avpatel/linux.git I am building the kernel using defconfig and my rootfs is based on busybox. My QEMU command is: qemu-system-riscv64 -M virt -m 512M -nographic -bios opensbi/build/platform/generic/firmware/fw_dynamic.bin -kernel ./build-riscv64/arch/riscv/boot/Image -append "root=3D/dev/ram rw console=3DttyS0 earlycon" -initrd ./rootfs_riscv64.img -smp 4 Regards, Anup > > Thanks > > > > > 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 > > >