Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp1042192lqb; Wed, 29 May 2024 20:28:33 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUpOp5fi1DG/QnSalIk04A6eK2GYn8Nk227b5xefFUMQoQzwC1HQna6hBrehRJ6YJXqxbq+Djy8zVUtYdCwdoPztXhzsx+bMvWw0pES5g== X-Google-Smtp-Source: AGHT+IEUnOPlVtZqmtOIXLLwLRQ23canb3bmfX4ZWTzAMKOO0ih0kpQY3jgltx39rs2EeGTmp1+L X-Received: by 2002:a05:6122:1351:b0:4df:19c0:86e1 with SMTP id 71dfb90a1353d-4eaf2428894mr1164761e0c.13.1717039713581; Wed, 29 May 2024 20:28:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717039713; cv=pass; d=google.com; s=arc-20160816; b=TxrT2ru7g4DrXLYm+E8qQ2lM9/vyQZoq1GGkkLcf59VPQPITyQ0s83ngTF4SAqio+R 9ZIsiEaBDVsHzyGMtPn8zU/UwhA+M1UP7WSemZth7lDP7JExASMPz8Lr/BGL66VuLIkP 6586uEJ6mDtxS2AdU4YifVgXXXqyetA08KUJ4L64ppk+5KnaZp4zwDOT9+j2zAkvVn2o tEBEqu/J8j6Hs2IYoz9qAEmhSddly8ndxZ1sFweLbs/fmTJJLYCM833yLt96cq7MBYln QJkMEECEj7oc6K/SreKTm889rIw9CzArpQ9KejuRrAdK/Zbjv+9+1UPMsrArahup4Ozv CqAg== 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=CyFUQdvGKe8UpOcfXmkz33OD4v6xcNcft6Wk6HjbLrw=; fh=wQYu8tsMbTIiy2pAVLpjxuvZAqkIXoeo0zAVLAe/O7c=; b=aBAiHLJ+U5duUXl7Za+GpGr3KSDOrERuxEs80JUSPdIhXpX8SGeY2krDO6Cir+At6w tyrkP25Ox7rtNUL2gIYXVPy8S3Uq1v3ynKPk7HV7HpfHkYps9tS7xhEkkoPHYtH0FhA8 o4lIt60mK1bnxcQgLpLqHfRFHCfjeKTuXxMe7Fm+Yy+aN2efu5umwD6d+Aij1anTWXP/ YnysCr08n2GXXHqCr5MMxLGZlCTwFkn2olFFs/iUehffLPseb6BaQLxIz8YZMJuPXY9+ IzFszreBUgC/vqVs55a7HmCnaoz3KllVdZi96sbJTy/mXC8N85WliEpg56xjjOmGTg3H uxSg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=yD0l2WJW; 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-194914-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-194914-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. [147.75.199.223]) by mx.google.com with ESMTPS id af79cd13be357-794abd5178fsi1399349385a.658.2024.05.29.20.28.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 May 2024 20:28:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-194914-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=@google.com header.s=20230601 header.b=yD0l2WJW; 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-194914-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-194914-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 4CF0F1C21840 for ; Thu, 30 May 2024 03:28:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7F84A57C8B; Thu, 30 May 2024 03:28:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="yD0l2WJW" Received: from mail-qt1-f175.google.com (mail-qt1-f175.google.com [209.85.160.175]) (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 3211C56B68 for ; Thu, 30 May 2024 03:28:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717039704; cv=none; b=O9Eto3MPpW10hNvSikYPB8Pa5TZFBManWO5+LX/47PlewSviAhKzLzmSSDnzuATjMadptBfruTGD9r20wM1YGoK88hnE/NVdeZ/v2mu5ArSqk0OShx34kT2pu/YW0Pbc+ynsfwhQQ8uFswnn6NLePCSddAkAUVbbiNSAXmHB6Zc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717039704; c=relaxed/simple; bh=lj90chMb5O0KncpLqzXDubS3cuPfyVvzEjua9aYNaYA=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=n3X3+tFmy0aBmPd2nDqQ6l2vS0m7Np48OUOF3p1QZmCHTkZGeSQAWOXpJwEtdQ0nj5LLRpJTEDp3aWxlPOs2bc5rORq1v5cXIm5xiIJKL0LY+AxuKDfguy22Ub4hb50OadCGBpOCUvi0JWbrTW8Km10tntW9vGAVv8q3H913/90= 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=yD0l2WJW; arc=none smtp.client-ip=209.85.160.175 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-qt1-f175.google.com with SMTP id d75a77b69052e-43fe3289fc5so118411cf.1 for ; Wed, 29 May 2024 20:28:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1717039702; x=1717644502; 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=CyFUQdvGKe8UpOcfXmkz33OD4v6xcNcft6Wk6HjbLrw=; b=yD0l2WJWsKOG1zMBscp/d+Uwbn7OEEGaETPRVGgBkPKMriKH1UX96/wnam4Nfm+FFh fn9E2HHZG3aZ7+XyQdrRAqJlWSV86ARq4sg6iXkapBSUFWrj+S3pPINPwje6cHKTeENq 3ZYii34TdqQcBtd54afejudEW3D7apxROWnpmlhUWw7brozFBYa2CGl7dkLn2kAeOGzU de35IAwvGIIwLJ86QCVBOttVDrMb1JG7GlfZk/cpeeiGF+HAE4QX5kY8R4NkG0TwF2P+ 1V5i3O0kufjodFjqkNfHzfT0dAkaTnmcMcxwsli2zYO4tiK38yZGxx2stwXN4QPm/PFW l91w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717039702; x=1717644502; 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=CyFUQdvGKe8UpOcfXmkz33OD4v6xcNcft6Wk6HjbLrw=; b=wGbYdXMEAJ04TezyjikI1rsSf69wQus2wSEueoNKuqqf7kDtLCIJdqtxgTjTkElqxi PNwe5LiMwpo1aLy1mbbCwspWyRs9BteZG3JxVCWNcRDcErhYKbQDvODXz8QtaBk8H+e/ Ywhq1iYmxDvjIPasERQaDLY/GUmIclZ4D64nQc2PCFbo/+k5UR6wJd/2oeyvPRz73o2y y7B8Ubp0GDnrWaLZdY30OlgipKd1/CH+Xqt2WT+ucW02wOtuRy01ISWCNqXWeYeUepb6 zNsqkr615GKBu1ot+gucVNkHhS8LVL0jh9wqu5szM+SZYFDGtwX1BgOsu79KXLll3VvK Mv6A== X-Forwarded-Encrypted: i=1; AJvYcCXRT4cUxfDv6os8c32DcObbPwixQ18HEFKHy+9Dju5u1D/Am5Kj5dfG+fM4PBIEnDOODW/saq9mTexh3pX70pR4xFeh5wSp31qp53Vg X-Gm-Message-State: AOJu0Ywuo/cuvIZQJbjxntB7OcT+/nzq/Nftk3zIFDQ1DzSWXJ2Fu5+y N8p42VpAg4w3LoNehcQr6C4dgUfOUMHpTBjabzUK/Cgc7um1d3tICq0itpxxEH1QuwVXyjdpNdx Eegh2SdMix7D+tZNp89wClqm8YZhCyMefMNdf X-Received: by 2002:a05:622a:90e:b0:43e:cb4:1d10 with SMTP id d75a77b69052e-43fe8e5f830mr1851431cf.14.1717039701993; Wed, 29 May 2024 20:28:21 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240529180510.2295118-1-jthoughton@google.com> <20240529180510.2295118-5-jthoughton@google.com> In-Reply-To: From: James Houghton Date: Wed, 29 May 2024 20:27:45 -0700 Message-ID: Subject: Re: [PATCH v4 4/7] KVM: Move MMU lock acquisition for test/clear_young to architecture To: Sean Christopherson Cc: Andrew Morton , Paolo Bonzini , Albert Ou , Ankit Agrawal , Anup Patel , Atish Patra , Axel Rasmussen , Bibo Mao , Catalin Marinas , David Matlack , David Rientjes , Huacai Chen , James Morse , Jonathan Corbet , Marc Zyngier , Michael Ellerman , Nicholas Piggin , Oliver Upton , Palmer Dabbelt , Paul Walmsley , Raghavendra Rao Ananta , Ryan Roberts , Shaoqin Huang , Shuah Khan , Suzuki K Poulose , Tianrui Zhao , Will Deacon , Yu Zhao , Zenghui Yu , kvm-riscv@lists.infradead.org, kvm@vger.kernel.org, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mips@vger.kernel.org, linux-mm@kvack.org, linux-riscv@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, loongarch@lists.linux.dev Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, May 29, 2024 at 2:55=E2=80=AFPM Sean Christopherson wrote: > > On Wed, May 29, 2024, James Houghton wrote: > > For implementation mmu_notifier_{test,clear}_young, the KVM memslot > > walker used to take the MMU lock for us. Now make the architectures > > take it themselves. > > Hmm, *forcing* architectures to take mmu_lock is a step backwards. Rathe= r than > add all of this churn, what about adding CONFIG_KVM_MMU_NOTIFIER_LOCKLESS= , e.g. > > static __always_inline int kvm_handle_hva_range_no_flush(struct mmu_notif= ier *mn, > unsigned long st= art, > unsigned long en= d, > gfn_handler_t ha= ndler) > { > struct kvm *kvm =3D mmu_notifier_to_kvm(mn); > const struct kvm_mmu_notifier_range range =3D { > .start =3D start, > .end =3D end, > .handler =3D handler, > .on_lock =3D (void *)kvm_null_fn, > .flush_on_ret =3D false, > .may_block =3D false, > .lockless =3D IS_ENABLED(CONFIG_KVM_MMU_NOTIFIER_LO= CKLESS), > }; > > return __kvm_handle_hva_range(kvm, &range).ret; > } Thanks Sean, yes this is a lot better. I will do this for v5.