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 364A5C32793 for ; Wed, 18 Jan 2023 16:07:57 +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:MIME-Version:Message-ID:In-Reply-To: Date:References:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=3iXitlZluWqt3Tann5YAuQeoZcPnKX2GEpwkgclKyzs=; b=k9b1N6gGS2Vw90 GevDBYQHspWlb5mynfg4O74qlYifWtJIL7vuYsUImOzrHH5lMXq9hVK92HZsbXsmfXdDrSLKVuftz 34R9Yn3I7xqI8KB30qfenSRgFHJb28c+SRbZi0tGRLQJVT/e51YHwxUJtCP48E1i/KuoI6qjMOitr pC8boiC7iwWnt9GkYruJRGC4de3+5M5Tr3MF127tN14pUlzr96H++zkX/92jsWs/jpxHfpvU2TBjb f9p4EBrPTMolv/ECMsIy+PFswKY8nm9xv1ep5kOox6kOWo/xQOwiMyqN57Enp8qniUzkWLHLSn/Yq Pn1j8QSl9mnfUyxoXgZw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pIAxh-001lEa-Po; Wed, 18 Jan 2023 16:06:53 +0000 Received: from smtp-out2.suse.de ([195.135.220.29]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pIAxd-001lDL-9u for linux-arm-kernel@lists.infradead.org; Wed, 18 Jan 2023 16:06:50 +0000 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 1DC8920174; Wed, 18 Jan 2023 16:06:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1674058005; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=6LXdjWrwZRKR20+w+X2BlFDNA4MQ6bEDN09z5B+M7p0=; b=Y5iM1o1P8AaRAL0Sgoi6S/XBOoWtP5Vt5Sz/gCn3DF9HYYgxNgdlggOTumx5rAX9JWNtRz e/lgQi9XoV7VXruhGxOi1x7hiHb9B1WI/HOhp8H7dmTCIttOY+/1JJYzrntaSDNr7tBrcw ZaBmX7ZcA5Fw6DSz/aYQdLu3RI1AlbM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1674058005; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=6LXdjWrwZRKR20+w+X2BlFDNA4MQ6bEDN09z5B+M7p0=; b=dSTkASpeOXs0MGPnh+FcTXhKKgkdFJTyeebnnR7FYBrHwkrPcaCAcfw2EYyPaOSO+dWlGO 7mGOXeFLvzD6LYBA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 9B4A9139D2; Wed, 18 Jan 2023 16:06:44 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id VDOCGBQZyGNwHQAAMHmgww (envelope-from ); Wed, 18 Jan 2023 16:06:44 +0000 From: Gabriel Krisman Bertazi To: Catalin Marinas 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 Organization: SUSE References: <20230109151955.8292-1-krisman@suse.de> Date: Wed, 18 Jan 2023 13:06:42 -0300 In-Reply-To: (Catalin Marinas's message of "Wed, 18 Jan 2023 15:44:07 +0000") Message-ID: <878rhzbze5.fsf@suse.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230118_080649_533367_CBCEEC30 X-CRM114-Status: GOOD ( 16.76 ) 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 Catalin Marinas writes: > 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. Hi Catalin, I had a patch for that, but when I noticed the existence of ARM64_HW_DBM, I dropped it. it is mentioned quickly in the v1. >From my measurements, when comparing this version to a static variable caching the value (patch v1), the bsearch performance impact was not significant. I think it would be fine to keep this version. but, of course, I can add the cpucap bit if it is preferred. Please, let me know. Thanks, -- Gabriel Krisman Bertazi _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel