Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp2623403imw; Wed, 6 Jul 2022 09:00:27 -0700 (PDT) X-Google-Smtp-Source: AGRyM1u5mO9qPg231UbKYPfMTdfaSTSf+Ac70MJ3rfb1DEpx284xv/pGelWOTTL9PHWnXVxamrvO X-Received: by 2002:a17:907:6d86:b0:726:99d7:20e4 with SMTP id sb6-20020a1709076d8600b0072699d720e4mr40127506ejc.342.1657123226812; Wed, 06 Jul 2022 09:00:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657123226; cv=none; d=google.com; s=arc-20160816; b=qEsioRG+E+SPSMJxCpNeY9UZ1SFUQdIhKEno3p/SPVHF/zqQSiRJ67W/vN+zEc17hU 5fsoCdtV/IxpneXEtt9nJ30qNYyb2FHydv3yGvC4b64fnGbQixkSu/UGcGnMfDtVuxlJ B6RVjH3Y1RxFcGvqvkz4nphQ2vRXBZcvEYSIM5kM1IG2z8ftcsSrEwT8P1ovJUGI5kba uy9g8LFL7Gf6LbP1YOR6LxjH9Olrl7cWFY3EsCklWEG6BOnNwnhQS5vZPtE99N7r4uYj mGulrsS764zk0NBrwSmU3JcJyBqyC2lGKuQrqMyRv8MxU2lXxQZcoEwPNpKDXw/f4gSS LBqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=eIpaEbFJ5/d8nnqtuan+T4qnfUxaGf2HhtBexsCYVhc=; b=bsyWREikzft5dxO7tPDZzXrZuFRJR1r3JWns9bi+r7FrP2TMOUzSkOV//xs1+iJjsF 2uAUdrCg1x1U9ReZvVHLFKiNmbRDedbcEmSdFDGVFwzgAKLi6Nynh2245y/NI3MTdkyY B6Y6kq0rdxpeRzKpmQbVd41dGyBMC2voMWzkEJZoMSSmjT1EkFsFl49+/BerFOipUFNv fGY06zebtsv5lUuIF/oIOpiBrV5aGdLNzXqq8eVsNmHHMXRU/zRfk4LQMjMo2EZTFOJR UWybXCjrCCW3GgUEn26HeXqKbmelcrvKLiXTKvUzZTB4C9j/ofQCgvxNrR7RiKlO2WpC j/sQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fj5-20020a0564022b8500b0043a6ddb2941si8693413edb.253.2022.07.06.09.00.01; Wed, 06 Jul 2022 09:00:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234346AbiGFPsy (ORCPT + 99 others); Wed, 6 Jul 2022 11:48:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234331AbiGFPsJ (ORCPT ); Wed, 6 Jul 2022 11:48:09 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51DB72A279 for ; Wed, 6 Jul 2022 08:41:06 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D4881B81D8B for ; Wed, 6 Jul 2022 15:41:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E284AC3411C; Wed, 6 Jul 2022 15:40:59 +0000 (UTC) Date: Wed, 6 Jul 2022 16:40:56 +0100 From: Catalin Marinas To: "guanghui.fgh" Cc: Mike Rapoport , Will Deacon , Ard Biesheuvel , baolin.wang@linux.alibaba.com, akpm@linux-foundation.org, david@redhat.com, jianyong.wu@arm.com, james.morse@arm.com, quic_qiancai@quicinc.com, christophe.leroy@csgroup.eu, jonathan@marek.ca, mark.rutland@arm.com, thunder.leizhen@huawei.com, anshuman.khandual@arm.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, geert+renesas@glider.be, linux-mm@kvack.org, yaohongbo@linux.alibaba.com, alikernel-developer@linux.alibaba.com Subject: Re: [PATCH v4] arm64: mm: fix linear mem mapping access performance degradation Message-ID: References: <5d044fdd-a61a-d60f-d294-89e17de37712@linux.alibaba.com> <20220705121115.GB1012@willie-the-truck> <9974bea5-4db9-0104-c9c9-d9b49c390f1b@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <9974bea5-4db9-0104-c9c9-d9b49c390f1b@linux.alibaba.com> X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 06, 2022 at 11:18:22PM +0800, guanghui.fgh wrote: > 在 2022/7/6 21:54, Mike Rapoport 写道: > > One thing I can think of is to only remap the crash kernel memory if it is > > a part of an allocation that exactly fits into one ore more PUDs. > > > > Say, in reserve_crashkernel() we try the memblock_phys_alloc() with > > PUD_SIZE as alignment and size rounded up to PUD_SIZE. If this allocation > > succeeds, we remap the entire area that now contains only memory allocated > > in reserve_crashkernel() and free the extra memory after remapping is done. > > If the large allocation fails, we fall back to the original size and > > alignment and don't allow unmapping crash kernel memory in > > arch_kexec_protect_crashkres(). > > There is a new method. > I think we should use the patch v3(similar but need add some changes) > > 1.We can walk crashkernle block/section pagetable, > [[[(keep the origin block/section mapping valid]]] > rebuild the pte level page mapping for the crashkernel mem > rebuild left & right margin mem(which is in same block/section mapping but > out of crashkernel mem) with block/section mapping > > 2.'replace' the origin block/section mapping by new builded mapping > iterately > > With this method, all the mem mapping keep valid all the time. As I already commented on one of your previous patches, this is not allowed by the architecture. If FEAT_BBM is implemented (ARMv8.4 I think), the worst that can happen is a TLB conflict abort and the handler should invalidate the TLBs and restart the faulting instruction, assuming the handler won't try to access the same conflicting virtual address. Prior to FEAT_BBM, that's not possible as the architecture does not describe a precise behaviour of conflicting TLB entries (you might as well get the TLB output of multiple entries being or'ed together). -- Catalin