Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp1053787imw; Tue, 5 Jul 2022 03:00:37 -0700 (PDT) X-Google-Smtp-Source: AGRyM1t1xOzK/de9fyNzFxEvYVh4SN8Pr+b1n5/sex2FmN7iF4J8gsOeOh0o9q0+WPSgLMBakMvq X-Received: by 2002:a17:90b:3ec7:b0:1ed:ded:abd1 with SMTP id rm7-20020a17090b3ec700b001ed0dedabd1mr40089295pjb.56.1657015237582; Tue, 05 Jul 2022 03:00:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657015237; cv=none; d=google.com; s=arc-20160816; b=te2VeeD3cXnyyUkXPEuN2MzjZCMUztgcFdzztCbwdaOkM3Ahf+v5ojvXe3Gp0DZZnT yspfiWCt1IuWXkih/rQdBiJpQO9nkQ3itT7TIfuvpzcIAw+dd2AKCPdC7HszYDrv0ha3 Vpi5v42Pb0UI47wxSRVRDiZWEot9QBSJFwGR8KGkhEzv2NO9P2PvIXAd0Yoqmx0Z3jz2 Fo+MyEycpaLEW/d3+XxQSG1Sg4C5SmBWpNjFL7ZmEpRE9wfpfZLJSD97kZukNEoR2Ith 7SlkfJIwuwviUufy+ajfSHXAnUHt/37yisUF9/Pi8doReu0Am871CrLdUvljKUT4+8Ox wUbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=gcgP8qcEw9Gr+M5bsAWN9wb93s5ePqrwZQqM//j1Tuw=; b=kw0ArElc0/E56WBheecbfKsHrePUp/TuMsT/gID7ve+dXmYX/voLnTHvZBVhXUqOlr U6tv5sduZjhCozlE+5MxUz8bqzI4kZr+ChtA13nMBLwBn5m6i9uxn3ii9xGXRFq8shNm v3cntmfGVKsiShjxtTBY9XrohJ5aqXZH+lab3yMWREmVH6qyT4yTxfE4eiVQZAj+B+L4 h+1gpjdTJ1pNtyoAFD29oJ6lsqN9TCWRddCw4WO3QVs5WI2gN22IPA3k3Ur14Lfj47b9 5BNGSIRD0hy4A/Xg/Ssc3v/Y1KmnA8FVLBPOdZhUDHOLlFYBoFdkmOwPhowOPrayC+jS u42A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=E+0G79QB; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x18-20020a170902821200b00156b24c4bb6si40044313pln.120.2022.07.05.03.00.24; Tue, 05 Jul 2022 03:00:37 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=E+0G79QB; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231300AbiGEJyb (ORCPT + 99 others); Tue, 5 Jul 2022 05:54:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229995AbiGEJyQ (ORCPT ); Tue, 5 Jul 2022 05:54:16 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24CB111C06 for ; Tue, 5 Jul 2022 02:52:45 -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 A4835B816CA for ; Tue, 5 Jul 2022 09:52:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8C206C341C7; Tue, 5 Jul 2022 09:52:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1657014762; bh=9MTPdYNRD6u5hC7g7ZiQEjDmfdWtcP6Y0Ap52ScAOrU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=E+0G79QBInSietGAYHA+UwbA3SZdfOhuaklndufor9FZUA6khw3anhHUNDoGOHD3B OiNjMC0GZjnUkxas6g5DGYAsuZ/RnPNtExcsDV8q2J8RuM44nwYY1vDlloERd60WZh YKZlVgWUyfbZ4xKkyhFBQygOwhkVVcWBSixfQsmF+VGDJ0GohzgQWAE81Alg2zj2zx C70oiDFt5aiNCbRzP9yWU3+vZYKu4lPp3Xfr1kKLd5Mh+2vWJJhvZdawLdZUY4fHNP LF7WtnHGD4S0ApNQOLCA5bgA7XycFTlf0uTwsCjGWQIh5wKFOP+TKdHTZCj30wY0M+ kIDCKPPpyGxgg== Date: Tue, 5 Jul 2022 10:52:34 +0100 From: Will Deacon To: Ard Biesheuvel Cc: "guanghui.fgh" , baolin.wang@linux.alibaba.com, catalin.marinas@arm.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, rppt@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: <20220705095231.GB552@willie-the-truck> References: <20220704103523.GC31437@willie-the-truck> <73f0c53b-fd17-c5e9-3773-1d71e564eb50@linux.alibaba.com> <20220704111402.GA31553@willie-the-truck> <4accaeda-572f-f72d-5067-2d0999e4d00a@linux.alibaba.com> <20220704131516.GC31684@willie-the-truck> <2ae1cae0-ee26-aa59-7ed9-231d67194dce@linux.alibaba.com> <20220704142313.GE31684@willie-the-truck> <6977c692-78ca-5a67-773e-0389c85f2650@linux.alibaba.com> <20220704163815.GA32177@willie-the-truck> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 Mon, Jul 04, 2022 at 07:09:23PM +0200, Ard Biesheuvel wrote: > On Mon, 4 Jul 2022 at 18:38, Will Deacon wrote: > > > > On Mon, Jul 04, 2022 at 10:34:07PM +0800, guanghui.fgh wrote: > > > Thanks. > > > > > > 在 2022/7/4 22:23, Will Deacon 写道: > > > > On Mon, Jul 04, 2022 at 10:11:27PM +0800, guanghui.fgh wrote: > ... > > > > > Namely, it's need to use non block/section mapping for crashkernel mem > > > > > before shringking. > > > > > > > > Well, yes, but we can change arch_kexec_[un]protect_crashkres() not to do > > > > that if we're leaving the thing mapped, no? > > > > > > > I think we should use arch_kexec_[un]protect_crashkres for crashkernel mem. > > > > > > Because when invalid crashkernel mem pagetable, there is no chance to rd/wr > > > the crashkernel mem by mistake. > > > > > > If we don't use arch_kexec_[un]protect_crashkres to invalid crashkernel mem > > > pagetable, there maybe some write operations to these mem by mistake which > > > may cause crashkernel boot error and vmcore saving error. > > > > I don't really buy this line of reasoning. The entire main kernel is > > writable, so why do we care about protecting the crashkernel so much? The > > _code_ to launch the crash kernel is writable! If you care about preventing > > writes to memory which should not be writable, then you should use > > rodata=full. > > > > This is not entirely true - the core kernel text and rodata are > remapped r/o in the linear map, whereas all module code and rodata are > left writable when rodata != full. Yes, sorry, you're quite right. The kernel text is only writable if rodata=off. But I still think it makes sense to protect the crashkernel only if rodata=full (which is the default on arm64) as this allows us to rely on page mappings and I think fits well with what we do for modules. > But the conclusion is the same, imo: if you can't be bothered to > protect a good chunk of the code and rodata that the kernel relies on, > why should the crashkernel be treated any differently? Thanks. Will