Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp5361868pxu; Wed, 21 Oct 2020 23:24:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzkh1rcAmX2qgIFUg+mXEUbuV/sXjE7Ek9t0xNmiIqIknJRnjxQNJ4iGbsnRhEFATsbA3QV X-Received: by 2002:a05:6402:128c:: with SMTP id w12mr850610edv.242.1603347859386; Wed, 21 Oct 2020 23:24:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603347859; cv=none; d=google.com; s=arc-20160816; b=BT3+Otv+baky0fFQSpphCrzWbnpbtID8q86KQ3NUvZQ56gyeMiaQJ7D8JnwKKkhH1S 6ea6RUDbvK21IxPP272pyYm3WlaUflxEanWJ6DAdrlYQWmwtVY6J71cyWODBJ/4GghZ+ sKQLNaceSBtBSYxk9kaMssn5T2ATyp5LB7GueGBcpiDvAb93Z6N4dSpigEOKmQSY2QcT qCz7YfPpZ2ROdhohgNrLJQAHSSHiBfX9PlldWeJoQMP/ECoM/ukgC5pmaAcNR0atpm/K lC0a6FmTcZ1+LvGbqlkUTVT7mH2pbucehs//TnzUr+4pwnHiVyG8xfXbyX61agfvQYMu mLKw== 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 :ironport-sdr:ironport-sdr; bh=FZyDj1zPBN8Wn9cxi7TqtG1NZ6rokAeUYwFmiWkHZag=; b=PuXP4Tja39pOSXtIHYITrnNx8ukkI2Vh8hURlyKxPucOLw2SBWDdE4kLw1FKBIq96b ivoQP39lgOpk/8EU0WBWI8c6ih1cPPoYxTpwrbK0MVfCr/lZu7z7PDlkI7GxTjIiPRXS oHNUT7YazBqi7mG5hxRnHXAHY5yCRVRgMEGvyNGAGkbzfY73utfdxcv9R8AH/qv6uOY/ JG6CT/+19/2oLBvynYzA3WSbRFZVDF9fp6QJ0pyMw7qHAHdbiNEtr/JsG4zj23syzg1L OO4O9hb1Y5RNN/x0TKnhk+hIetVecMBOs+TQuWTec1KONx8h8LdT6xdapuAZ0N42AMD5 mdkw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dr19si291413ejc.46.2020.10.21.23.23.56; Wed, 21 Oct 2020 23:24:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2503581AbgJURfn (ORCPT + 99 others); Wed, 21 Oct 2020 13:35:43 -0400 Received: from mga07.intel.com ([134.134.136.100]:45514 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404404AbgJURfn (ORCPT ); Wed, 21 Oct 2020 13:35:43 -0400 IronPort-SDR: AxG3/eHShXPgTBg2Rtf76wvoz1tPSIaTZ5Jzu9m4zgoB62N0jMF5bz0/JDVx9lgdLHv0lL7oor Je1o248AFAOw== X-IronPort-AV: E=McAfee;i="6000,8403,9780"; a="231600581" X-IronPort-AV: E=Sophos;i="5.77,401,1596524400"; d="scan'208";a="231600581" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2020 10:35:41 -0700 IronPort-SDR: hKulPrEKiCQDbWyW9R5N7rd6q/Vd/eQmRl2nDwht2xpE4sS245MllNRSZczMsbTOnMBWg/Ad+Z Y8wj3J0SfIRA== X-IronPort-AV: E=Sophos;i="5.77,401,1596524400"; d="scan'208";a="533619910" Received: from zhangyu-optiplex-9020.bj.intel.com (HELO localhost) ([10.238.135.148]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-SHA256; 21 Oct 2020 10:35:37 -0700 Date: Thu, 22 Oct 2020 01:24:09 +0800 From: Yu Zhang To: Paolo Bonzini Cc: Ben Gardon , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Cannon Matthews , Peter Xu , Sean Christopherson , Peter Shier , Peter Feiner , Junaid Shahid , Jim Mattson , Yulei Zhang , Wanpeng Li , Vitaly Kuznetsov , Xiao Guangrong Subject: Re: [PATCH v2 07/20] kvm: x86/mmu: Support zapping SPTEs in the TDP MMU Message-ID: <20201021172409.aids3y2mlyx776lx@linux.intel.com> References: <20201014182700.2888246-1-bgardon@google.com> <20201014182700.2888246-8-bgardon@google.com> <20201021150225.2eeriqlffqnsm4b3@linux.intel.com> <6985f630-3b2a-75f5-5b55-bd76cf32f20b@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6985f630-3b2a-75f5-5b55-bd76cf32f20b@redhat.com> User-Agent: NeoMutt/20180622-66-b94505 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 21, 2020 at 07:20:15PM +0200, Paolo Bonzini wrote: > On 21/10/20 17:02, Yu Zhang wrote: > >> void kvm_tdp_mmu_free_root(struct kvm *kvm, struct kvm_mmu_page *root) > >> { > >> + gfn_t max_gfn = 1ULL << (boot_cpu_data.x86_phys_bits - PAGE_SHIFT); > >> + > > boot_cpu_data.x86_phys_bits is the host address width. Value of the guest's > > may vary. So maybe we should just traverse the memslots and zap the gfn ranges > > in each of them? > > > > It must be smaller than the host value for two-dimensional paging, though. Yes. And using boot_cpu_data.x86_phys_bits works, but won't it be somewhat overkilling? E.g. for a host with 46 bits and a guest with 39 bits width? Any concern for doing the zap by going through the memslots? Thanks. :) B.R. Yu > > Paolo >