Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp1041997lqb; Wed, 29 May 2024 20:27:54 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW5ZQydD9LDX4vGB7RGjAyqfoJVJn3l7d9qFYJAlB+OTtiu2CbYcR4jCcubGZ3yx2zEVU0eqoGTq+cxdEgYqsbR5k+yotLiU6zXerZaLg== X-Google-Smtp-Source: AGHT+IF6400doGkrnM1r2pU2uKjpZUAcISwae05z1oP5Ex4hZ1XmpugTAL4RdyfhAtvplztF30/4 X-Received: by 2002:ac8:7dc5:0:b0:43d:f8dd:eeb2 with SMTP id d75a77b69052e-43fe930ece4mr13061691cf.53.1717039674640; Wed, 29 May 2024 20:27:54 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717039674; cv=pass; d=google.com; s=arc-20160816; b=Mgti06Lj82JPuFsNsgUbQ+b2G9cIGPFmYD6wIgVxv2EcK5C1HPrqu32x14Dq1tCign iuUAEEHoblVXog9cW7MUyfygwvw4axadoB3EUuL1jrI2NUY4+VNzAOtj3ufvuKmV0eXS aT7YZQbRSmdqdPU1DfW4buYYhooGQCQBwWrxkc7Okeg3wMmBVDcq+WA5DfVIUgxXVT9p x3ieawItDpgdOpDD15hx0UK8K3QLU/YAHpN+RsUg7+JlkqcuqC5ZydvKXbhckvctejnj lhlJPhJJSlB8su2C9H7jyVvhjQ59kaw0CpKN3BC7W4F/GcIVd2KdC5AkPDP7Xud/gDQj sp8w== 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=kzO8DZyZzCqrZIAMGt7yPpLcZJsj3wUliJt03pVmX2A=; fh=Fudvbc65ji1KgesWdzzPHHQSKfua/jLZ+097MGiv7gU=; b=RK+C7s/Ubuo10YnxoZ19bmyOUUyq3XQ4O3g7hJdzvZ8rN0KLG5D7zI52PiVgIVQVyc dWPutrKzpSr9JIAQxZHMxb99TaJPjl0XmKEl3HJvVYy0Kbv7xzaa/tfcu7Vg+W5cxikH LbxtqOTbi+7foVRFdS968GD10Dah+QWUVDbHxZ8JAWrTe0M8y/VA5MiZ/4aAamceqOil mYSqwa9pE1qFPXhK9JEog2j7WG3rKlg0khXvLtK1/aM+Wf6oB+qZKkHdAA0FKnWNWaK3 kQp8IJT7BLWnqad0O4aZPTip7aO1xKP6YoB9qFhnBlDMTIpw9EYqdLleXGWR9Wf2WvfW Xc3A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=qsEGJAf2; 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-194912-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-194912-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 d75a77b69052e-43fb17b96ffsi140734711cf.156.2024.05.29.20.27.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 May 2024 20:27:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-194912-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=qsEGJAf2; 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-194912-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-194912-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 59EC71C21F6D for ; Thu, 30 May 2024 03:27:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3300A56B68; Thu, 30 May 2024 03:27:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="qsEGJAf2" Received: from mail-qt1-f173.google.com (mail-qt1-f173.google.com [209.85.160.173]) (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 A7C836BB5D for ; Thu, 30 May 2024 03:27:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717039642; cv=none; b=dLXVV9kmerB8C82RTTSwqYoHvvkgy5yVNBJEH6qDk6ssJEMY/7OzAYopfi0ya+fSkIoUrGC+kITw5N0/yT52QDZwxsyEvvyuqTpVm7MLTN3kOns/Tt56ObFmJLCrvRLS1meNyiEx7lqQu/LjVm1kKNEE1nl+3ulH2pLW5wIFfR8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717039642; c=relaxed/simple; bh=xwqfvipxZXJK+B/0mrTj9cWb8eP7mVNihD2LXTHfaSk=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=iMiWQS/H7lfHEKLWUSHCvBn0Zgu19C5bGMhyhHxThyRrGOxvN8Z6Ibp2gdJA9Yr0dhpiR5OEke610+3jJFfbo6gEKz9Rdaiek625wHxecPGzWj0dhSNXpg063aYQTQfX7b90DWaMN5OqNCLIrSXUr0WUCvT4m+yQjxt3SHPV45o= 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=qsEGJAf2; arc=none smtp.client-ip=209.85.160.173 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-f173.google.com with SMTP id d75a77b69052e-43e14f0bd75so110911cf.1 for ; Wed, 29 May 2024 20:27:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1717039638; x=1717644438; 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=kzO8DZyZzCqrZIAMGt7yPpLcZJsj3wUliJt03pVmX2A=; b=qsEGJAf22FtK1T9YmxDUPjIaTDS2NZnp9Fb63aWXEdLh11vy9K3GUtRHVQ2OvSxy4W YOIngawcKAbQ22m7NWqo4A8AJsQ+8jNEsKEeg0cLMRtvfnisqYRy0CT841KLKkbrALaE umy4gwWYR0Szf3ttiYYY2CXOia0EyA84rDpG3wbq14ytUoqM9mfqFZQ2jAsEK0K4QYYa HGsYbUTAh++b/ElOnZaM8/TvE/1jF87HOOYAHzJ0j1spyV53vdz00+1WV1OfO5eaza6U qSeNHoybqgSlvRqzY9z4RhStBbyyvzCLzNVZO9bmWhRKHjuj6+5t73jdH2Rdr/jpchlK uU9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717039638; x=1717644438; 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=kzO8DZyZzCqrZIAMGt7yPpLcZJsj3wUliJt03pVmX2A=; b=g8RelapmK6yRdTFbjpTJN8ealkft0lQDaAYIU+K7os24g3EOGgZ7rCNnlVkfL8mku+ RPP6OrpJaq16xZlNsSl3WJy6eRG8/98nnmFD3Do/2T8TfK4tspUkFylBFi1tiler5/qY K1QyD5HEZ9Q8GDUP89NaCxsqZl/8VKuvtzJIR6XPjT777K0qkbB+LSsNottD+vWHz8S5 WNmRbFoEGkbcfyjVrEvWHm+jHktmo2YE4EvGRO9eSh2EMESujeHj0KYXuxmkV/zPFNk9 b8/TCehyUzy902zJARecXyCoCTaCuNHkmeP5HxWxYz9QOlPACm3CdhYwFxlqEVyb47Kw FHtg== X-Forwarded-Encrypted: i=1; AJvYcCWUA2A64r13aieqvDODZD8cSvDZ++VraHPMo6A7SnKLaYip40i2v+ITi5B7AsvsTnD8htggRgdgTytPEDbsG8iQuhZVm4sVFWRP+558 X-Gm-Message-State: AOJu0YxzklIbtANWQQ470cEcRBFh0HiIIOcm8ApO76Wsnj5APwW8Y5x9 lVnMG6be+UZnnx/QGar087n11goq0PdH60htrU7U3t3hXoyBtnWhlHcAG0+kPPO1dFllCGsWMMw OFQnaJY8tx/NWyEYChzDl9yuEdAXshP6pfi0t X-Received: by 2002:a05:622a:a313:b0:43f:ebce:be50 with SMTP id d75a77b69052e-43febcebe65mr835941cf.16.1717039638165; Wed, 29 May 2024 20:27:18 -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-4-jthoughton@google.com> In-Reply-To: From: James Houghton Date: Wed, 29 May 2024 20:26:41 -0700 Message-ID: Subject: Re: [PATCH v4 3/7] KVM: Add lockless memslot walk to KVM 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:51=E2=80=AFPM Sean Christopherson wrote: > > On Wed, May 29, 2024, James Houghton wrote: > > @@ -686,10 +694,12 @@ static __always_inline int kvm_handle_hva_range(s= truct mmu_notifier *mn, > > return __kvm_handle_hva_range(kvm, &range).ret; > > } > > > > -static __always_inline int kvm_handle_hva_range_no_flush(struct mmu_no= tifier *mn, > > - unsigned long st= art, > > - unsigned long en= d, > > - gfn_handler_t ha= ndler) > > +static __always_inline int kvm_handle_hva_range_no_flush( > > + struct mmu_notifier *mn, > > + unsigned long start, > > + unsigned long end, > > + gfn_handler_t handler, > > + bool lockless) > > Unnecessary and unwanted style change. Sorry -- this will be fixed. > > > { > > struct kvm *kvm =3D mmu_notifier_to_kvm(mn); > > const struct kvm_mmu_notifier_range range =3D { > > @@ -699,6 +709,7 @@ static __always_inline int kvm_handle_hva_range_no_= flush(struct mmu_notifier *mn > > .on_lock =3D (void *)kvm_null_fn, > > .flush_on_ret =3D false, > > .may_block =3D false, > > + .lockless =3D lockless, > > Why add @lockess to kvm_handle_hva_range_no_flush()? Both callers immedi= ately > pass %false, and conceptually, locking is always optional for a "no flush= " variant. Right, this isn't needed in this patch. But I think I need it eventually (like, in the next patch), so I'll move it where it is really needed. > > > }; > > > > return __kvm_handle_hva_range(kvm, &range).ret; > > @@ -889,7 +900,8 @@ static int kvm_mmu_notifier_clear_young(struct mmu_= notifier *mn, > > * cadence. If we find this inaccurate, we might come up with a > > * more sophisticated heuristic later. > > */ > > - return kvm_handle_hva_range_no_flush(mn, start, end, kvm_age_gfn)= ; > > + return kvm_handle_hva_range_no_flush(mn, start, end, > > + kvm_age_gfn, false); > > } > > > > static int kvm_mmu_notifier_test_young(struct mmu_notifier *mn, > > @@ -899,7 +911,7 @@ static int kvm_mmu_notifier_test_young(struct mmu_n= otifier *mn, > > trace_kvm_test_age_hva(address); > > > > return kvm_handle_hva_range_no_flush(mn, address, address + 1, > > - kvm_test_age_gfn); > > + kvm_test_age_gfn, false); > > } > > > > static void kvm_mmu_notifier_release(struct mmu_notifier *mn, > > -- > > 2.45.1.288.g0e0cd299f1-goog > >