Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3981384rdb; Thu, 14 Sep 2023 08:22:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHwlYcU5eCtkQxg63V3mTi9VjGUGC6+SGlqvmJCkYi49yf/4+3kfS1FPpe3TjqaL2VRnIY5 X-Received: by 2002:a05:6a20:a11c:b0:135:38b5:7e4e with SMTP id q28-20020a056a20a11c00b0013538b57e4emr6490228pzk.59.1694704973715; Thu, 14 Sep 2023 08:22:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694704973; cv=none; d=google.com; s=arc-20160816; b=saOR7xvHyp44UaNq5BuyN+PFbt+dEr7akra7gWl9ltZZBG5ildQ+XlHINNoDa3iPXI FYERlCX0nABwtcoWWp84+gRe9UFMDCXjPMLfzjta5VUgjyKEKONf1E/X8iTN45+23C8D BG2e+bBI1G5k2Xu4d9+mErgGCwq83FNiQJ/Vw1QiLVS41Uhgomy4qQtUwN0yx4vuCF+t ik50jBafFSW3r3pjevy5tYMrXcore9/M2r1ohxLsXEn0az3KEHrh+APKVHphd6wDLtRa aGo9H8/NbA7V+dksm2KX7C4uRhv59I4osCYbRG8s6Yuu5O6xRIrWJ0tEObJJi9+NEUh3 SDfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:dkim-signature; bh=4JiE4DdxUMHfTS70Z4Y1GxX9A0Rg/BgOzVpxxMDofuU=; fh=4zSMCzNb7rJrUGZtbNPceVM+tszI9ngqwF5WBZpI8NM=; b=EAiv80jPubtNTkTsH2ULPGu3D8PU/jndy6xMAeVhGWPMz2uTGoOYPvHyNiB4JifmoJ KWOe+vMg5PlMiJrOwZxDNxZPnxYXKa9gJds8y9ja/FpDMaF7nzjSFgkkiyI8SDLCI5qs GLg7Qv3/gEFoOdo/zAH4X7fkkHhZA9Br8VeTAmNY/RMotax2UIPbwkYzyi24r31cwO6v JKdJcrbMb8YcWI8c2QL8P2xteTm485hveJTKgC8GAEY2PxVPLX0KeiY8ky4H1AxzvV+I 3N4SiGwX88I4d7jpW+twcFXswKSD6LzbMwdulTP+uBbZWKLcWTe6jdtf8F2Ilo1CNbv5 WQtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=d5lG24bi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id g193-20020a636bca000000b00573e90d8bf0si1675927pgc.184.2023.09.14.08.22.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 08:22:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=d5lG24bi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 00D02815B11E; Wed, 13 Sep 2023 09:16:41 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229690AbjIMQQX (ORCPT + 99 others); Wed, 13 Sep 2023 12:16:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230231AbjIMQQR (ORCPT ); Wed, 13 Sep 2023 12:16:17 -0400 Received: from mail-yw1-x1149.google.com (mail-yw1-x1149.google.com [IPv6:2607:f8b0:4864:20::1149]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B700FB3 for ; Wed, 13 Sep 2023 09:16:13 -0700 (PDT) Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-58fc4291239so23247b3.0 for ; Wed, 13 Sep 2023 09:16:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1694621773; x=1695226573; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=4JiE4DdxUMHfTS70Z4Y1GxX9A0Rg/BgOzVpxxMDofuU=; b=d5lG24biiIxs2IX1D6Eb6aMsY6oZ5Ztz3fYvlSNYYKUXz+ljPtrdPKx1TCuu8Alu0z /OrmlbfOQn2BailNLtXXvuuR5Hkc5+ydkv/wMJl35PktEUnlGuh8CGzMryhvKCrcQuJF O1BUm3tN8b+KC4m1g0du+ZhfPQNaL/K93iAWKbWCJym1Pgmqx3GXwGQhPPb/sUyMJAKy UQmTb4cIj65UZvLGrIKxmvfFlW+x8tU5tdJpxgl14y6piBP3kSHqq0cRcrG36RaJO8fK AmpeqNIWU3XYOyB44D8bt5ioxJjPQtYSHpASnIh+WYXrKRo7b9qqK+K4lC8w/55V14+m z1Qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694621773; x=1695226573; h=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=4JiE4DdxUMHfTS70Z4Y1GxX9A0Rg/BgOzVpxxMDofuU=; b=jW66HclLaq76aQDyNvtUGDP21efetpQ0cg3fJ7Ufc6JsRaCpt8shwOASkwZpB2lre8 BjgT6fFfCaiOEp7zD27X5CREMIjTsRta2r1IXiGD+nxFxdtwyXZWqOwV3aNMEkYX3TaC WuQ0AcEsyQpt4oZwbZhju5+T52in/R6FDKqXnC/O+67OYGSPgY0X/jlFQdTPdFZYWy+b M3Gg1Uwni9XvfdueJGSA80s6S86OcJkjWBWqM8huZi1vbgW3O9/wdKcw0d5oiPpuIHsi TZeZP4NWAzAkJhjKkpqm1t1woNhgZsdVLCJ0nSN4xi885Kgr600/i7u7PEkzW5rY3ocX ba4w== X-Gm-Message-State: AOJu0YwchSOV0Rq59RnAMjX2unvAoa+odHgTA7cqKgP0VCQjj0XUAzQg ojNpbFzx/BDmmLMZO0CQvmcMRGw5Rl4= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a81:b71e:0:b0:583:4f82:b9d9 with SMTP id v30-20020a81b71e000000b005834f82b9d9mr84623ywh.5.1694621772950; Wed, 13 Sep 2023 09:16:12 -0700 (PDT) Date: Wed, 13 Sep 2023 09:16:11 -0700 In-Reply-To: <56cd2f6f42351f2f27a07e5764bab7f689cc0059.1694599703.git.isaku.yamahata@intel.com> Mime-Version: 1.0 References: <56cd2f6f42351f2f27a07e5764bab7f689cc0059.1694599703.git.isaku.yamahata@intel.com> Message-ID: Subject: Re: [RFC PATCH 1/6] KVM: guest_memfd: Add config to show the capability to handle error page From: Sean Christopherson To: isaku.yamahata@intel.com Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, isaku.yamahata@gmail.com, Michael Roth , Paolo Bonzini , 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 Content-Type: text/plain; charset="us-ascii" 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 (fry.vger.email [0.0.0.0]); Wed, 13 Sep 2023 09:16:41 -0700 (PDT) X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email On Wed, Sep 13, 2023, isaku.yamahata@intel.com wrote: > 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; I don't see the point, KVM can and should always zap SPTEs, i.e. can force the geust to re-fault on the affected memory. At that point kvm_gmem_get_pfn() will return -EHWPOISON and architectures that don't support graceful recovery can simply terminate the VM.