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 69348C38147 for ; Wed, 18 Jan 2023 15:45:05 +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=DlgKjJSVhHNm2FQmL3CoINaXkk+qk84B7Cf/avr1dbY=; b=M5Tk6zlWlOJBJ7 Ug4CsV8s49x/IJbk2jD4iM/J5jP9hQRqkti7y+kWIXG8Ob+rR9X+RsL0tkgNu6pQ1ivCV9pk8T4FL McY9RU52UyyDJXi55+GvsA8/mihNDO40M1CCSW1GINiajN2l1DrX/govsDcM/iDVLsDmgSutSHHRD /i6u9fgFl9MX2vsGk9Y7N84GE2mNsCCIClt4+hI18TsJepT+gpZb9tFbefCUe85OFnJsC09NH9iVR nYKOUbtu5CqAO9xAIyYTXg2PyceHjIU5I1GYa/4uATrk34/F3rxeE2saUBlPxoU3WuLxFfrns1LOG Sm9P2e5fK+nQ4pHLFkxA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pIAbn-001dEg-Ew; Wed, 18 Jan 2023 15:44:15 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pIAbk-001dDc-5c for linux-arm-kernel@lists.infradead.org; Wed, 18 Jan 2023 15:44:13 +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 dfw.source.kernel.org (Postfix) with ESMTPS id AD4BB61870; Wed, 18 Jan 2023 15:44:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 30F43C433EF; Wed, 18 Jan 2023 15:44:10 +0000 (UTC) Date: Wed, 18 Jan 2023 15:44:07 +0000 From: Catalin Marinas To: Gabriel Krisman Bertazi Cc: will@kernel.org, linux-arm-kernel@lists.infradead.org, broonie@kernel.org Subject: Re: [PATCH v2] arm64: Avoid repeated AA64MMFR1_EL1 register read on pagefault path Message-ID: References: <20230109151955.8292-1-krisman@suse.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230109151955.8292-1-krisman@suse.de> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230118_074412_271950_30B50E9A X-CRM114-Status: GOOD ( 13.80 ) 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 Mon, Jan 09, 2023 at 12:19:55PM -0300, Gabriel Krisman Bertazi wrote: > diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h > index 03d1c9d7af82..3d1a5677321e 100644 > --- a/arch/arm64/include/asm/cpufeature.h > +++ b/arch/arm64/include/asm/cpufeature.h > @@ -864,7 +864,11 @@ static inline bool cpu_has_hw_af(void) > if (!IS_ENABLED(CONFIG_ARM64_HW_AFDBM)) > return false; > > - mmfr1 = read_cpuid(ID_AA64MMFR1_EL1); > + /* > + * Use cached version to avoid emulated msr operation on KVM > + * guests. > + */ > + mmfr1 = read_sanitised_ftr_reg(SYS_ID_AA64MMFR1_EL1); > return cpuid_feature_extract_unsigned_field(mmfr1, > ID_AA64MMFR1_EL1_HAFDBS_SHIFT); > } You can probably make it slightly faster if you add a cpucap feature. We have ARM64_HW_DBM but not ARM64_HW_AF. Not sure you'd notice a difference in practice though. -- Catalin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel