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 B9B93C6FD1D for ; Thu, 23 Mar 2023 12:54:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3C9E96B0072; Thu, 23 Mar 2023 08:54:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 352BB6B0074; Thu, 23 Mar 2023 08:54:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1CC4D6B0075; Thu, 23 Mar 2023 08:54:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 065666B0072 for ; Thu, 23 Mar 2023 08:54:20 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id CE23A806B8 for ; Thu, 23 Mar 2023 12:54:19 +0000 (UTC) X-FDA: 80600156238.07.C3D25CE Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) by imf03.hostedemail.com (Postfix) with ESMTP id DA8DE20014 for ; Thu, 23 Mar 2023 12:54:17 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=rivosinc-com.20210112.gappssmtp.com header.s=20210112 header.b=HR6KCQS7; spf=pass (imf03.hostedemail.com: domain of alexghiti@rivosinc.com designates 209.85.128.46 as permitted sender) smtp.mailfrom=alexghiti@rivosinc.com; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1679576058; 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=QJkjkDDXcfaVEj/wzBuynagqiTlGyMneMBfA6NRDFpA=; b=5VC+DwHfOYrS+Z6f4CjUdwlSmM0XcyJFsugCXlJPZkjzCjylCPN9QGeDP2Yms6k4aUrpGh gwLJ3tVzXifJWROCSL6rWcJFO5Q4IX4GJQq5NonTUyVab0lLLOERJcfy8hR7RMuRJW8Hwn ReN2MRnQdX4pb8uFP6Dqzw8PqYxrgUA= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=rivosinc-com.20210112.gappssmtp.com header.s=20210112 header.b=HR6KCQS7; spf=pass (imf03.hostedemail.com: domain of alexghiti@rivosinc.com designates 209.85.128.46 as permitted sender) smtp.mailfrom=alexghiti@rivosinc.com; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1679576058; a=rsa-sha256; cv=none; b=WidPoU0H7eXJ4G/lSgPzzoHV7SKgpWArTs9JgXiIHwntw/+jENzcJ8jTLavGzxAaC/16Jb 7cG4ArGpca6lkt25s1KL4z8VuMBVkuZ4zEdgJ3H4HZxNmGlaYAfjw3j1uMLvuVeQPuyf+L L9nBP8q0kRloUXvsQHs2JdCPIifauEQ= Received: by mail-wm1-f46.google.com with SMTP id u1so1048393wmn.5 for ; Thu, 23 Mar 2023 05:54:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1679576056; 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=QJkjkDDXcfaVEj/wzBuynagqiTlGyMneMBfA6NRDFpA=; b=HR6KCQS776uoD7UGnbRZdWuSA1KClPo4MTXzADx7rQ2WKrUdB81NFWVPwPPMCgCMWv XJ/u5N+tal5a/MZ33HO7NrBNUxCV1KKSM59x9+tRwHY5c30FzgE8vRD45dNTh0IWEmCx 2geo29vy+AAc9Duo/xCij7+X8gJX+NLjuGuulf1OhXoWlC6J7z0ReGShAGQWrAj67P3t YHXlZVk+pHgCvkfDlu3gPh6oqsCzJ13wNrX5bBiEatSnaTriNuLp3PdBKmUdMUQcMUgQ tClyIx+mExQFvfArw5D3bFM8yIcqIPiqXG+Qs91CkHKBtOJ9zXu/7B1k6baKFrJjx9r6 08LA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679576056; 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=QJkjkDDXcfaVEj/wzBuynagqiTlGyMneMBfA6NRDFpA=; b=8K6HD9CoMVL3RTzsX9YcXIPULWKII0QPqHrFRG+7xkVo+eQQZy9sj3sJMGqBzS1/v+ sVuNhOb1NL1BU2mwQBwEbmuxFi/RF0iS+H55DwV39Cd7s5JYzmU+YaoyySw6R2qvwbS4 6lMyZsDlASv7LxqtFpIUljdr9Eq5NypSK0oYt3t4b6hmz8LH2lg21LKUqacx5vCWKm3t zs4pAyTokUOeQPj81y26UqN9bOIiB9YoqAgCVCS/pWePJR8tiRtlbVdDN78UFi30sPrz 6vrKZGOd5vHVeiBG+j8bDAegjy+97vJGiJuxodEt85R8b7LCltHP/f1TgcihwFf/i+/p 8zeg== X-Gm-Message-State: AO0yUKVMYkwPxIEVBkJcjW3Ra1n5CGvWvZ4HQYfU7hmfagQDCpf4/okF ekyR1yirnXWeKPKHwJ0DJAhQ7sR4/VG/0uN1vZlDDA== X-Google-Smtp-Source: AK7set+cxes5jKFyq91uR4zzQ+z8CDae/libm0ngmGBzyHd+HlvVpBhotdASHGu/nauWRHYX/FvMVf1MWJijHfR/THk= X-Received: by 2002:a05:600c:217:b0:3df:97cf:4590 with SMTP id 23-20020a05600c021700b003df97cf4590mr704838wmi.3.1679576056462; Thu, 23 Mar 2023 05:54:16 -0700 (PDT) MIME-Version: 1.0 References: <20230316131711.1284451-1-alexghiti@rivosinc.com> In-Reply-To: From: Alexandre Ghiti Date: Thu, 23 Mar 2023 13:54:05 +0100 Message-ID: Subject: Re: [PATCH v8 0/4] riscv: Use PUD/P4D/PGD pages for the linear mapping To: Anup Patel 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: 3hquwqbzzi6ebrejwhzfpfyou76k8g17 X-Rspamd-Queue-Id: DA8DE20014 X-HE-Tag: 1679576057-520655 X-HE-Meta: U2FsdGVkX193T+HWMZZQhRydjNczrEbMi/+VXIQk5867frbDzkF8xEB+N9CKbMtHnXvNHirmffnjkr84LnTcQTAGgJ5+OKI21VRdjlFdjoyvqHMFt+KRS/pL1upCLwRlF+5M3BMna6BveaDdDA1/yZQCoIxGNFjjaoTwI7WI1BGxAwW750HSLZ3nqEQIJh5J4Y+SwQ5fQ4gbQSq59yxOyHOyAwKebX3w1xnG2IQSTWhi0oqb/wTAb0Vf7M3F7rcg7+n/ce1y52Yeet7im8hrhN6kA7EKRQpcVHwhgoyA6qie8rHiKBXOvhHRDKRjt0up+WXz39frdrzVq9eP9/Jt1tmUREiqZMQn/ZpjTfNvILyZeoG9hQMgGpBka1hOghzJdxJpnHgjrVKWGxoEEmHEaejElwfWNEBZEHEKHPoaj0RfqF2TShZBYb6C2DKUW9j4RjD+Vu4pPLZeoEaKzc2GOUjdAZp+ot3YY5mK8YiX4AHsF3HO2pfaY4A1MJk6GAcBAAGC+YG1jva7O+loIoT2BZ7s2S97H7dD7s9HEJWeKWJSoqxqWy3XLanVM+o3lK6x5uFYx6omtWAEASB0Di2jAmX5lbMi/bH4ZMuJtqzed6gSdGQzpa2rK+4t8Xk2kbjIWd8OEqAvpPhg1NABmWUlkScGAOqTbhIKpGiOsDlzh6Dem/+t3TvR1HJqzv5wlpU9uvnjgUR0rKMuQ75wWymwYHl/vV55SjJW/fo0I89WuZHpNwOMSEaE0QJdMvuMhrqLeXy0l5YxGnQ3SrPILk4YrJ7KEOAvrHUoBr/hQL5i0I3CZLymo//qCDjAB4Uv1ECA1R3J2cLtBrraEnZoRA7BsiDMF5J+c6Hc/hTf8UQUmgQBUz7gt53RQSM1Mkl2M+93HjTCCtQJnJJSNljnu0Y3Poq9vXAyInhRFV1P56z8nHuBtkQ/uvaDiRhrYerJQuSK5H3P2YuJiozBbnNCxAf CcD8fQit E8Ae5Iur5pIIrb4/WOPvZTJuEW9Ah5EhTY5zA0PuCgHE1PqihFGeOf+5i/rYSejN/BfbQfs57j/S8akDHYKxC9iILjHPyrKdduGxB7GYKLP2ERBjoS7ZB8YEK0CLP/NtVb2u/Cn275McR6/DCxBIa6hUJZW1dvMn6xzbetXDH8pErK4hNnrNCmD6HODB7u99FDLFoaK4vVzlMJBpfLapUuqknBD8B6gMGTv6DPo3QI99pygR4reEP4ymGKrJC6xsjTdXbUTNrKP1TygLfIplxu4Rx2vfmZM/OO4nnN5nSlFkbAJMKS3EB3CrwhgdQeAjG3CnxWFyLnWGqindyvnXLcZBU5G1y4yQUCcWhpZPkksC9Gdui6qv5eTxiXoxO6epHRhr65d4YG3m1JVScj+GXhDpvYrPfqhT6JzJR5I2b+KwnhaBptY80jw0dNsDYYQKNmAiRBXP/uG+9eiUl4D7dfkwNjvfQETFX1YYf 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 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 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 o= f > > 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 u= p 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 th= at > > 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? 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 > >