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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8CED3C43334 for ; Mon, 18 Jul 2022 13:10:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235420AbiGRNKU (ORCPT ); Mon, 18 Jul 2022 09:10:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235309AbiGRNKR (ORCPT ); Mon, 18 Jul 2022 09:10:17 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30A6812AB1 for ; Mon, 18 Jul 2022 06:10:17 -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 CFEFBB81607 for ; Mon, 18 Jul 2022 13:10:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B5FA2C341C0; Mon, 18 Jul 2022 13:10:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1658149814; bh=hdsWoAacUlbtUsKYM7Fe7L2NSapcAMw6cTP36dELNto=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=GwA3mNLUulPloNbONSLsDZACF7hUfHV0fY4DrHU2VveDdLJvhRLg9RbKosmmiafZD 9Hqc2ojdFd9zgs4/Ff60q8fScSFzEE01jLqAY5PK3S4+hkNlZ8Ynvq4XzG2Ls5guLs gUQSS68IB9XNiYxkciO64glvbjEp0oEm9JgC/DRbnHIPb/1m7tNoo8W8xJfXke3voe P4LlRmVDgwWXqWjKqECUV/0jeYRvd8nL8hOSb1juhn8wx5PCPwdf1WGik3UkzyWtkn UeA+VqLF70nrSe+WsDuMlkv+swx9Wd1x24x/8/8ZP6X59996uWI9FMq+HH+v28Y2f8 Q8ScC2k+QkHFw== Date: Mon, 18 Jul 2022 14:10:06 +0100 From: Will Deacon To: "guanghui.fgh" Cc: 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, ardb@kernel.org, linux-mm@kvack.org, yaohongbo@linux.alibaba.com, alikernel-developer@linux.alibaba.com Subject: Re: [PATCH v5] arm64: mm: fix linear mem mapping access performance degradation Message-ID: <20220718131005.GA12406@willie-the-truck> References: <1657460657-25698-1-git-send-email-guanghuifeng@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jul 10, 2022 at 11:33:02PM +0800, guanghui.fgh wrote: > In short, this path work: > > 1.Before doing work for rebuiling crashkernel mem, the pgd is swapper_pg_dir > in [[[ttbr1]]] > > 2.Change the [[[ttbr0]]]to use idmap_pg_dir pgd > > 3.The [[[idmap_cpu_replace_ttbr1_with_flush_tlb]]] are mapped [[[only]]] > with idmap_pg_dir mapping in [[[ttbr0]]] > > 4.The [[[idmap_cpu_replace_ttbr1_with_flush_tlb]]] will flush tlb all, > switch [[[ttbr1]]] to use init_pg_dir pgd(and flush tlb all again). > There is no tlb conflict to swapper_pg_dir. > There is no tlb cache for swapper_pg_dir. > > 5.Woring with init_pg_dir pgd to access swapper_pg_dir pagetable with fix > mapping. And modify crashkernel mapping in the swapper_pg_dir without any > tlb conflict and flush. > > 6.When finishing the work, switch ttbr1 pgd to the origin swapper_pg_dir > with cpu_replace_ttbr1 function(similar to the above). I do not think that this complexity is justified. As I have stated on numerous occasions already, I would prefer that we leave the crashkernel mapped when rodata is not "full". That fixes your performance issue and matches what we do for module code, so I do not see a security argument against it. I do not plan to merge this patch as-is. Thanks, Will 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 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 0DA9DC43334 for ; Mon, 18 Jul 2022 13:11:24 +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:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=dzvzN5Lp1oEw52eUrX44bqjS4HAFt/b1Lm0Gexa+YzU=; b=rMyLTLL0WjQ4rq CLjzLXC/zD5I1/BtXLVXPNZnZdnFy/HPnPsw014iGh0GYvPBrQ0WKyjNaTp6m3yPJm/WSo4eZ4OZS YVnnRkjSUbd7Ih48lxdgfRTIgZyQQGSXeFaoVhvIvo3f5NfsVIUb8mzsRBNNOZx8q8bo3SWTosX5Z k7s9wG+lbwq/HUSsdgqyozAoNKNrruhTDpqLvakIGF4V4/so0XfVGe60Qf0dwIw/xEWFjVEV7XtYy mYupC/QPLh+ffVOHt2QSrMKTauLiGMlhxk/FAkp+WIuRmDFwWgPHfcLYIqaFekronXVob9+9LFz5F f4/BLdma49kXbw5MpoGw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oDQVx-00DbLY-Qo; Mon, 18 Jul 2022 13:10:21 +0000 Received: from ams.source.kernel.org ([145.40.68.75]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oDQVu-00DbIp-9q for linux-arm-kernel@lists.infradead.org; Mon, 18 Jul 2022 13:10:19 +0000 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 E3805B81609; Mon, 18 Jul 2022 13:10:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B5FA2C341C0; Mon, 18 Jul 2022 13:10:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1658149814; bh=hdsWoAacUlbtUsKYM7Fe7L2NSapcAMw6cTP36dELNto=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=GwA3mNLUulPloNbONSLsDZACF7hUfHV0fY4DrHU2VveDdLJvhRLg9RbKosmmiafZD 9Hqc2ojdFd9zgs4/Ff60q8fScSFzEE01jLqAY5PK3S4+hkNlZ8Ynvq4XzG2Ls5guLs gUQSS68IB9XNiYxkciO64glvbjEp0oEm9JgC/DRbnHIPb/1m7tNoo8W8xJfXke3voe P4LlRmVDgwWXqWjKqECUV/0jeYRvd8nL8hOSb1juhn8wx5PCPwdf1WGik3UkzyWtkn UeA+VqLF70nrSe+WsDuMlkv+swx9Wd1x24x/8/8ZP6X59996uWI9FMq+HH+v28Y2f8 Q8ScC2k+QkHFw== Date: Mon, 18 Jul 2022 14:10:06 +0100 From: Will Deacon To: "guanghui.fgh" Cc: 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, ardb@kernel.org, linux-mm@kvack.org, yaohongbo@linux.alibaba.com, alikernel-developer@linux.alibaba.com Subject: Re: [PATCH v5] arm64: mm: fix linear mem mapping access performance degradation Message-ID: <20220718131005.GA12406@willie-the-truck> References: <1657460657-25698-1-git-send-email-guanghuifeng@linux.alibaba.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220718_061018_538945_23FC39B1 X-CRM114-Status: GOOD ( 15.95 ) 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 On Sun, Jul 10, 2022 at 11:33:02PM +0800, guanghui.fgh wrote: > In short, this path work: > > 1.Before doing work for rebuiling crashkernel mem, the pgd is swapper_pg_dir > in [[[ttbr1]]] > > 2.Change the [[[ttbr0]]]to use idmap_pg_dir pgd > > 3.The [[[idmap_cpu_replace_ttbr1_with_flush_tlb]]] are mapped [[[only]]] > with idmap_pg_dir mapping in [[[ttbr0]]] > > 4.The [[[idmap_cpu_replace_ttbr1_with_flush_tlb]]] will flush tlb all, > switch [[[ttbr1]]] to use init_pg_dir pgd(and flush tlb all again). > There is no tlb conflict to swapper_pg_dir. > There is no tlb cache for swapper_pg_dir. > > 5.Woring with init_pg_dir pgd to access swapper_pg_dir pagetable with fix > mapping. And modify crashkernel mapping in the swapper_pg_dir without any > tlb conflict and flush. > > 6.When finishing the work, switch ttbr1 pgd to the origin swapper_pg_dir > with cpu_replace_ttbr1 function(similar to the above). I do not think that this complexity is justified. As I have stated on numerous occasions already, I would prefer that we leave the crashkernel mapped when rodata is not "full". That fixes your performance issue and matches what we do for module code, so I do not see a security argument against it. I do not plan to merge this patch as-is. Thanks, Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel