Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp6878851yba; Tue, 14 May 2019 15:39:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqzDFLVkUHwHQzt2bn0Vmbqi2laCvaKCxewCCjX16Bx7GsqC/TISgxIi0ldDHOLCBkJFwZd+ X-Received: by 2002:a17:902:a405:: with SMTP id p5mr35428191plq.51.1557873595756; Tue, 14 May 2019 15:39:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557873595; cv=none; d=google.com; s=arc-20160816; b=gnSftXxnZN+u4h5amPu3n5tYBqoql44NTXOO9uDdPHT1BPR+NMX3Yh2gseILYsfYkq oQ2001oFMv0oOPjZhUPlOK6yT3ZGeYInjvUWNBd0k8rkk+0pHuWfa7ueQmWwNXn7FgC7 yBpvsEkXCmXio3O0CgQxuW5YSIOjHgWod9wyZMrHfmJ9Q7n1ZuxxyU5dupz9J1b3K1hR d3Aksn5Ux4Rnq6d1WmYFnzGOtp0zyhAU4p8UdPnMeZv3SO5C2bE9WLRzw99MH5wPSaIq +ovQcePhovRTrtM07Sfls8llNQ03sDPyRxG9qot06ar9DI8g1EWjAW+syE4iikxC/tvN jFSw== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=OuZ44tiUYD+isdZPI9iQkb7rmvzNlz1oSQ2UPWd5EYQ=; b=r0zWfd+jczvJbFvocPAn0+M/Fe72uBi7qbv8JwKMG4aMQ2KibRqmjabxgpIkhEx/ez qyQA3wR5AECgtgN+EdLKEKl9AsWpQjW3r/EqZSOhWJ+AqwBbVbmx2CKu6qNt/u+XMpn/ ox/9MmPdSY/p7nO01KNNU+JQoKn+EvQZc4blJc7GDJWgNq8M0V6gUcUA6i8w/5PI8MeP FNry4E/Q9XS0gWJILahDi1L94zAxQ4CeHwYL28vKKFFmgSVCEfJvAb/ljedXrBRRKoVe ju7V/gyMyou8V/XNneS3ziRMOXXlsCtH80WnGZWuQ1Agw00JTvxGSdcC+YHWWFiI+xe7 LkUA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id x2si39157pln.355.2019.05.14.15.39.38; Tue, 14 May 2019 15:39:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1726302AbfENWi0 (ORCPT + 99 others); Tue, 14 May 2019 18:38:26 -0400 Received: from mga18.intel.com ([134.134.136.126]:22218 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726148AbfENWiZ (ORCPT ); Tue, 14 May 2019 18:38:25 -0400 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 May 2019 15:38:24 -0700 X-ExtLoop1: 1 Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.36]) by FMSMGA003.fm.intel.com with ESMTP; 14 May 2019 15:38:23 -0700 Date: Tue, 14 May 2019 15:38:23 -0700 From: Sean Christopherson To: Andy Lutomirski Cc: Andy Lutomirski , Peter Zijlstra , Alexandre Chartre , Paolo Bonzini , Radim Krcmar , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Dave Hansen , kvm list , X86 ML , Linux-MM , LKML , Konrad Rzeszutek Wilk , jan.setjeeilers@oracle.com, Liran Alon , Jonathan Adams Subject: Re: [RFC KVM 18/27] kvm/isolation: function to copy page table entries for percpu buffer Message-ID: <20190514223823.GE1977@linux.intel.com> References: <4e7d52d7-d4d2-3008-b967-c40676ed15d2@oracle.com> <20190514170522.GW2623@hirez.programming.kicks-ass.net> <20190514180936.GA1977@linux.intel.com> <20190514210603.GD1977@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: 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 Tue, May 14, 2019 at 02:55:18PM -0700, Andy Lutomirski wrote: > > > On May 14, 2019, at 2:06 PM, Sean Christopherson wrote: > > > >> On Tue, May 14, 2019 at 01:33:21PM -0700, Andy Lutomirski wrote: > >> I suspect that the context switch is a bit of a red herring. A > >> PCID-don't-flush CR3 write is IIRC under 300 cycles. Sure, it's slow, > >> but it's probably minor compared to the full cost of the vm exit. The > >> pain point is kicking the sibling thread. > > > > Speaking of PCIDs, a separate mm for KVM would mean consuming another > > ASID, which isn't good. > > I’m not sure we care. We have many logical address spaces (two per mm plus a > few more). We have 4096 PCIDs, but we only use ten or so. And we have some > undocumented number of *physical* ASIDs with some undocumented mechanism by > which PCID maps to a physical ASID. Yeah, I was referring to physical ASIDs. > I don’t suppose you know how many physical ASIDs we have? Limited number of physical ASIDs. I'll leave it at that so as not to disclose something I shouldn't. > And how it interacts with the VPID stuff? VPID and PCID get factored into the final ASID, i.e. changing either one results in a new ASID. The SDM's oblique way of saying that: VPIDs and PCIDs (see Section 4.10.1) can be used concurrently. When this is done, the processor associates cached information with both a VPID and a PCID. Such information is used only if the current VPID and PCID both match those associated with the cached information. E.g. enabling PTI in both the host and guest consumes four ASIDs just to run a single task in the guest: - VPID=0, PCID=kernel - VPID=0, PCID=user - VPID=1, PCID=kernel - VPID=1, PCID=user The impact of consuming another ASID for KVM would likely depend on both the guest and host configurations/worloads, e.g. if the guest is using a lot of PCIDs then it's probably a moot point. It's something to keep in mind though if we go down this path.