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 EFAEAECAAA3 for ; Fri, 26 Aug 2022 11:09:36 +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-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=1xN37Y4euWT7JEHhPKlBgxOeLVFCGb8qdod1U4v8V1I=; b=Yg/ZcEcn5xVsLY ZPx0Z12YWQlQ/+4wJw5Z53WYDIne9KNVMkVTtxInk99bZoVp63xktSCqsPvcb0/0b7MkTBGkQ1Xja CakJhtWgfjX+kfpXH0OL7hjsMPD2MPt4vX18hr6kt9yLYxu+QDNW/t88QKuL5eY/wTou8wfjuVUP6 X+kcPV27W2s89YELKNJ+u/210wYWT2lKGPcMAc+EZkRGyOhdtrWFVCPy4GPYSzOXFHTyV8+3Ur0DW lwiigCWcjdZiAm+VW8DnZq0Dfm+DBTUCDCwbPxrxjXo/upblOoL6LkFEnZpeaztE89NIRAZoB7lAk CXpWZOPbbpCVUwEuqClQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oRXCV-001q7x-2F; Fri, 26 Aug 2022 11:08:35 +0000 Received: from out199-3.us.a.mail.aliyun.com ([47.90.199.3]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oRXCR-001q5D-Mt for linux-arm-kernel@lists.infradead.org; Fri, 26 Aug 2022 11:08:33 +0000 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R181e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046059;MF=liusong@linux.alibaba.com;NM=1;PH=DS;RN=5;SR=0;TI=SMTPD_---0VNJ0j-x_1661512103; Received: from 30.227.80.235(mailfrom:liusong@linux.alibaba.com fp:SMTPD_---0VNJ0j-x_1661512103) by smtp.aliyun-inc.com; Fri, 26 Aug 2022 19:08:24 +0800 Message-ID: <837426e9-0f24-2ce2-e631-b91276035397@linux.alibaba.com> Date: Fri, 26 Aug 2022 19:08:23 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.0.3 Subject: Re: [PATCH] arm64: spectre: increase parameters that can be used to turn off bhb mitigation individually To: Will Deacon Cc: catalin.marinas@arm.com, james.morse@arm.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <1659691274-48554-1-git-send-email-liusong@linux.alibaba.com> <20220826103958.GB19505@willie-the-truck> From: Liu Song In-Reply-To: <20220826103958.GB19505@willie-the-truck> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220826_040832_040673_033629D1 X-CRM114-Status: GOOD ( 19.23 ) 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-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org > On Fri, Aug 05, 2022 at 05:21:14PM +0800, Liu Song wrote: >> From: Liu Song >> >> In our environment, it was found that the mitigation BHB has a great >> impact on the benchmark performance. For example, in the lmbench test, >> the "process fork && exit" test performance drops by 20%. >> So it is necessary to have the ability to turn off the mitigation >> individually through cmdline, thus avoiding having to compile the >> kernel by adjusting the config. >> >> Signed-off-by: Liu Song >> --- >> arch/arm64/kernel/proton-pack.c | 10 +++++++++- >> 1 file changed, 9 insertions(+), 1 deletion(-) >> >> diff --git a/arch/arm64/kernel/proton-pack.c b/arch/arm64/kernel/proton-pack.c >> index 40be3a7..bd16903 100644 >> --- a/arch/arm64/kernel/proton-pack.c >> +++ b/arch/arm64/kernel/proton-pack.c >> @@ -988,6 +988,14 @@ static void this_cpu_set_vectors(enum arm64_bp_harden_el1_vectors slot) >> isb(); >> } >> >> +static bool __read_mostly __nospectre_bhb; >> +static int __init parse_spectre_bhb_param(char *str) >> +{ >> + __nospectre_bhb = true; >> + return 0; >> +} >> +early_param("nospectre_bhb", parse_spectre_bhb_param); >> + >> void spectre_bhb_enable_mitigation(const struct arm64_cpu_capabilities *entry) >> { >> bp_hardening_cb_t cpu_cb; >> @@ -1001,7 +1009,7 @@ void spectre_bhb_enable_mitigation(const struct arm64_cpu_capabilities *entry) >> /* No point mitigating Spectre-BHB alone. */ >> } else if (!IS_ENABLED(CONFIG_MITIGATE_SPECTRE_BRANCH_HISTORY)) { >> pr_info_once("spectre-bhb mitigation disabled by compile time option\n"); >> - } else if (cpu_mitigations_off()) { >> + } else if (cpu_mitigations_off() || __nospectre_bhb) { >> pr_info_once("spectre-bhb mitigation disabled by command line option\n"); >> } else if (supports_ecbhb(SCOPE_LOCAL_CPU)) { >> state = SPECTRE_MITIGATED; > It would be good to have an Ack (or a shrug) from somebody @arm.com on this > one. > > Other than that, the documentation needs updating for the new option. Thanks for the reminder, I will post another V2 version. Thanks > > Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel