From patchwork Wed Mar 13 12:56:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pingfan Liu X-Patchwork-Id: 13591386 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AD8ACC54791 for ; Wed, 13 Mar 2024 12:59:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=kEySMphWi/l32vqNToFyG5YVSw7/55f5mHJ+C8OP7Uk=; b=BFIp4wlGZ4bmlH 3rsvV20d7rLERQ0XD78/mm9/5fDKLNqTiQowkbRo0mpyy/Vnh/GI8WmzDx3hwGm4gSSyyRGjcNPab mHq0iwqwHYsRL804pcwzNX/eZ/qGLfRVUHgSLF9qb+xFNMOrlfDQfScsh6e+Wc9CQ3cmnGe03wYzR YDlKfgR0wLx1oKBILUEDv+OnJpYCAIM77jykP9krBZQq9X9NGp5PnujQVK8qPFe3Ti8+k943T1wxP xLENu37Y1u2obkLjQeTfuP6u6+Hdt02FDdu248hyNdtBbUIsjSvb3AM1KPbRSgPaqudsgbT/bi99K quTEBM/qsCLmX2nenJYg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rkOCm-0000000A95u-0MQY; Wed, 13 Mar 2024 12:59:36 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rkOCY-0000000A8yU-3KcF for linux-arm-kernel@lists.infradead.org; Wed, 13 Mar 2024 12:59:24 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710334761; h=from:from: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; bh=alb7yl4EC6KsxVSfIYaDeenSELWmvcyuwYTcwrYa2r8=; b=Bx3YiKMuf56N88PC/tAYO5Z7x76n9gZz3VyIqAHMmsIC0mvhO4zWlec/3DrNGbyiA9QLTY v3/pRHX/Joc1l06Rhi5WoLV/L4CoK4/tuTdyX9cNS6P6Uk/AlZAgUNROq+mBzn9bq/+DpU AsePPb118qd7M8BU+UtltK3U4XU39f4= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-350-SXfysqndOMuBE5c_s7UY5Q-1; Wed, 13 Mar 2024 08:57:27 -0400 X-MC-Unique: SXfysqndOMuBE5c_s7UY5Q-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C0F6D85CDE1; Wed, 13 Mar 2024 12:57:26 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.72.112.95]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3CD3810F53; Wed, 13 Mar 2024 12:57:23 +0000 (UTC) From: Pingfan Liu To: linux-arm-kernel@lists.infradead.org Cc: Pingfan Liu , Ard Biesheuvel , Catalin Marinas , Will Deacon , Mark Rutland Subject: [PATCH 00/10] arm64: mm: Use __create_pgd_mapping_locked() in Date: Wed, 13 Mar 2024 20:56:58 +0800 Message-ID: <20240313125711.20651-1-piliu@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240313_055923_001595_8A8EAB44 X-CRM114-Status: GOOD ( 11.14 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi everybody, I tried this stuff again. Last time when I tried this, Catalin raised concern about the intrumentation, and Ard doubted this way due to alignement issue with mmu-off. Last time, the alignment issue looked unsoluable and I gave up. But nowadays, when I looked at it, I think it is partially resovable. (for detail, please see the commit log in [PATCH 08/10] arm64: mm: Enforce memory alignment in mmu_head) Overall, at this very early stage, the using of C routines faces three challenge: PIC instrumentation alignment [2/10] resolves instrumentation issue [3/10] makes mmu_head self-contained and prevent the outside PIC/ instrumentation/ alignment issues from seeping in. And check the code PIC. [PATCH 08/10] explains the alignement issue, in theory, it can be checked and resolved. And in this patch, it is partially resolved. Cc: Ard Biesheuvel Cc: Catalin Marinas Cc: Will Deacon Cc: Mark Rutland To: linux-arm-kernel@lists.infradead.org --- Pingfan Liu (10): arm64: mm: Split out routines for code reuse arm64: mm: Introduce mmu_head routines without instrumentation arm64: mm: Use if-conditon to truncate external dependency arm64: head: Enable __create_pgd_mapping() to handle pgtable's paddr arm64: mm: Force early mapping aligned on SWAPPER_BLOCK_SIZE arm64: mm: Handle scope beyond the capacity of kernel pgtable in mmu_head_create_pgd_mapping() arm64: mm: Introduce head_pool routines to enable pgtabl allocation arm64: mm: Enforce memory alignment in mmu_head arm64: head: Use __create_pgd_mapping_locked() to serve the creation of pgtable arm64: head: Clean up unneeded routines arch/arm64/include/asm/kernel-pgtable.h | 1 + arch/arm64/include/asm/mmu.h | 4 + arch/arm64/include/asm/pgtable.h | 11 +- arch/arm64/kernel/head.S | 314 +++++++----------------- arch/arm64/mm/Makefile | 22 +- arch/arm64/mm/mmu.c | 289 +--------------------- arch/arm64/mm/mmu_head.c | 134 ++++++++++ arch/arm64/mm/mmu_inc.c | 292 ++++++++++++++++++++++ 8 files changed, 558 insertions(+), 509 deletions(-) create mode 100644 arch/arm64/mm/mmu_head.c create mode 100644 arch/arm64/mm/mmu_inc.c