Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp504092lqs; Thu, 13 Jun 2024 17:49:11 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUP9Ffcj3ptT1NNFIBr5JFRQn1VoWijCbxTUMoWndQK+h12mnvYL+zVx+uinAIBNDOa+D1XmUuz7wF6WpUNEexLgnuKPL7Exs+yiR+mXg== X-Google-Smtp-Source: AGHT+IH9ILKqtQ5bwaVi/P4dy/9myr9Ay24xJJdodJdBbZ4aAXapq2CQVBebfyxfdetUWO+cy8mH X-Received: by 2002:a0c:f842:0:b0:6b0:4cc0:2168 with SMTP id 6a1803df08f44-6b2af2ff426mr25234436d6.30.1718326150971; Thu, 13 Jun 2024 17:49:10 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718326150; cv=pass; d=google.com; s=arc-20160816; b=kBcYXUjejx/4YgD4V46W72+X7rJ8AnlQuE/5MrHmwMqyzWNnnyFmKypJiHZk7vC55N Gx/yuvSf0/O//NCMMJGuWyb7E68jUDJWfqAWfzbVGwZXNITLsORk3Mew6pGa+9t/x9Y8 VagosPByoNXrvkF/fNJKxY1inc+M060EV00F863cj2yWn68B734USEZcnMM/BdGpVbud mwd8DsMdvkJ3+XmA977Ax4qSiA+NyFdOYCQttbe64m63io10KkaYDq5O5jxS+o30Wjrg xR5jhxLSSlALeCQvB8zvGoDbfN+Owng1R1bcg7jn0yi4JHlQse8TwLyfAjtGM6h8nGyo Itvg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=Cs3I7xb2JkPfyVWwhfDDItDBDpUbWjmYdCsu/iDXVRE=; fh=sXq4TZGl43309S+00Iq4VXTop1qx+xNmFMTxaFcVCeo=; b=mM7rfjLIZURk2vHxmANQg0XzrXhRx0H3fkybTBFm1H58dVjLDjHtf3U/eY8Y/YDx6C Vz4280o2yK5daFEC8GakvVPHQh2Hc4vewwlKFvK3hTktnNr8zu3muOTZtWypzf4DaMW9 rro5gX170LouPTclyWsc9sWqGwCMB7xf0dTDrLRSy5KpvoBOcboG3514zOD/l2fEbAZm 5dhNY4BoiWz+idM+Zou8PA7JVDfGQdA2Uddx6QCWtkIWNZK+8iqbRVkiu8lSlhkPhKqP DrLfdtLCdYgcrTVz0I9xR+W1frz4/xq9GYgw+ZK7y4nxZfl4xT/PLTOsTcR3z19KT2vm w4gg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=dtrXvUsG; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-214152-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-214152-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 6a1803df08f44-6b2a5a172ebsi27262996d6.58.2024.06.13.17.49.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 17:49:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-214152-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=dtrXvUsG; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-214152-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-214152-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com 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 AFE051C211AD for ; Fri, 14 Jun 2024 00:49:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 22D0F4C6C; Fri, 14 Jun 2024 00:49:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="dtrXvUsG" Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 040721C3D for ; Fri, 14 Jun 2024 00:48:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718326141; cv=none; b=Mv5eMwJqp9kW8x6LqaeOrM4MHydp3c5i0TbceE1Oh2d/dKHMBjNcMWTLrk+ZmYSuTIVo9M832AvNpIjdFD0hEVtwUetYOY606ijtbt+FEaKdpWmATpa+ae9Fqb8zwxZ0uBi0TGHtg++a18RCWK1+GOCBjREkzxAI6ThgtMg4d1E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718326141; c=relaxed/simple; bh=EzpkdrF+lhKU70e/G955Esb8W0Pby1fF9pS1lclAB+w=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=UtzPJ/DlIxp973YODyd38NGpWeh07z3UK+4U6c04zYc4q7Q0i0dWrgAH8ijCJogoYC+Bht+gnPuVXQahHJ2O+nDp1HNAcI9/4atuQ35Nxo7T3WZyDqTW8XQxE1uMr+KT6Lg9Nw0wIgCFhh7Ng9OY/XTO7YK5E3WoOHFLj11QVs0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=dtrXvUsG; arc=none smtp.client-ip=209.85.214.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-1f70ec6ff8bso85875ad.0 for ; Thu, 13 Jun 2024 17:48:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1718326139; x=1718930939; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Cs3I7xb2JkPfyVWwhfDDItDBDpUbWjmYdCsu/iDXVRE=; b=dtrXvUsGBzM1zr29vh5hOYKxdIP6P+az+QDjYj+sTaJISBKwtwTBtLAaSW0OmGlF/Z EQwiVPrASgXAUNZ/Zn4NrHLj4zZPIQDEhEZCW7lOePlu+P6BsECJWwVWkQQjHNoy4LFB 09iHDkeUqcqg3O3mTZLt+MpPvnmo38wmcLDhOezFRdBPWz3pJFkOYpFNd0IpBZ6GTi1o AXlKf5kAHprVLwYwzFpOz2LbPDTUJKISjGugc2fmVKP7CQTH7vrN3RNJ2klO6j7FsVFC 4UotxyN4r+/4trESUfUfFS8rUxCVU65xmMUAViiz0EM342z6iHz4I6WW/0W20Tk1oCbU 4Q1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718326139; x=1718930939; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Cs3I7xb2JkPfyVWwhfDDItDBDpUbWjmYdCsu/iDXVRE=; b=ZRXrhyKOlpoAKDTV30CZOAh2YPLsaBeNPnps7POhAtY1Wfi1xb9lRlyKEFBZS0oz/b mMyQFEq7X1u/L/2NfWJQnZlCIV92rZLtBtYGWhlYf0Z/dXBZvpvrC2dYQN8cc0TbATJ5 m9XV6ewhFZp1M5z24Djtx3+D6cLBmXwfroFh0A/v10TZ7HTOCLU9mr4ODc1f4oMfORB5 PkLJ2mLSePd4RRXEwCsSSHGeqV7Cg/x9OJz1jRLEAjqzHaNF4eQS5wE7c/oTmMYKxCva V52ECOoSA5Wqqk8VgxxjsuDa3CkZKflH0P8lusFNsGhgyaeAuOraPxO2XcXXJGtszI3c 4DbA== X-Forwarded-Encrypted: i=1; AJvYcCVNRvwbrIDAguK1oj2Q4oJ/nVm3HqS5SKXDWJ06Fyf9+DzbV1ZxV4BPKndsuAi2OErv3aBdcfKYEsIzT6ue4XgA+qyIZaMVLmbAQ8KS X-Gm-Message-State: AOJu0YxfHjRq6Nzh8KSIrsWlTYZ7eU4FySkDMQdMQFAKok/UkE71Y8ov Ea74XtoRgnIfY5AA7k0aB1IIKzB5dK4Zvv9hii/VeaFFAY60LXl/8/yQSefaJAaihVHHfaEI3XL QlvQ+I5XDuIniU9pIdjnjO5bODmXjaBcvitym X-Received: by 2002:a17:902:b782:b0:1e4:35b9:cce0 with SMTP id d9443c01a7336-1f86777297bmr804415ad.9.1718326138884; Thu, 13 Jun 2024 17:48:58 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240611002145.2078921-1-jthoughton@google.com> <20240611002145.2078921-5-jthoughton@google.com> In-Reply-To: From: James Houghton Date: Thu, 13 Jun 2024 17:48:22 -0700 Message-ID: Subject: Re: [PATCH v5 4/9] mm: Add test_clear_young_fast_only MMU notifier To: Oliver Upton Cc: Sean Christopherson , Yu Zhao , 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Jun 12, 2024 at 11:53=E2=80=AFPM Oliver Upton wrote: > > On Tue, Jun 11, 2024 at 12:49:49PM -0700, Sean Christopherson wrote: > > On Tue, Jun 11, 2024, Oliver Upton wrote: > > > On Tue, Jun 11, 2024 at 09:49:59AM -0700, James Houghton wrote: > > > > I think consolidating the callbacks is cleanest, like you had it in > > > > v2. I really wasn't sure about this change honestly, but it was my > > > > attempt to incorporate feedback like this[3] from v4. I'll consolid= ate > > > > the callbacks like you had in v2. > > > > > > My strong preference is to have the callers expectations of the > > > secondary MMU be explicit. Having ->${BLAH}_fast_only() makes this > > > abundantly clear both at the callsite and in the implementation. > > > > Partially agreed. We don't need a dedicated mmu_notifier API to achiev= e that > > for the callsites, e.g. ptep_clear_young_notify() passes fast_only=3Dfa= lse, and a > > new ptep_clear_young_notify_fast_only() does the obvious. > > > > On the back end, odds are very good KVM is going to squish the "fast" a= nd "slow" > > paths back into a common helper, so IMO having dedicated fast_only() AP= Is for the > > mmu_notifier hooks doesn't add much value in the end. > > > > I'm not opposed to dedicated hooks, but I after poking around a bit, I = suspect > > that passing a fast_only flag will end up being less cleaner for all pa= rties. > > Yeah, I think I'm headed in the same direction after actually reading > the MM side of this, heh. Yeah, I agree. What I have now for v6 is that the test_young() and clear_young() notifiers themselves now take a `bool fast_only`. When called with the existing helpers (e.g. `mmu_notifier_test_young()`, `fast_only` is false, and I have new helpers (e.g. `mmu_notifier_test_young_fast_only()`) that will set `fast_only` to true. Seems clean to me. Thanks!