Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp3553914rwd; Fri, 16 Jun 2023 20:53:03 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ45/TPaR6Biu73Eox7ys9KwlX3XEZeZ3N/Ow2gwhKXirocobrmHdPhVFUzPiTU1bcx4UHdZ X-Received: by 2002:a05:6870:e742:b0:18e:2b7e:a844 with SMTP id t2-20020a056870e74200b0018e2b7ea844mr1077254oak.21.1686973983618; Fri, 16 Jun 2023 20:53:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686973983; cv=none; d=google.com; s=arc-20160816; b=mvVK3yeNK7BujUniNK8dWHZtwMnAK7zVCkaVyOiQaYyFOzOQtQDqA7GXTTfSD9+Kcf IViQMleRlGKWSJ4DNgTPpVRs7/PtAmSJzLvzNVIebagNceqagfOdFj4R4goQP+9qAwhR XwbY6NNKJ/V4HZ+4c/PBzNuEqMKHjURDLwCVanMeqhdE9v6t6u9I+yuHd0jgufKVssm6 3CuQSFEr8Hii48i51/mZvrpA6luMjsLhkShPMHIwDfZGrCyQI8lNED4Gf7uIiJHsRHPu gl/xeh6sQPNDkgX0kiMthZvUovLzy83T/9tMlz+KXbB3Uqv7+CcwZeRAqQlCXGhz57fw SZ2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=7pN0j9m709oLsGlG8AcwPmKTb85VbW7tXOBlcfGp2+w=; b=LOwHg+YMa5rp8X1ATSfNSRQhlCEfd8Z0DgGqlMrzrT8kqj5FlE8XN7GA1M6gpILANK cJ7kbyiXox8/7n3FdFTns8wnP0n3J2vHFMYrITcX+3zXBkPFt9zGIkdl1b20M2hO9B/V nA9I6Dde1M597J1Ut2zwK610GrTXev+u/M/dBBJZmUcCWJhKMVoczevs6HqTEP4Wnol2 C/joJF4r/xg5lFoXnfOxBwEPENt0T0CCjvkE6U1VTzdPSfF4FchqJnoiSBnASUqUXgkW /+TlhGBF6AomlQ6kk3cUEzAih9pUdqkSReveDpwhEcrfqsp70PiSDMTFoapY2Cewu0xW 3ptg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=jMVQe3B2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s70-20020a632c49000000b0053f2551834fsi16554505pgs.552.2023.06.16.20.52.47; Fri, 16 Jun 2023 20:53:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=jMVQe3B2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231982AbjFQDpL (ORCPT + 99 others); Fri, 16 Jun 2023 23:45:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229683AbjFQDpI (ORCPT ); Fri, 16 Jun 2023 23:45:08 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CED5730F8; Fri, 16 Jun 2023 20:45:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686973507; x=1718509507; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=XwjZf4OZ6eYrcFkxkPDYjloZyHMyc8e9inqGFlKDqN8=; b=jMVQe3B2PVUh4QwxC7xGJw4RW8xMazNpyMyqOI47XV5ceOg9ZqT8745b QggThgQXei22q+zyupEqzzHJciZWIq+3W+1bVmhKF8ZB1B2OtR+sQpFGi huddxpenz1Z59vVBYQgM+tBSk5Ly7WUlPDZCKg7+6HiQazKadnlqEPUSA 9Vsdwc8r89tBBlKanKMKNeloLzvgzCijN7BJre4PHnYSeYvfqkjOzyoST EVO/pVmDk0obN2hkr33DmYEm+cyX8gJLpfgo3VIbBNgDz5bSAwGwg+sL8 sGUtpshWwH4+wFfkrT6bdy/OONCfutIZ0IE13maptyRSA+3mcB3vSM8Db Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10743"; a="445738601" X-IronPort-AV: E=Sophos;i="6.00,249,1681196400"; d="scan'208";a="445738601" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2023 20:45:06 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10743"; a="746596944" X-IronPort-AV: E=Sophos;i="6.00,249,1681196400"; d="scan'208";a="746596944" Received: from jye19-mobl.ccr.corp.intel.com (HELO localhost) ([10.255.28.32]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2023 20:45:02 -0700 Date: Sat, 17 Jun 2023 11:45:00 +0800 From: Yu Zhang To: Sean Christopherson Cc: Paolo Bonzini , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Jason Gunthorpe , Alistair Popple , Robin Murphy Subject: Re: [PATCH 1/3] KVM: VMX: Retry APIC-access page reload if invalidation is in-progress Message-ID: <20230617034500.djk5nhmpxony3ngp@linux.intel.com> References: <20230602011518.787006-1-seanjc@google.com> <20230602011518.787006-2-seanjc@google.com> <20230607073728.vggwcoylibj3cp6s@linux.intel.com> <20230607172243.c2bkw43hcet4sfnb@linux.intel.com> <20230608070016.f3dz6dhvdkxsomdb@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20171215 X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > > and the backing page is being reclaimed in L0? I saw > > nested_get_vmcs12_pages() will check vmcs12 and set the APIC access address > > in VMCS02, but not sure if this routine will be triggered by the mmu > > notifier... > > Pages from vmcs12 that are referenced by physical address in the VMCS are pinned > (where "pinned" means KVM holds a reference to the page) by kvm_vcpu_map(). I.e. > the page will not be migrated, and if userspace unmaps the page, userspace might > break its VM, but that's true for any guest memory that userspace unexpectedly > unmaps, and there won't be any no use-after-free issues. > Thanks, Sean. About the kvm_vcpu_map(), is it necessary for APIC access address? L0 only needs to get its pfn, and does not care about the hva or struct page. Could we just use gfn_to_pfn() to retrieve the pfn, and kvm_release_pfn_clean() to unpin it later? B.R. Yu