From patchwork Tue Jul 31 10:49:30 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: 1259061 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 3847CDF26F for ; Tue, 31 Jul 2012 10:50:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755863Ab2GaKuQ (ORCPT ); Tue, 31 Jul 2012 06:50:16 -0400 Received: from e28smtp06.in.ibm.com ([122.248.162.6]:39018 "EHLO e28smtp06.in.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755612Ab2GaKuP (ORCPT ); Tue, 31 Jul 2012 06:50:15 -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, 31 Jul 2012 16:20:13 +0530 Received: from d28relay02.in.ibm.com (9.184.220.59) by e28smtp06.in.ibm.com (192.168.1.136) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 31 Jul 2012 16:20:11 +0530 Received: from d28av01.in.ibm.com (d28av01.in.ibm.com [9.184.220.63]) by d28relay02.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q6VAoAYf16187488 for ; Tue, 31 Jul 2012 16:20:10 +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 q6VGJiBP017759 for ; Tue, 31 Jul 2012 21:49:45 +0530 Received: from abhimanyu.in.ibm.com (abhimanyu.in.ibm.com [9.124.35.147] (may be forged)) by d28av01.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q6VGJhfG017746; Tue, 31 Jul 2012 21:49:43 +0530 Subject: [PATCH v3 8/8] KVM-doc: Add paravirt tlb flush document To: peterz@infradead.org, mtosatti@redhat.com, avi@redhat.com From: "Nikunj A. Dadhania" Cc: raghukt@linux.vnet.ibm.com, alex.shi@intel.com, mingo@elte.hu, kvm@vger.kernel.org, hpa@zytor.com Date: Tue, 31 Jul 2012 16:19:30 +0530 Message-ID: <20120731104925.16662.83745.stgit@abhimanyu.in.ibm.com> In-Reply-To: <20120731104312.16662.27889.stgit@abhimanyu.in.ibm.com> References: <20120731104312.16662.27889.stgit@abhimanyu.in.ibm.com> User-Agent: StGit/0.16-2-g0d85 MIME-Version: 1.0 x-cbid: 12073110-9574-0000-0000-000003C81665 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 +