Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3448127rdb; Wed, 13 Sep 2023 12:17:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEG3BKAgLy/44/DkkOBUlVi4i2JPOHBFC/uSV/0IEuZwfG6UBBRgpJVs1j1Yjy+9W1TUxgU X-Received: by 2002:a05:6a20:72a0:b0:135:7975:f55 with SMTP id o32-20020a056a2072a000b0013579750f55mr3861882pzk.47.1694632644874; Wed, 13 Sep 2023 12:17:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694632644; cv=none; d=google.com; s=arc-20160816; b=c6zvNviI8sMjzHw1NVlCpFNy2mgGWag+BJDmm5uSxK5I97/1DwZWld/0VqLXEdlle/ OhehCqncX0K70zhAsHNOmbfibVAmXeaaubIdgsMJ/lhByEJ2PIzk6eq5xM0zQ3DRpiK2 syBP1vzQvsLXAuXrXHE/7nm+2kxAUb6koFRnOclFnnoP0AmTEe5gmBUZVaqqsam5/raN G8fm2JYxCzXV3on5OKThRnKIhi5BaLjocqS3sMealyMPIon+KhPcdK4ylJJFtbds3YFi 6naWquBPyjIO7fFSNOHtYtatXXD68ANFz2AWimMq0qowkW7V6sXdndN6jxZxq0NqdGwh U3/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=NQKNDKp08AoVZPMqagXNpXeommr0VSae0s+lGGEOiF8=; fh=ANS6iRpdj3ntKSmwSzT4LEHUH9ZAudCj9zvP8/EeThQ=; b=AmDdYqolwoa7HzNaq+gAJbBPiS3HYwR4XF5RQs5bMWQ98GzGwYp5qRNSBpnZ1fC/qP zJRjOpwTMw2wymVqtWcbCPvUW3MGTxQD96EmZvBczyhCFxbi2d39sqKSXlCeA6HeLpIh cc7ZOQ6+1CYRhyBlGuePXyPxQNd6F9NUKdWxs2Bx0kSGR36itaVvpSry/FsCut3p9MyB 6o/TbfiY25fcwATpuLFv7dThntL2iRB+hgSP3kLB8QU2AYHC5vr9BXiZgk7rP1HlRaIQ 4mb3XGg+HK4C+cbfZ4HZED4oNov+z8GvY0BcvOLgjA9vBqTSuCmb4eJjuEIQcasocb/H R/0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=S3B5mHPM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id p5-20020a056a000b4500b0068e37bb8b68si11193692pfo.264.2023.09.13.12.17.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 12:17:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=S3B5mHPM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 410E981E021C; Wed, 13 Sep 2023 03:49:40 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239813AbjIMKtc (ORCPT + 99 others); Wed, 13 Sep 2023 06:49:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239745AbjIMKtT (ORCPT ); Wed, 13 Sep 2023 06:49:19 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BD3219AD; Wed, 13 Sep 2023 03:49:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1694602155; x=1726138155; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=vea9mvBaSY1mfkjysqPlMz9IcbWDu86rAIRw2ANf9IU=; b=S3B5mHPMRO04ej1QqK8YST3CxjOPhX/PJ+GA7bcc1SPCwSPFj51UwKIW I+0yTwV0jXkxBeSWFc3XIP00+Gz4jFkCq3dPT0a6qgc1hcexTjJwgrAVS 8NsgedDGxo89PvAaj4z+WgI7jnB1dDhLMDZlvbE7jRtavRWzgtVQDwE4R pgVK8vCM1mYnQz7R3mXOoB7VWs9gvirXjoPVH+7OjV+Zw/l1Vl3gZE7At 6T3xqm/gb6A4Re1Da0zsGv5aHRH1EjpSjVlv2powyT+MFdf91SnsWRfXX WGMTAVZ+7BI4hs4mdYXnLpirT+cYeF2LtzQuCfugs0VOpVJjAY18OToAH w==; X-IronPort-AV: E=McAfee;i="6600,9927,10831"; a="464994949" X-IronPort-AV: E=Sophos;i="6.02,143,1688454000"; d="scan'208";a="464994949" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Sep 2023 03:49:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10831"; a="737451852" X-IronPort-AV: E=Sophos;i="6.02,143,1688454000"; d="scan'208";a="737451852" Received: from ls.sc.intel.com (HELO localhost) ([172.25.112.31]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Sep 2023 03:49:07 -0700 From: isaku.yamahata@intel.com To: kvm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: isaku.yamahata@intel.com, isaku.yamahata@gmail.com, Michael Roth , Paolo Bonzini , Sean Christopherson , erdemaktas@google.com, Sagi Shahar , David Matlack , Kai Huang , Zhi Wang , chen.bo@intel.com, linux-coco@lists.linux.dev, Chao Peng , Ackerley Tng , Vishal Annapurve , Yuan Yao , Jarkko Sakkinen , Xu Yilun , Quentin Perret , wei.w.wang@intel.com, Fuad Tabba Subject: [RFC PATCH 1/6] KVM: guest_memfd: Add config to show the capability to handle error page Date: Wed, 13 Sep 2023 03:48:50 -0700 Message-Id: <56cd2f6f42351f2f27a07e5764bab7f689cc0059.1694599703.git.isaku.yamahata@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 (snail.vger.email [0.0.0.0]); Wed, 13 Sep 2023 03:49:40 -0700 (PDT) From: Isaku Yamahata Add config, HAVE_GENERIC_PRIVATE_MEM_HANDLE_ERROR, to indicate kvm arch can handle gmem error page. Signed-off-by: Isaku Yamahata --- virt/kvm/Kconfig | 3 +++ virt/kvm/guest_mem.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/virt/kvm/Kconfig b/virt/kvm/Kconfig index 1a48cb530092..624df45baff0 100644 --- a/virt/kvm/Kconfig +++ b/virt/kvm/Kconfig @@ -112,3 +112,6 @@ config KVM_GENERIC_PRIVATE_MEM select KVM_GENERIC_MEMORY_ATTRIBUTES select KVM_PRIVATE_MEM bool + +config HAVE_GENERIC_PRIVATE_MEM_HANDLE_ERROR + bool diff --git a/virt/kvm/guest_mem.c b/virt/kvm/guest_mem.c index 85903c32163f..35d8f03e7937 100644 --- a/virt/kvm/guest_mem.c +++ b/virt/kvm/guest_mem.c @@ -307,6 +307,9 @@ static int kvm_gmem_error_page(struct address_space *mapping, struct page *page) pgoff_t start, end; gfn_t gfn; + if (!IS_ENABLED(CONFIG_HAVE_GENERIC_PRIVATE_MEM_HANDLE_ERROR)) + return MF_IGNORED; + filemap_invalidate_lock_shared(mapping); start = page->index; -- 2.25.1