From patchwork Tue Aug 21 11:28:11 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nikunj A. Dadhania" X-Patchwork-Id: 1354371 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 3E65840210 for ; Tue, 21 Aug 2012 11:28:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752897Ab2HUL2z (ORCPT ); Tue, 21 Aug 2012 07:28:55 -0400 Received: from e28smtp06.in.ibm.com ([122.248.162.6]:46474 "EHLO e28smtp06.in.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752375Ab2HUL2x (ORCPT ); Tue, 21 Aug 2012 07:28:53 -0400 Received: from /spool/local by e28smtp06.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 21 Aug 2012 16:58:51 +0530 Received: from d28relay04.in.ibm.com (9.184.220.61) by e28smtp06.in.ibm.com (192.168.1.136) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 21 Aug 2012 16:58:49 +0530 Received: from d28av01.in.ibm.com (d28av01.in.ibm.com [9.184.220.63]) by d28relay04.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q7LBSlOd17563782 for ; Tue, 21 Aug 2012 16:58:47 +0530 Received: from d28av01.in.ibm.com (loopback [127.0.0.1]) by d28av01.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q7LGwKjP030145 for ; Tue, 21 Aug 2012 22:28:21 +0530 Received: from [9.124.35.230] (abhimanyu.in.ibm.com [9.124.35.230] (may be forged)) by d28av01.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q7LGwKWR030110; Tue, 21 Aug 2012 22:28:20 +0530 Subject: [PATCH v4 8/8] KVM-doc: Add paravirt tlb flush document To: mtosatti@redhat.com, avi@redhat.com From: "Nikunj A. Dadhania" Cc: raghukt@linux.vnet.ibm.com, alex.shi@intel.com, kvm@vger.kernel.org, stefano.stabellini@eu.citrix.com, peterz@infradead.org, hpa@zytor.com, vsrivatsa@gmail.com, mingo@elte.hu Date: Tue, 21 Aug 2012 16:58:11 +0530 Message-ID: <20120821112804.3512.7480.stgit@abhimanyu> In-Reply-To: <20120821112346.3512.99814.stgit@abhimanyu.in.ibm.com> References: <20120821112346.3512.99814.stgit@abhimanyu.in.ibm.com> User-Agent: StGit/0.16-2-g0d85 MIME-Version: 1.0 x-cbid: 12082111-9574-0000-0000-0000041215D9 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Signed-off-by: Nikunj A. Dadhania --- Documentation/virtual/kvm/msr.txt | 4 ++ Documentation/virtual/kvm/paravirt-tlb-flush.txt | 53 ++++++++++++++++++++++ 2 files changed, 57 insertions(+), 0 deletions(-) create mode 100644 Documentation/virtual/kvm/paravirt-tlb-flush.txt -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/Documentation/virtual/kvm/msr.txt b/Documentation/virtual/kvm/msr.txt index 7304710..92a6af6 100644 --- a/Documentation/virtual/kvm/msr.txt +++ b/Documentation/virtual/kvm/msr.txt @@ -256,3 +256,7 @@ MSR_KVM_EOI_EN: 0x4b564d04 guest must both read the least significant bit in the memory area and clear it using a single CPU instruction, such as test and clear, or compare and exchange. + +MSR_KVM_VCPU_STATE: 0x4b564d05 + +Refer: Documentation/virtual/kvm/paravirt-tlb-flush.txt diff --git a/Documentation/virtual/kvm/paravirt-tlb-flush.txt b/Documentation/virtual/kvm/paravirt-tlb-flush.txt new file mode 100644 index 0000000..0eaabd7 --- /dev/null +++ b/Documentation/virtual/kvm/paravirt-tlb-flush.txt @@ -0,0 +1,53 @@ +KVM - Paravirt TLB Flush +Nikunj A Dadhania , IBM, 2012 +======================================================== + +Remote flushing api's does a busy wait which is fine in bare-metal +scenario. But with-in the guest, the vcpus might have been pre-empted +or blocked. In this scenario, the initator vcpu would end up +busy-waiting for a long amount of time. + +This would require to have information of guest running/not-running +within the guest to take a decision. The following MSR introduces vcpu +running state information. + +Using this MSR we have implemented para-virt flush tlbs making sure +that it does not wait for vcpus that are not-running. And TLB flushing +for them is deferred, which is done on guest enter. + +MSR_KVM_VCPU_STATE: 0x4b564d04 + + data: 64-byte alignment physical address of a memory area which must be + in guest RAM, plus an enable bit in bit 0. This memory is expected to + hold a copy of the following structure: + + struct kvm_steal_time { + __u64 state; + __u32 pad[14]; + } + + whose data will be filled in by the hypervisor/guest. Only one + write, or registration, is needed for each VCPU. The interval + between updates of this structure is arbitrary and + implementation-dependent. The hypervisor may update this + structure at any time it sees fit until anything with bit0 == + 0 is written to it. Guest is required to make sure this + structure is initialized to zero. + + This would enable a VCPU to know running status of sibling + VCPUs. The information can further be used to determine if an + IPI needs to be send to the non-running VCPU and wait for them + unnecessarily. For e.g. flush_tlb_others_ipi. + + Fields have the following meanings: + + state: has bit following fields: + + Bit 0 - vcpu running state. Hypervisor would set vcpu + running/not running. Value 1 meaning the vcpu + is running and value 0 means vcpu is + pre-empted out. + + Bit 1 - hypervisor should flush tlb is set during + guest enter/exit +