Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp432435rdb; Mon, 18 Sep 2023 22:36:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFR4hMr9uhSbe8jApVpCDOiOiLifzCdi40PW2rSgtAL8Xbjk1HMxRHDSDPZx/Cv5TZgfkem X-Received: by 2002:a05:6358:63a2:b0:134:d030:e5da with SMTP id k34-20020a05635863a200b00134d030e5damr8816657rwh.21.1695101780355; Mon, 18 Sep 2023 22:36:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695101780; cv=none; d=google.com; s=arc-20160816; b=Ulzf6QmDgErJO+qzXOe2XyK9XWdg7RbxpONJ9E3Ynhl4joTNiywwzUFjaH5k/eUu+h 8dGs6GEEhR8gzPtHiltFR2B1xjgG0u+G9obFEdQgFXFRgH9E5jt39bmj5F06qdzpNTuY T/TEkcd9qrc1UUGPUPxuLO8HICMqJKP8hzLWQPfrP1XGNn8BoB+6p/u0EkHHUgGmHW7/ PXTsuvMDwcqv99wfIEON6cM8POlW/JE/ZRTikr+vQIw8l2xj+E5o3isqQ/xof2NXnONu tWlM8hebGm/CiAx99Wm2IAywgp/EIbgntUyQG+Sg3MJPY+kl3jdZlWWWDS889RlkqpKA qjlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=N5MbU8VIeu5EiJtwca5r7fWgQWeL6jFIFNv2pIv6XV0=; fh=rxZUeW+o/FY+GM8sVnNR9LMRWbLoyNbM0v5bNG05EMs=; b=MoqGrvelokeeATZV7CenDk7YnWnYDeiE1H2zG6RQY+aI8lYamP9eh2qaUa6e2pmZ4V qRw5Xg69ZEW3xqaPyY/8kg3ncPn3JrO33RDGIQo5xcJxdjLxIzcThwLaX6xkpVLHNPsI VaHhHpSS+XHpDNx195NlJzvWwiLvnth19dN2apw5XR8GDmoA7rfk396qveq9qTRGtckK bAVOHa67tWL2Ft9AH6NLaQ8TCaOXLt+uIs2aVhMwIJeo7oyRT5ausHPUlKjrlf2OR+Jv OUYOA7wkYiP9AVpYxeUA4D27blhh/syaJqvewjQA5HmtpthvQbmZ8k9xu9UDILrXz6Ko Qr3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=oYUQdMc9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id k62-20020a636f41000000b005653283b8a4si8927094pgc.785.2023.09.18.22.36.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Sep 2023 22:36:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=oYUQdMc9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 0A0C480689FD; Mon, 18 Sep 2023 19:32:04 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231140AbjISCbm (ORCPT + 99 others); Mon, 18 Sep 2023 22:31:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230459AbjISCbl (ORCPT ); Mon, 18 Sep 2023 22:31:41 -0400 Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5025B120 for ; Mon, 18 Sep 2023 19:31:34 -0700 (PDT) Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-50308217223so3764986e87.3 for ; Mon, 18 Sep 2023 19:31:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1695090692; x=1695695492; 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=N5MbU8VIeu5EiJtwca5r7fWgQWeL6jFIFNv2pIv6XV0=; b=oYUQdMc9QxIwjQMWSfwWzOZKxwMLFsUwarCh99YSi6ih2vmlqAkMRkDQ+yloRfk/Ub zz2nHhfv+JpL+0AZERQsER+AEpIa+LBXkNlyRiqm8TNdT1ZybYUHuv/NX1yHermWKLUr Ph/SSFh8pN/JNw0jdhSResa3YOAR0bmmB4Iic= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695090692; x=1695695492; 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=N5MbU8VIeu5EiJtwca5r7fWgQWeL6jFIFNv2pIv6XV0=; b=TwcHQIV8mm+ZXr168IWoYXrc7MxHBERBMlVcmCRJqEV0Z19V+lRq7gRrf5e3Hzy4Zj GAx6tIUhyEKqQgSyUz+4ThczMGy9gYXspkUo5brnqCwj7VjM/j5pzb8Y8nnnUrzO6foW c5iOV+bkelBeFXhCH1e53ZlknoGJh+HDXiIWFV/2IK67i7J7m2YPc0eL/A1totonuhRk aQhlcS6CZMbwfNqIHGo9Oqphy2DHRZiVE+E8G2/6zBLCV/OtqWyV1nkGRYBev8gIGwhc Cj87Xrw4Z+A/6Rtxkli+uStfceID3x1JFS4vudGJh4zMybffV+X6FJ1ddhViLaakAOCE 3SIQ== X-Gm-Message-State: AOJu0YxDsXammaspJRnyjun9A1wTgm97IP8hiigu5OeCUu2p3RO9XIWZ Wjx/aAJU1LZiE5/Nv0Mtvx4eiHEy++6B2lTzRiOwSg== X-Received: by 2002:a05:6512:1319:b0:503:2deb:bbc1 with SMTP id x25-20020a056512131900b005032debbbc1mr839997lfu.22.1695090691893; Mon, 18 Sep 2023 19:31:31 -0700 (PDT) MIME-Version: 1.0 References: <20230911021637.1941096-1-stevensd@google.com> <20230911021637.1941096-7-stevensd@google.com> <14db8c0b-77de-34ec-c847-d7360025a571@collabora.com> In-Reply-To: <14db8c0b-77de-34ec-c847-d7360025a571@collabora.com> From: David Stevens Date: Tue, 19 Sep 2023 11:31:20 +0900 Message-ID: Subject: Re: [PATCH v9 6/6] KVM: x86/mmu: Handle non-refcounted pages To: Dmitry Osipenko Cc: Sean Christopherson , 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 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Mon, 18 Sep 2023 19:32:04 -0700 (PDT) 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 host > > to map memory into the guest that is backed by non-refcounted struct > > pages - for example, the tail pages of higher order non-compound pages > > allocated by the amdgpu driver via ttm_pool_alloc_page. > > > > The bulk of this change is tracking the is_refcounted_page flag so that > > non-refcounted pages don't trigger page_count() =3D=3D 0 warnings. This= 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 handle= d > > 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 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. -David