Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp927647ybh; Wed, 22 Jul 2020 17:32:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyw5fsqtNkPq109P9SXvUTtu/HJFo5LpSO/s1zR8md+bfUW2RjTGyejw/TawkJ4K5EHDqA1 X-Received: by 2002:a17:906:7743:: with SMTP id o3mr1971997ejn.224.1595464376512; Wed, 22 Jul 2020 17:32:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595464376; cv=none; d=google.com; s=arc-20160816; b=n+ZTIrUPz78UHEI0JGwvsyi7BD/5V2leGKDuDuil4SroaMH+3dfYHYHDMHY2Q4SVS1 cudacjfC5AXTNOPUdgCwQag397fwW1/T6VBprhrY0lRa2zWOlTyYjzyI22EuPyoEjeAq rt91zZnDFEpggikpwmfOET4RYrFLTgHNEa5Gdw7bv9mwxRn5+Q/x1UEzeSyzq3SrxLRN 9SKrOr+YiVEfrgGHAm0motqaZwtF+d53LECiuIbttKXE8L6u5yaGqjhhp7v9lYbgI45s +ReOy+N1J7P7h+oBAJmgqekKEgJDtuTY4jL2WMHaLqWV+eKih3LIH556cZidkEEm5FWj Cw3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:ironport-sdr:ironport-sdr; bh=Q96PywVqVMPttPfAPAvmTDN9540+5Khdh1GLrOEsPKU=; b=s8QV6Ks/ewLCkfaku+0cH9k4Y0MtyoGx2EuX1LB+SP7Qo8PClRLG7ZwNTd9X+lVwsa 8etg135iPBrU8Y3Wx8UElvghRhuxi0ZRW9g87+i6QxtJriEEwH4lGvv1H3ExW9m2BFhM o+GpSA/pPcHgBJguId2XIRBYdLe9J8DgcJopgF/4Mmy0q4Dn5SGQ1nOOI9FLGWdQF+Nm TB6kLY54EPHO/7wzcHy+jzukvu7eRDZ5snNgE8hPwsXNDc510khAi817EMBUGZBO+5Hm /NzAI9XJy9+CmlXg8v0il8H8+l3iEsZWA/95hS/ZeuBgFJHMisYheoL/deGOgaMBELhZ 3MpA== 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 co19si903332edb.605.2020.07.22.17.32.33; Wed, 22 Jul 2020 17:32:56 -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 S1733232AbgGWA3l (ORCPT + 99 others); Wed, 22 Jul 2020 20:29:41 -0400 Received: from mga14.intel.com ([192.55.52.115]:28662 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729486AbgGWA3l (ORCPT ); Wed, 22 Jul 2020 20:29:41 -0400 IronPort-SDR: mQzAGlKCCuvKcm4vAyXPHgq61e5tIOzTfGMyNmsPqwwgsRMmSGoFu7ZpuarhEF5VrPewKV7ZgA TM5uLyLhpiRA== X-IronPort-AV: E=McAfee;i="6000,8403,9690"; a="149620646" X-IronPort-AV: E=Sophos;i="5.75,383,1589266800"; d="scan'208";a="149620646" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jul 2020 17:29:41 -0700 IronPort-SDR: dnI/EJGSOOebbW4BpM3U1cRyeFIY8G0LSZwYJ1J3OzLS4f724Ci4kCG0joZmj1jMOMpTa0xWBh 8p9rhiNwK9Cw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,383,1589266800"; d="scan'208";a="288464413" Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.152]) by orsmga006.jf.intel.com with ESMTP; 22 Jul 2020 17:29:40 -0700 Date: Wed, 22 Jul 2020 17:29:40 -0700 From: Sean Christopherson To: Peter Xu Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, "Dr . David Alan Gilbert" , Andrew Jones , Paolo Bonzini Subject: Re: [PATCH v11 02/13] KVM: X86: Don't track dirty for KVM_SET_[TSS_ADDR|IDENTITY_MAP_ADDR] Message-ID: <20200723002940.GO9114@linux.intel.com> References: <20200708193408.242909-1-peterx@redhat.com> <20200708193408.242909-3-peterx@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200708193408.242909-3-peterx@redhat.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 08, 2020 at 03:33:57PM -0400, Peter Xu wrote: > Originally, we have three code paths that can dirty a page without > vcpu context for X86: > > - init_rmode_identity_map > - init_rmode_tss > - kvmgt_rw_gpa > > init_rmode_identity_map and init_rmode_tss will be setup on > destination VM no matter what (and the guest cannot even see them), so > it does not make sense to track them at all. > > To do this, allow __x86_set_memory_region() to return the userspace > address that just allocated to the caller. Then in both of the > functions we directly write to the userspace address instead of > calling kvm_write_*() APIs. > > Another trivial change is that we don't need to explicitly clear the > identity page table root in init_rmode_identity_map() because no > matter what we'll write to the whole page with 4M huge page entries. > > Suggested-by: Paolo Bonzini > Signed-off-by: Peter Xu > --- Reviewed-by: Sean Christopherson