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 8BB86C54EBE for ; Mon, 16 Jan 2023 20:42:52 +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=Hbb5EQQe3Teh1l+cNtTFJsiE+Pbai6YSWLqro1CqWVk=; b=q1uuCU9H/P8Bh6 2hvATj2VAHd5AEyTBqBxMqT7Nj9yW96Xrm322kYufIk/yXn67GvoTucLRM+lP6yYWCsfgPGRsXoBI +z6JWJCSdokvXPNslsap2Q/dAbqjgYIUygl+hOELJQMJS4IyHjYwgRZ/EEvxwaW37EpspkfuL9x6b 50NuByjQ+4j2gFYjg5d6/ljNi0U8Hnh+9ArI7yZoThtjrnMS1ov9O2zSRBx/MaZimRGITW4z4zO+d uxNPS0roIoD1Vije6fPxj9Pk66palDQj1KeYUFMw3xkTsL5jN/tdR/F8ViRMyf3EsaRQxL3kgqEkq JYKOfrbPLZAqjFI/OUWQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pHWId-00C13a-27; Mon, 16 Jan 2023 20:41:47 +0000 Received: from smtp-out2.suse.de ([2001:67c:2178:6::1d]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pHWIZ-00C12U-KE for linux-arm-kernel@lists.infradead.org; Mon, 16 Jan 2023 20:41:45 +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 255185FFC1; Mon, 16 Jan 2023 20:41:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1673901699; 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=VWfXylatoXmGuWZfA6a+03qS+I+lSMbTI5KCSVQaUzk=; b=ZVy0ijWkPVWczo4iBMG/mmrqejDpH1R1Xl11VrFniHOv2MCPy8t48JZiOhPkADWy1E5ZpS OHwJruutOT7QZhBpifkzTXt9Zd+ypAT9QmOGhjT3RQw5DIBXoiGKE7d552Bbx8vqW8DQ3F z4ibmHeiOBlybAugdY3GFbseaaZwkmQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1673901699; 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=VWfXylatoXmGuWZfA6a+03qS+I+lSMbTI5KCSVQaUzk=; b=tbA5jkmlDFOEzKOdIE+OWJiPr8nTpzTWektzbGRTBcKTQ44mEZCXlTqzR6bJRB5j1xHDWq xHZD3Mrmfw7qz2Bw== 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 AAADD138FE; Mon, 16 Jan 2023 20:41:38 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id Gu+CHIK2xWObLgAAMHmgww (envelope-from ); Mon, 16 Jan 2023 20:41:38 +0000 From: Gabriel Krisman Bertazi To: catalin.marinas@arm.com 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: Mon, 16 Jan 2023 17:41:35 -0300 In-Reply-To: <20230109151955.8292-1-krisman@suse.de> (Gabriel Krisman Bertazi's message of "Mon, 9 Jan 2023 12:19:55 -0300") Message-ID: <871qnuciv4.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-20230116_124143_863242_E9D98B76 X-CRM114-Status: GOOD ( 17.28 ) 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 Gabriel Krisman Bertazi writes: > Accessing AA64MMFR1_EL1 is expensive in KVM guests, since it is emulated > in the hypervisor. In fact, ARM documentation mentions some feature > registers are not supposed to be accessed frequently by the OS, and > therefore should be emulated for guests [1]. > > Commit 0388f9c74330 ("arm64: mm: Implement > arch_wants_old_prefaulted_pte()") introduced a read of this register in > the page fault path. But, even when the feature of setting faultaround > pages with the old flag is disabled for a given cpu, we are still paying > the cost of checking the register on every pagefault. This results in an > explosion of vmexit events in KVM guests, which directly impacts the > performance of virtualized workloads. For instance, running kernbench > yields a 15% increase in system time solely due to the increased vmexit > cycles. > > This patch avoids the extra cost by using the sanitized cached value. > It should be safe to do so, since this register mustn't change for a > given cpu. > > [1] https://developer.arm.com/-/media/Arm%20Developer%20Community/PDF/Learn%20the%20Architecture/Armv8-A%20virtualization.pdf?revision=a765a7df-1a00-434d-b241-357bfda2dd31 > > Signed-off-by: Gabriel Krisman Bertazi Hi, Considering the performance impact on kvm guests, unless someone opposes, can we get this queued already for -rc5? -- Gabriel Krisman Bertazi _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel