From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f202.google.com (mail-pg1-f202.google.com [209.85.215.202]) (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 C6B0B3232 for ; Wed, 31 Jul 2024 15:01:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722438084; cv=none; b=Ut7Wm6uZxrT+6AVQfr193Z9ZT5Z1SW7V8iUzcMqZpcdC4tUdW2z+U7W3yJjQfJlquTnt5F/3tC0UzCngJjhyeb1buTgsQOm9FWIwpEHztRGzc1gTjHqUe+SW92ne5jUI+Ufqz61YiAR/5AyNCAhBcDmXxnesLoBU69vqe8z3tVI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722438084; c=relaxed/simple; bh=wUHLhFS9SdXHmqa3PQC6xsI/T85uU0FHGAHHTqH7qew=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=WJC0szHoCwRkw5VaChPpqNsLubY3Ny32kQMWilEpS4TFgXlXXe9sjabumrxrIKhPEqD3EXzkDIg4GEgnHQqsHdi7QVEifK4KJerKgtG1PNHCayb6wDyLLsht6j+XqND0y9/zZaa0ap/yIFhZ+HhQVFC3uC7C0Fde1XyOvmCa2t8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=3xRRTUT9; arc=none smtp.client-ip=209.85.215.202 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=flex--seanjc.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="3xRRTUT9" Received: by mail-pg1-f202.google.com with SMTP id 41be03b00d2f7-7acb08471b1so3068155a12.0 for ; Wed, 31 Jul 2024 08:01:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1722438082; x=1723042882; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:from:to:cc:subject:date:message-id :reply-to; bh=gNJBybQopQ2ZrxRweqcaE48I1KQGrUoMT3Gla2tgL0c=; b=3xRRTUT9Lxg9Pt5q3mX3veCC3CBSxjoRg7JuyFreN2guenAh34q6Fc70OF9yvqJI+y XM8lD8DrxJ6iuqxcBQfFRcWfjJORSI5Z6fNfQYCfP1ngzsvjNWmQUTd7dm3RzZ9un0Vp kkQoucLYdWUrjKJ4y1BqNeNf5PlXYGaZvDM4QW6KNjM3KliPDu9Qkr8qjnnnWfEGfIvb lI/smDcZErgunOcJUXj7e44VovwKpgS4pzcFL8pBzQ6uB9K4W8DrcfSzTDaq/3956KHb +BygWzRsIp9eBHsVw9I7Szrcq4RaYLgZmsHHadx5zpv4yUK6W7zVRzK8DeNZS8vUe8QB dKOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722438082; x=1723042882; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=gNJBybQopQ2ZrxRweqcaE48I1KQGrUoMT3Gla2tgL0c=; b=YX5CpXIqIfS8505/5DVMrMtM/NJo5ZghkApPbQhVZIpH4RT4PowddcMGQBF5D6F7xe 2CMSOVNPNhfPixJiOlgBs/pmWKt48xt2a/1rm7y1fYjE4V57nAgWB4yB2wrgC/G8BE4w rZz0V40xBElJqKL8ICd7IDweizaqAYt6FsS/w/89U6fLW/we633/U0syRuF+jDbKODkc 463tSeZQ2rWHLkg6fINRDbC8vUSc0fEIhkedph20kezt4LKxYoqbfuUiP+JgUradGLb1 MNoY6y8Op++x4KkJVpRSEJeUcAZUjL9Pe5kB7RcmpuDGrKSRfwG6ZKaZi+xgIcXDLqg/ 9hAw== X-Forwarded-Encrypted: i=1; AJvYcCUwkVBmffR89JAXpBum142gJxfbo45PyLYBtXBOa63W3PX7LgH6aDwZM2A0iue3W2epCbOvgvPQ1IjoLE4BHTdDVj1UKuWfe3h3vhxG X-Gm-Message-State: AOJu0YzfRtiVspdE5CZSrBXhKvbSjUCHdM6b5NwaCrNY0ML5ooJLwqUW IrqDUQhPkz3QPHvWg6UocZ7z+Yf+4p4wMp2+eKoeixir2cnCIJVKc6gknktpc4uWoUXvOkZ227K W8g== X-Google-Smtp-Source: AGHT+IGcAn8E6dkVWW8sE36BP9jCnCmxK5HfcNcn6NYUeDPjrXiDSAMLJMNmKjWnCHzC8DBP855Q/NibcH4= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a05:6a02:610:b0:7a1:6633:6a07 with SMTP id 41be03b00d2f7-7ac8dcbb142mr75473a12.2.1722438081874; Wed, 31 Jul 2024 08:01:21 -0700 (PDT) Date: Wed, 31 Jul 2024 08:01:20 -0700 In-Reply-To: <87cymtdc0t.fsf@draig.linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240229025759.1187910-1-stevensd@google.com> <87cymtdc0t.fsf@draig.linaro.org> Message-ID: Subject: Re: [PATCH v11 0/8] KVM: allow mapping non-refcounted pages From: Sean Christopherson To: "Alex =?utf-8?Q?Benn=C3=A9e?=" Cc: David Stevens , Paolo Bonzini , Yu Zhang , Isaku Yamahata , Zhi Wang , Maxim Levitsky , kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org, kvm@vger.kernel.org Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable On Wed, Jul 31, 2024, Alex Benn=C3=A9e wrote: > Sean Christopherson writes: >=20 > > On Thu, Feb 29, 2024, David Stevens wrote: > >> From: David Stevens > >>=20 > >> This patch series adds support for mapping VM_IO and VM_PFNMAP memory > >> that is backed by struct pages that aren't currently being refcounted > >> (e.g. tail pages of non-compound higher order allocations) into the > >> guest. > >>=20 > >> Our use case is virtio-gpu blob resources [1], which directly map host > >> graphics buffers into the guest as "vram" for the virtio-gpu device. > >> This feature currently does not work on systems using the amdgpu drive= r, > >> as that driver allocates non-compound higher order pages via > >> ttm_pool_alloc_page(). > >>=20 > >> First, this series replaces the gfn_to_pfn_memslot() API with a more > >> extensible kvm_follow_pfn() API. The updated API rearranges > >> gfn_to_pfn_memslot()'s args into a struct and where possible packs the > >> bool arguments into a FOLL_ flags argument. The refactoring changes do > >> not change any behavior. > >>=20 > >> From there, this series extends the kvm_follow_pfn() API so that > >> non-refconuted pages can be safely handled. This invloves adding an > >> input parameter to indicate whether the caller can safely use > >> non-refcounted pfns and an output parameter to tell the caller whether > >> or not the returned page is refcounted. This change includes a breakin= g > >> change, by disallowing non-refcounted pfn mappings by default, as such > >> mappings are unsafe. To allow such systems to continue to function, an > >> opt-in module parameter is added to allow the unsafe behavior. > >>=20 > >> This series only adds support for non-refcounted pages to x86. Other > >> MMUs can likely be updated without too much difficulty, but it is not > >> needed at this point. Updating other parts of KVM (e.g. pfncache) is n= ot > >> straightforward [2]. > > > > FYI, on the off chance that someone else is eyeballing this, I am worki= ng on > > revamping this series. It's still a ways out, but I'm optimistic that = we'll be > > able to address the concerns raised by Christoph and Christian, and may= be even > > get KVM out of the weeds straightaway (PPC looks thorny :-/). >=20 > I've applied this series to the latest 6.9.x while attempting to > diagnose some of the virtio-gpu problems it may or may not address. > However launching KVM guests keeps triggering a bunch of BUGs that > eventually leave a hung guest: Can you give v12 (which is comically large) a spin? I still need to do mor= e testing, but if it too is buggy, I definitely want to know sooner than late= r. Thanks! https://lore.kernel.org/all/20240726235234.228822-1-seanjc@google.com