From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ej1-f44.google.com (mail-ej1-f44.google.com [209.85.218.44]) (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 24FD615AD9C for ; Fri, 2 Aug 2024 11:16:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722597376; cv=none; b=qaEpC1X74j2CvnVK6q4lGiIezKMiujQM18TBQKi4G3FH19dMQpZk2R7VyI3Y9pt5a1J1aRRGQCD+C9ZksIy3jnpJkihrcQQ24vpTKMQ3oVGuo7LO/UJ3lr7IDhCMeQbK5tPblnpgr//sqqSGXHtmEA2xVuYNh86IaHJIDoX8KWg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722597376; c=relaxed/simple; bh=5/L0Yc2Z+AOSOKZw3/Dotf6pZ+cloK9IZVwKZGtH7AE=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=LH4gza743+B7wbmwWjXpAMEvah1ifrpjdAa6YoQ/8z2z51cX3zBe3iuxZC+orkdoyWSVKFPDvoV60/tRbyW6wlSdHOYy6f3opjhngjuyVPhOjOHAbopiqx9/z5YNGx/+U25Mq2Rov2g1t+fDrmuWrNImJb5rs5W3mVspj31Yy5I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=REymIrjO; arc=none smtp.client-ip=209.85.218.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="REymIrjO" Received: by mail-ej1-f44.google.com with SMTP id a640c23a62f3a-a7ac469e4c4so562080266b.0 for ; Fri, 02 Aug 2024 04:16:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1722597373; x=1723202173; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:from:to:cc:subject:date:message-id :reply-to; bh=h+a+YbUYnYp2O9o3vDX++ZHVr+zNy81A/L7Ak8HFY0M=; b=REymIrjO6nz8wh62hISnn4LImQPpjFqsUw8yhtlO6qeC0I9bgSWxKozVCOCE0hBxcn 3BzwHdOKC/9Rci/92rYO3hkxjj74RtkvwcnTN3Mx0spXMn85Bsv4MZsbruZ2kJhDYCtm dWnnIRp46D/R0T5Y0oHZ/WssjT34nN5dr+SVBNxU0g/K8vQp7k64sk53qyTSkbHoOOym k3tbe+rrfFXRPG8ic6lH3kGDVvLwA3W1a4EGp9ye+wuHLIlJccbQ6I6H7UQyYRDEUQ5k hbd+K8lGzCxIa+Tfmogw6szFwAPPxZ2iJt78gCo9oe5/1yJQuG3N/0nr2G0g/fKXHyOU oWBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722597373; x=1723202173; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=h+a+YbUYnYp2O9o3vDX++ZHVr+zNy81A/L7Ak8HFY0M=; b=cNrE3kERCftsQaFAfq4TTADTh+R3xtKGC+ZEnIcs/5PLKAvn8T1o5BInOYBA1YkMaK Cp6mliBAwIJu/IvZtwYww1xYURZ+nVBE5C4jmFB3q/ZWgHymuz7IZQkjIwXV7Dzau5T8 Evt4vc/j7TOHv9OZvP0GcUWEweWlji5Lu10iEyCyJcKuDYHhYCup9CTUy0EZvnBajPVg B8FmMYV+1dUI0rJD8CswUW5WbUyM3AlpDTwA93v8WZfrJ996nsaLB5Vylo4ZV6WxCT8R val+5KTpjH/OFRDS2KHAJI1fqtNE/lSKYwQYgVwk8zehYTC8NtGpwiW/wXWyEgjPqbsw s/YA== X-Forwarded-Encrypted: i=1; AJvYcCUZXeGtvb70Nlt6+2q72wBrwVAr6CxMPGbzP6lU0Sw63bRincgA1E8zHxwKSTlWwGPoM8uNnv/jxATr5caBp7+2wXzktO9rt+Ey X-Gm-Message-State: AOJu0YysicODGGQk59R4GIbU0IR0YjME9eMgGHYhdeLYQxcWzbq7AXuV 0mXA5whfJvKYvoyvPGevrn3egVQleI23HnaeCj7MVAvQGI53bA7iwkDXJCy7QKA= X-Google-Smtp-Source: AGHT+IHUr2+eigMQMyKiFV2SC/+LcUpbtIeuSXGg+vhEQqD67tJuIK6amWVCFT4RRO+CzEGYIGxtXA== X-Received: by 2002:a17:907:25c5:b0:a7a:acae:340b with SMTP id a640c23a62f3a-a7dc628bf8fmr256404766b.31.1722597372903; Fri, 02 Aug 2024 04:16:12 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7dc9bcb19csm87224666b.42.2024.08.02.04.16.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Aug 2024 04:16:08 -0700 (PDT) Received: from draig (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 91DEE5F8A9; Fri, 2 Aug 2024 12:16:04 +0100 (BST) From: =?utf-8?Q?Alex_Benn=C3=A9e?= To: Sean Christopherson Cc: Paolo Bonzini , Marc Zyngier , Oliver Upton , Tianrui Zhao , Bibo Mao , Huacai Chen , Michael Ellerman , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Christian Borntraeger , Janosch Frank , Claudio Imbrenda , kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, loongarch@lists.linux.dev, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, David Matlack , David Stevens Subject: Re: [PATCH v12 11/84] KVM: Rename gfn_to_page_many_atomic() to kvm_prefetch_pages() In-Reply-To: <20240726235234.228822-12-seanjc@google.com> (Sean Christopherson's message of "Fri, 26 Jul 2024 16:51:20 -0700") References: <20240726235234.228822-1-seanjc@google.com> <20240726235234.228822-12-seanjc@google.com> Date: Fri, 02 Aug 2024 12:16:04 +0100 Message-ID: <87frrncgzv.fsf@draig.linaro.org> Precedence: bulk X-Mailing-List: loongarch@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Sean Christopherson writes: > Rename gfn_to_page_many_atomic() to kvm_prefetch_pages() to try and > communicate its true purpose, as the "atomic" aspect is essentially a > side effect of the fact that x86 uses the API while holding mmu_lock. It's never too late to start adding some kdoc annotations to a function and renaming a kvm_host API call seems like a good time to do it. > E.g. even if mmu_lock weren't held, KVM wouldn't want to fault-in pages, > as the goal is to opportunistically grab surrounding pages that have > already been accessed and/or dirtied by the host, and to do so quickly. > > Signed-off-by: Sean Christopherson > --- /** * kvm_prefetch_pages() - opportunistically grab previously accessed pages * @slot: which @kvm_memory_slot the pages are in * @gfn: guest frame * @pages: array to receives page pointers * @nr_pages: number of pages * * Returns the number of pages actually mapped. */ ? >=20=20 > -int gfn_to_page_many_atomic(struct kvm_memory_slot *slot, gfn_t gfn, > - struct page **pages, int nr_pages) > +int kvm_prefetch_pages(struct kvm_memory_slot *slot, gfn_t gfn, > + struct page **pages, int nr_pages) > { > unsigned long addr; > gfn_t entry =3D 0; > @@ -3075,7 +3075,7 @@ int gfn_to_page_many_atomic(struct kvm_memory_slot = *slot, gfn_t gfn, >=20=20 > return get_user_pages_fast_only(addr, nr_pages, FOLL_WRITE, pages); > } > -EXPORT_SYMBOL_GPL(gfn_to_page_many_atomic); > +EXPORT_SYMBOL_GPL(kvm_prefetch_pages); >=20=20 > /* > * Do not use this helper unless you are absolutely certain the gfn _mus= t_ be --=20 Alex Benn=C3=A9e Virtualisation Tech Lead @ Linaro