Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp2786409rdb; Mon, 5 Feb 2024 19:03:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IH8TiC98K/nr9oV8rHzyYQH70PHU7J8xto3mhu1ibJtesvuHVAHiMEjhflWz7nen5O2Wjfc X-Received: by 2002:a17:906:30d3:b0:a35:88ad:e607 with SMTP id b19-20020a17090630d300b00a3588ade607mr880019ejb.31.1707188581430; Mon, 05 Feb 2024 19:03:01 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707188581; cv=pass; d=google.com; s=arc-20160816; b=keCvZznBq/MdXEmPtemBw5fklVV7w+in7S4Ek0yOzMJ6Fkn6T3FmexdZLC5SFNQJU7 bGOaZTh0Ulv+J4pHKEhQQPKvzVcVxbBFKix1fOhV2j6ZAXQvmz+3f0G/k2kZ8d7Q7+Om Z+GxtCiyJTOYMxSLLKVvSMntur9qQcs7/QKO8tUm5bGxwwQLH0+qrXrf2RHViv00MME+ XA7pGQYq6dKKoEOjh43+jV/NNo/APuPw6cucpGejJ/0DfBoxR0H0cBFzbIT05okcZQE5 F5434r+2qMtXk7FznrH1I+lXEAIA1QRZsw+BH7Pnl3cRpgRL/TU5qJA5ZcV2E832KWGC 8Q3g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :in-reply-to:date:dkim-signature; bh=WaTcFjuXmqnsH7kqgmGjwl1nafZpPgrra2KesS58E+w=; fh=8M+IuEqMzi/tU8vntNo7YIw9UL/OEFDb9bynMCBeFoY=; b=EyihxbKimlFmHTSbwjhZkXtr2JR7KwmSgvGk5Y2hJ8Mfo4zpyEdifR9URsIgFrgRAk lQNep478cfBYjupUPO53CD/f2saHES5UIzE8Nh0OxyGr+3y38NT2af/fo6qck5unSpyp kTLc4XPHKtrGPqm+hcwAOwHi03tWRdIyvYziqyHf/DFmURvPBrrhHFu5r5pYxKRseqrN RfQ4GMa3uTeBMDQQxP3aX84jSlMVdTbxQJijfM4tCZ7T7b+WS3+/fStAq7p7sKs8u+Ph JS9qa5pP5xvK5EwrZiTup50203j8UksiB/Y5z0hLZKTP/hZTdCFOvRNpYBzVdNfk121A lb6Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b="sTteBOu/"; arc=pass (i=1 spf=pass spfdomain=flex--seanjc.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-54231-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54231-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com X-Forwarded-Encrypted: i=1; AJvYcCW0koFqlxpaJ0AFehrZ3SAIh0casOutlNJCGwGVdGUkk71PuvSFExS81Bz1nr7QZJ3UWk18zilqwtXDVha6HSrTRT1/CDDuxA1yd6jghw== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id ci8-20020a170906c34800b00a3829e35d55si118964ejb.108.2024.02.05.19.03.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 19:03:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-54231-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b="sTteBOu/"; arc=pass (i=1 spf=pass spfdomain=flex--seanjc.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-54231-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54231-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 06A371F24E7F for ; Tue, 6 Feb 2024 03:03:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7F8E87319F; Tue, 6 Feb 2024 03:02:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="sTteBOu/" Received: from mail-pg1-f201.google.com (mail-pg1-f201.google.com [209.85.215.201]) (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 4B84D6EB71 for ; Tue, 6 Feb 2024 03:02:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707188566; cv=none; b=MGGAJef9nKA1PDmkGyB1gkELwlx4tZPb0HxbEipWDDXyjdrsHr0ndhTYQl8cjBxYVG2xQRhlduWBgRutFBXI/IEubsBFjLImIqyQG7/ZSCkUZWnAyjhKizPeLoM9iwI4krsuRDfj1wBJ8Iig52Mjt+DtFk7NYlcaS3FLsKNL+9A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707188566; c=relaxed/simple; bh=kBzx4awxw5LVCDNkJdTstMCTGo6+HBvB8LVztcy5v/Y=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=RHN2TTwwj+mzgdoLF0+3DrsbO5HPzP1Xnn1JrO4x54Okdj6KSbZtil3XfFl7xLlLmttWNaiLmo8tVuuJHnXYS6Fevjxm9Kjtz3ryDnHuH0HSa926mUEHKoTEAqS1Ukl+eab9Lb6RXyHEDCdkMHUlYlP7gLSiL/AolxQ9w54tses= 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=sTteBOu/; arc=none smtp.client-ip=209.85.215.201 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 Received: by mail-pg1-f201.google.com with SMTP id 41be03b00d2f7-5c66a69ec8eso5863579a12.3 for ; Mon, 05 Feb 2024 19:02:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1707188564; x=1707793364; 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=WaTcFjuXmqnsH7kqgmGjwl1nafZpPgrra2KesS58E+w=; b=sTteBOu/bmgYSMfAgpxmSuCzB7bcILb0Zl7z8BVLPcjZ7LBJ0Hq48gjQC5Gc0i6Xy7 ax1K5xB7EbXFEJkQ/GrlFNUWFQgkp35jOey/95yy7ZC17CLnkjbpU2roL5zsXLr4k/m4 9evToShmMc6Hl+X3BrgxOFHSCr6fGFO8z1pv9jZFr3uTThMx6wKXl4YPk3+I5jB4uD+z TyI2dSAHRF6gVZ++BOHvgerGINx0JJR0wChmEGFRnd2sYV79ZbnuVhPhCBvYRx+4cFQ8 uV3qpfugQ3fkswA1a94pQd6OdMjKMA2K9EkB49vWH4YxTcP8o9ES7bi2ZAanzmESGIhN fIYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707188564; x=1707793364; 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=WaTcFjuXmqnsH7kqgmGjwl1nafZpPgrra2KesS58E+w=; b=t0t3iAnjtyEURZyfJvrB5YoBKdNThOfrZE8/FjX/Qxkwpyn/AHc42EAEBDoNcm5Nwg QnrNqbcnG3cpQg2kYwJwCCGKh1/yEkZsqn7bZipP5aMy8cxTgcDtRz2udXYo0MfQ2S6i zx2q63nt197CubBv98lENNBGCnm0VH2Qd8E3VmmUcYtrMQZQx4uLm2I+yJ8PH6PuMfsp eixRfkqAfdSaYH5/zbD3YMRmAihtJDzslOYaCeHwN+IABsIrwxtSRhEB+TJockOCJeL6 AX2YSzjbl7aE6GIiDWAP9cn94o7e2hoxTD3FpWYIVEGXgoc+Y2ibaY81nRbgZrL1Xrsl Faxg== X-Gm-Message-State: AOJu0YzbXBuVq68qfcyZNY7fhR9Yrxhgt+5A834aO3NXKw8dVIKzUDpj phkVWD7246Vin/YknEUhGdsYzOB2E1/XLCI/rVQslrQVgFsSJ6Y8rJUZxBXdQY9zvZxpu5xc3rS VrA== X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a65:6d8a:0:b0:5ca:45d0:dc1b with SMTP id bc10-20020a656d8a000000b005ca45d0dc1bmr25816pgb.9.1707188564462; Mon, 05 Feb 2024 19:02:44 -0800 (PST) Date: Mon, 5 Feb 2024 19:02:42 -0800 In-Reply-To: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20230911021637.1941096-1-stevensd@google.com> <20230911021637.1941096-7-stevensd@google.com> <14db8c0b-77de-34ec-c847-d7360025a571@collabora.com> Message-ID: Subject: Re: [PATCH v9 6/6] KVM: x86/mmu: Handle non-refcounted pages From: Sean Christopherson To: David Stevens Cc: Dmitry Osipenko , Yu Zhang , Isaku Yamahata , Zhi Wang , 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 Tue, Sep 19, 2023, David Stevens wrote: > On Mon, Sep 18, 2023 at 6:58=E2=80=AFPM Dmitry Osipenko > wrote: > > > > On 9/11/23 05:16, David Stevens wrote: > > > From: David Stevens > > > > > > Handle non-refcounted pages in __kvm_faultin_pfn. This allows the hos= t > > > to map memory into the guest that is backed by non-refcounted struct > > > pages - for example, the tail pages of higher order non-compound page= s > > > allocated by the amdgpu driver via ttm_pool_alloc_page. > > > > > > The bulk of this change is tracking the is_refcounted_page flag so th= at > > > non-refcounted pages don't trigger page_count() =3D=3D 0 warnings. Th= is is > > > done by storing the flag in an unused bit in the sptes. There are no > > > bits available in PAE SPTEs, so non-refcounted pages can only be hand= led > > > on TDP and x86-64. > > > > > > Signed-off-by: David Stevens > > > --- > > > arch/x86/kvm/mmu/mmu.c | 52 +++++++++++++++++++++++--------= -- > > > arch/x86/kvm/mmu/mmu_internal.h | 1 + > > > arch/x86/kvm/mmu/paging_tmpl.h | 8 +++-- > > > arch/x86/kvm/mmu/spte.c | 4 ++- > > > arch/x86/kvm/mmu/spte.h | 12 +++++++- > > > arch/x86/kvm/mmu/tdp_mmu.c | 22 ++++++++------ > > > include/linux/kvm_host.h | 3 ++ > > > virt/kvm/kvm_main.c | 6 ++-- > > > 8 files changed, 76 insertions(+), 32 deletions(-) > > > > Could you please tell which kernel tree you used for the base of this > > series? This patch #6 doesn't apply cleanly to stable/mainline/next/kvm > > > > error: sha1 information is lacking or useless (arch/x86/kvm/mmu/mmu.c). > > error: could not build fake ancestor >=20 > This series is based on the kvm next branch (i.e. > https://git.kernel.org/pub/scm/virt/kvm/kvm.git/log/?h=3Dnext). The > specific hash is d011151616e73de20c139580b73fa4c7042bd861. Drat, found this too late. Please use --base so that git appends the exact= base commit. From Documentation/process/maintainer-kvm-x86.rst: Git Base ~~~~~~~~ If you are using git version 2.9.0 or later (Googlers, this is all of you!)= , use ``git format-patch`` with the ``--base`` flag to automatically include = the base tree information in the generated patches. Note, ``--base=3Dauto`` works as expected if and only if a branch's upstrea= m is set to the base topic branch, e.g. it will do the wrong thing if your upstr= eam is set to your personal repository for backup purposes. An alternative "au= to" solution is to derive the names of your development branches based on their KVM x86 topic, and feed that into ``--base``. E.g. ``x86/pmu/my_branch_nam= e``, and then write a small wrapper to extract ``pmu`` from the current branch n= ame to yield ``--base=3Dx/pmu``, where ``x`` is whatever name your repository u= ses to track the KVM x86 remote.