Received: by 2002:ab2:6f44:0:b0:1fd:c486:4f03 with SMTP id l4csp203370lqq; Wed, 12 Jun 2024 23:50:17 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXDDxGXN5qi9dQxXuy6jMJJwW7+85n7NkuZ2JF5Q7/o4kRzue4E/WUvRp6fM8HwGQTOVQqvDOHWTHrs8WORAVcKF7LaGqj0iDf/ZEKZ2w== X-Google-Smtp-Source: AGHT+IGN8xAV2biFl9TYlXpA12uUZlbPR8P0TZpcWsIrk1LVTaS0oB+HVEXb1MbIwtB+1L53qJB0 X-Received: by 2002:a05:620a:1709:b0:795:5672:9291 with SMTP id af79cd13be357-797f5f008b6mr421049885a.11.1718261417413; Wed, 12 Jun 2024 23:50:17 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718261417; cv=pass; d=google.com; s=arc-20160816; b=r9semerAzb4sFrx2wCq6fiuVOsJP4v+LwDz2mO6YkbXyFOgPf2ivYyMtH2tooo88kZ WqTKmTEWa/JCvAfo+bBH8x+X8Hl/0XrLvxBN2UONGUomwwwVAQ4zSKJWulGYiaDZD4Gz JO/i3ZvU/+cx/7+l/ODh3pZPHXLLN0E7OYFlWXeH0Jx5dCf/9qXQvnMQDJSyZLrnIsGe NX9N1YfHCs96jcMLDXbRK0Q4lGfaHS1BUDRPXpAC/sPQw/tudil1Hr878vmatg6SDLS0 NZUPVzZgT6MVZ/qncqvyWpbb8yCEFXnLL0h5ZWo3bLojgOjyxH0CXZBhFhavZ990G17A PLBg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=dUgr+f5/S1BYrMzUIzzHoZq+nuXyyf5V0WdYC25Cd8s=; fh=vn98jj+cycVRhUcGhpmoW+XVBhjVuvU2M7UbYiTYFgM=; b=dg2RJUyKZZRxzlM2Gmp9HgkGhQL1MzV9ddI7kbMwkT6FIoFtRLw0ZOTJhJelNVpI4V L4O1SNMZwjxoC+tG1CXBtT7NLM/dfP+6u7oN+UvxQLIjRwjzuJ+6iFtVdAaH3eHh1A4I BdRYMlqI81w8+T6yA4/ACZeXubdcJVgujlQt0/FrZOyrMcOqZhGouVqlA0+h6t4haEVL 6ToJLjgAJ9lSLCDZZmybwnbCa0VLslB89AA653GvowOSgSIXw74Iqc7l+TrrOwKY8Gfi BPDsS7FHm90a/0kChvn0Jl5oOs2UZWlWp0BJOb9CtPDYkdkbaUcAMkoILcdeGb7eACfN V/uA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=M9CSiT8d; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-212654-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-212654-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id af79cd13be357-798aac9da2asi76812185a.23.2024.06.12.23.50.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 23:50:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-212654-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=M9CSiT8d; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-212654-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-212654-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 238FA1C22B20 for ; Thu, 13 Jun 2024 06:50:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7E50D137C3F; Thu, 13 Jun 2024 06:49:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="M9CSiT8d" Received: from out-183.mta1.migadu.com (out-183.mta1.migadu.com [95.215.58.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CC424137924 for ; Thu, 13 Jun 2024 06:49:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.183 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718261397; cv=none; b=tUf3VHZ6Fjg4n+kr2LAXu6UT60kP2JipPPlMP7xG+sg6o0rn/lkIDnRtQZXaoKnLfsgrh0KfRqY9GcxkjKQ83Dvsceual97buzWdVzouHjLpfZK8RqO7s5HZ/CMS/LmoGBfA6JiTX45zuanB6dfRkSl1erebjBJ2Caak9wIfyZY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718261397; c=relaxed/simple; bh=Q9ytFUaZFqi/5BMymYxqCA95wvqaeZhoarb+e5F9yPI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=UFstLM5ocnbK9winfJ/q0HaWlPWCMsElKT9zLXFFwfnK7Ch5Q9VMf/id7eYIBzcL+4zMG06Xr+cjDA19hEjgSP7DzVoiKrfJC5fN1yPEFyqQJghSBUfVGJ1S2NKlK/t++wOikiISRZzfcs3BkM+hSGgY244XLuX0XBzKRdxfeaM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=M9CSiT8d; arc=none smtp.client-ip=95.215.58.183 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Migadu-Flow: FLOW_OUT 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