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 X-Spam-Level: X-Spam-Status: No, score=-8.7 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E3D33C433ED for ; Sat, 10 Apr 2021 09:59:20 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 81023610A2 for ; Sat, 10 Apr 2021 09:59:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 81023610A2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; 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=CE79mkQ6XmSYdXHuX2yf2w1ZjYvvRs3fl8h4UyHsiCo=; b=aUPVtqsLCshEf3PPK5nlSa8X7s smmqgzfWGUojL+6nmJwJ39+oQKxuA4N4H7Hi970LERJrV9Vqg1F/xNNM5MHsfAcp6VDVKbqvanLF7 wkv3zVrOVhnJf0+Qq5ua3fESRzDNxBOvgPWKNuaD8DguMnxBR18ZLQpgOnNGrFwir87iR3xqJ/oL+ xmf9C3FPWPfbQ7k5+7/nPGQdJomgG9+GLZiONhzjPIH4udUk1XpEwySadIUoimNtWDkNjqny2guk3 pc1riB0mDl6lNlXj2WXpAezodpXg3q1fFWYOdeYowDaPvyQ0fCEp/LtUVG0HbGceDJjrra0/jSXTV VbiJgmJQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lVAMi-002bOd-8N; Sat, 10 Apr 2021 09:57:20 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lVAMb-002bOC-O4 for linux-arm-kernel@desiato.infradead.org; Sat, 10 Apr 2021 09:57:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:In-Reply-To:References; bh=yQyX7THNZK/qu4WSrXLAMR1sYTJqaA1oUhKRYoQabXw=; b=FTptbag+2dLQs1d4aamRzpZ+F6 yutuXcgHxg8a4g0F2tp4aiD2MgmYiP+BwX3qncY+tT2oi5hNycB1dRl7IlwWYRg+wKAyErX6k6d3l vjM/bszzEcBAfaXxeZuJtDvLGTl9ENJWvV3zh+DnIBzwuIZ2BLkDRZ2R5RWon/CkBkk9TtVbGqROm zFLsoo1CasDjLOtwVATBP3Uvp883rYqBC5DOPfzBMOFNQz8ipUAdo58GZMec23nzTjBmUAepaZAbn PfXfnihSPjmg0NOl0j9FcaFSlx1noNieBRtVHr1xpXDEh3y2vj4atTpSLidisozqbyAvmvax0Qurk Kwn+0+5g==; Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lVAMZ-0051Xy-1f for linux-arm-kernel@lists.infradead.org; Sat, 10 Apr 2021 09:57:12 +0000 Received: by mail-pf1-x432.google.com with SMTP id a12so5859048pfc.7 for ; Sat, 10 Apr 2021 02:57:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=yQyX7THNZK/qu4WSrXLAMR1sYTJqaA1oUhKRYoQabXw=; b=iu1qIoLJ17gZJe0cnj9q4z8vSWt8xYjtfi/eH/8aKXo96eYXWLdnQQqg9cncUboKr3 dzroQfUcM5vasOmbvEaKwuA6/CKnrlJkgyOaVgnnV5AUnMl6UX+B4LfZ/2AmcCIU8XM4 Sm/wS/kURygUXd2d8U0kTcIY8dLMPemjcYcfBFAMIeho3K728WxzKCuzhrJcQPfaUL+5 oPJpnh7hj064K5c605TCAlJQaAy40RRknBIAJXUa4orrpVFWTg8vVwx36Vo5BsDlOS3c NPFOwYluLWeiZY3nAPbXm1E3bxEKwihJ+Y3XjlY8acKupiNGsFN+6Uxr/+e36776bGj1 GPjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=yQyX7THNZK/qu4WSrXLAMR1sYTJqaA1oUhKRYoQabXw=; b=dKHMaSzRJu7jm19ShajYPuDsa1tbEKqedHrQ9fKYFYWx+IDEWn6hWFp/BuQ7iNiyO5 NPgyJyTabyvxaOEb3SSV4WIuMr9eEEZa/b0sPUI2Fzo+5D5POlBJ9P2ZG331lxem1XSO ACeGZ3HQuL/WRCNxUGhV2i8TzIA8EU/cRtSU9QOBLam68/fLFmT1vixymZ49Bgyc3ZLl HF8Famz3oxjH/DdbBvs/nFbOQgPdsbdpH+L57SPj8M2zFULsVyn7/DUI+xzWHh7pRhqk uSeSS0ZHrcSbNRyOoD+LVIGHngHr4abhl8mNHD+001mhZjx86hYHDQP8RakHeBu4TtZm rSww== X-Gm-Message-State: AOAM531zYFKyJQIy4EgXhKwXrquAk1kqbSsahcTM9LVsIkX0b9M4AmCl PHhpug5iwOoB6+zrDHoii3WEeb3TVfiA X-Google-Smtp-Source: ABdhPJzIkJCWGY1Y+kQEcWpMMc/30/LrLeSOCh/Yid3j7AmonSenwvKqaU5fdBXdd0mCNhe9jVJ51w== X-Received: by 2002:a63:1a50:: with SMTP id a16mr17816471pgm.92.1618048629587; Sat, 10 Apr 2021 02:57:09 -0700 (PDT) Received: from x1pad.redhat.com ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id m14sm3836322pfh.89.2021.04.10.02.57.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Apr 2021 02:57:09 -0700 (PDT) From: Pingfan Liu To: linux-arm-kernel@lists.infradead.org Cc: Pingfan Liu , Catalin Marinas , Will Deacon , Marc Zyngier , Kristina Martsenko , James Morse , Steven Price , Jonathan Cameron , Pavel Tatashin , Anshuman Khandual , Atish Patra , Mike Rapoport , Logan Gunthorpe , Mark Brown Subject: [RFC 0/8] use __create_pgd_mapping() to implement idmap and unify codes Date: Sat, 10 Apr 2021 17:56:46 +0800 Message-Id: <20210410095654.24102-1-kernelfans@gmail.com> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210410_025711_108592_E182A585 X-CRM114-Status: GOOD ( 13.55 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi everyone, Sorry to bring up this RFC in a hurry, since I paid attention to "arm64: MMU enabled kexec relocation" too late and now it has advanced to "[PATCH v13 00/18] arm64: MMU enabled kexec relocation". And I think maybe that work can be based on my series. I have raised my concern when reviewing "[PATCH v12 00/17] arm64: MMU enabled kexec relocation" https://linuxlists.cc/l/1/linux-kernel/t/3923858/(patch_v12_00_17)_arm64:_mmu_enabled_kexec_relocation#post3948651 (It seems that lore.kernel.org has not archived my reply) Where I wrote: Then the processes may be neat (I hope so): -1. set up identity map in machine_kexec_post_load(), instead of copying linear map. -2. Also past this temporary identity map to arm64_relocate_new_kernel() -3. in arm64_relocate_new_kernel(), just load identity map and re-enable MMU. After copying, just turn off MMU. In a short discuss off-line, Pavel pointed to me https://lore.kernel.org/linux-arm-kernel/CA+CK2bC2KwWufE1DWa4szn_hQ1dbjDVHgYUu7=J4O_kvKXTrHg@mail.gmail.com/#t, which prevent him from using idmap to implement his series. After digging into the code, I find that if extending one more pgtable level, the __create_pgd_mapping() routines can be re-used for idmap_pg_dir and init_pg_dir. Besides, it can be re-used for trans_pgd_idmap_page(). That is what this series do. As for "[PATCHv13 00/18] arm64: MMU enabled kexec relocation", here is my two cents: -1. a call to create_idmap() API in machine_kexec_post_load(), to map src + dst + arm64_relocate_new_kernel(). -2. turn on MMU in arm64_relocate_new_kernel(), after done, turn off. Sorry again for a hurry. It can be compiled, but far from good. Thanks, Pingfan Cc: Catalin Marinas Cc: Will Deacon Cc: Marc Zyngier Cc: Kristina Martsenko Cc: James Morse Cc: Steven Price Cc: Jonathan Cameron Cc: Pavel Tatashin Cc: Anshuman Khandual Cc: Atish Patra Cc: Mike Rapoport Cc: Logan Gunthorpe Cc: Mark Brown To: linux-arm-kernel@lists.infradead.org Pingfan Liu (8): arm64/mm: split out __create_pgd_mapping() routines arm64/mm: change __create_pgd_mapping() prototype to accept nr_entries and introduce create_idmap() arm64/mm: change __create_pgd_mapping() prototype to accept extra info for allocator arm64/mm: enable __create_pgd_mapping() to run across different pgtable arm64/mm: make trans_pgd_idmap_page() use create_idmap() arm64/mm: introduce pgtable allocator for head arm64/pgtable-prot.h: reorganize to cope with asm arm64/head: convert idmap_pg_dir and init_pg_dir to __create_pgd_mapping() arch/arm64/Kconfig | 4 + arch/arm64/include/asm/pgalloc.h | 28 ++ arch/arm64/include/asm/pgtable-prot.h | 34 ++- arch/arm64/kernel/head.S | 190 ++++---------- arch/arm64/mm/Makefile | 2 + arch/arm64/mm/idmap_mmu.c | 46 ++++ arch/arm64/mm/mmu.c | 358 ++++++-------------------- arch/arm64/mm/mmu_include.c | 284 ++++++++++++++++++++ arch/arm64/mm/trans_pgd.c | 59 ++--- 9 files changed, 535 insertions(+), 470 deletions(-) create mode 100644 arch/arm64/mm/idmap_mmu.c create mode 100644 arch/arm64/mm/mmu_include.c -- 2.29.2 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel