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 BD6E8C27C75 for ; Thu, 13 Jun 2024 06:50:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=dUgr+f5/S1BYrMzUIzzHoZq+nuXyyf5V0WdYC25Cd8s=; b=4tUB4Se+KA5WmzvQKRupDq4Nr7 6eY4JAVw0SsOJV3fBLY1Lh7DFQyzUIVvDKjny/nX0lCi1yZDlhXLXPqCdWrAaohI47SQLCxLMINqA Pjz+NNYp9JLR7vwQlhEKqxO87FztUtxB94wmsb8k70SCgu803j6vNbC0/dGw4D3KwVFIezu3FQ1BK fvK2WbYlqt69U3MNA9g9TP2JxKzdaTJa0+vX0KYOlE2eKeST7b2Ln6S5TB822TVgiEdSoEh/5kktP 4qhTMQbBl0OadfOpUxIhfCtf6brOYDidNZDiQ2dgyfqrFzwfvty97c4zTdp1l3y9q9JFuyLscbtK1 vUfqqW0Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHeHa-0000000FN3I-09Je; Thu, 13 Jun 2024 06:50:02 +0000 Received: from out-185.mta1.migadu.com ([2001:41d0:203:375::b9]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHeHW-0000000FN0i-1QTe for linux-arm-kernel@lists.infradead.org; Thu, 13 Jun 2024 06:50:00 +0000 X-Envelope-To: seanjc@google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1718261393; h=from:from:reply-to:subject:subject: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=dUgr+f5/S1BYrMzUIzzHoZq+nuXyyf5V0WdYC25Cd8s=; b=M9CSiT8dKaHTw3piv1V6oTj1KqOQyfs8CvaI3RQ5vdJYFt99RH8vNd3LFbE9PIVk8OwVas XLz0PROCqSuYLAzNwIijJmurJ/2zA913Ie50WmEJwiiEM6WIAqspuiwNr8jfX+PHrPS0PA FrxV+3EAzC1TIsW+x5UmXdQ/vywRTBQ= X-Envelope-To: yuzhao@google.com X-Envelope-To: jthoughton@google.com X-Envelope-To: akpm@linux-foundation.org X-Envelope-To: pbonzini@redhat.com X-Envelope-To: ankita@nvidia.com X-Envelope-To: axelrasmussen@google.com X-Envelope-To: catalin.marinas@arm.com X-Envelope-To: dmatlack@google.com X-Envelope-To: rientjes@google.com X-Envelope-To: james.morse@arm.com X-Envelope-To: corbet@lwn.net X-Envelope-To: maz@kernel.org X-Envelope-To: rananta@google.com X-Envelope-To: ryan.roberts@arm.com X-Envelope-To: shahuang@redhat.com X-Envelope-To: suzuki.poulose@arm.com X-Envelope-To: weixugc@google.com X-Envelope-To: will@kernel.org X-Envelope-To: yuzenghui@huawei.com X-Envelope-To: kvmarm@lists.linux.dev X-Envelope-To: kvm@vger.kernel.org X-Envelope-To: linux-arm-kernel@lists.infradead.org X-Envelope-To: linux-doc@vger.kernel.org X-Envelope-To: linux-kernel@vger.kernel.org X-Envelope-To: linux-mm@kvack.org Date: Wed, 12 Jun 2024 23:49:43 -0700 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Oliver Upton To: Sean Christopherson Cc: Yu Zhao , James Houghton , Andrew Morton , Paolo Bonzini , Ankit Agrawal , Axel Rasmussen , Catalin Marinas , David Matlack , David Rientjes , James Morse , Jonathan Corbet , Marc Zyngier , Raghavendra Rao Ananta , Ryan Roberts , Shaoqin Huang , Suzuki K Poulose , Wei Xu , Will Deacon , Zenghui Yu , kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v5 8/9] mm: multi-gen LRU: Have secondary MMUs participate in aging Message-ID: References: <20240611002145.2078921-1-jthoughton@google.com> <20240611002145.2078921-9-jthoughton@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Migadu-Flow: FLOW_OUT X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240612_234958_925120_B51B3770 X-CRM114-Status: GOOD ( 17.69 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Jun 12, 2024 at 10:23:38AM -0700, Sean Christopherson wrote: > On Wed, Jun 12, 2024, Yu Zhao wrote: > > I do think there can be false negatives but we have not been able to > > measure their practical impacts since we disabled the flush on some > > host MMUs long ago (NOT by MGLRU), e.g., on x86 and ppc, > > ptep_clear_flush_young() is just ptep_test_andclear_young(). > > Aha! That's what I was missing, I somehow didn't see x86's ptep_clear_flush_young(). Heh, well the helper name isn't exactly giving any hints... > That begs the question, why does KVM flush TLBs on architectures that don't need > to? And since kvm_mmu_notifier_clear_young() explicitly doesn't flush, are there > even any KVM-supported architectures for which the flush is mandatory? > > Skipping the flush on KVM x86 seems like a complete no-brainer. > > Will, Marc and/or Oliver, what are arm64's requirements in this area? E.g. I see > that arm64's version of __ptep_clear_flush_young() does TLBI but not DSB. Should > KVM be doing something similar? Can KVM safely skip even the TBLI? Short answer, yes, KVM can elide TLBIs when clearing AF. Long answer: Software needs to be extremely careful to ensure that TLBI elision doesn't lead to a failure to uphold break-before-make requirements, if we're only concerned with architecture-specific requirements. IOW, the AF cannot be used as a hint for the presence of TLB entries for a given PTE. There's the obvious failure of skipping TLBIs for old pages when unmapping, but that isn't an architecture-specific issue. So, since KVM/arm64 doesn't play any games with the AF at stage-2, leaving out a TLBI when aging ought to be fine. -- Thanks, Oliver