From patchwork Thu Dec 2 19:43:24 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rik van Riel X-Patchwork-Id: 375741 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oB2Jkkei028644 for ; Thu, 2 Dec 2010 19:46:46 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758048Ab0LBTpr (ORCPT ); Thu, 2 Dec 2010 14:45:47 -0500 Received: from mx1.redhat.com ([209.132.183.28]:56273 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758041Ab0LBTpp (ORCPT ); Thu, 2 Dec 2010 14:45:45 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id oB2JjPuE002218 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 2 Dec 2010 14:45:25 -0500 Received: from annuminas.surriel.com (ovpn-113-70.phx2.redhat.com [10.3.113.70]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id oB2JjN7u027291; Thu, 2 Dec 2010 14:45:24 -0500 Date: Thu, 2 Dec 2010 14:43:24 -0500 From: Rik van Riel To: Rik van Riel Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Avi Kiviti , Srivatsa Vaddagiri , Peter Zijlstra , Ingo Molnar , Anthony Liguori Subject: [RFC PATCH 1/3] kvm: keep track of which task is running a KVM vcpu Message-ID: <20101202144324.4a79263b@annuminas.surriel.com> In-Reply-To: <20101202144129.4357fe00@annuminas.surriel.com> References: <20101202144129.4357fe00@annuminas.surriel.com> Organization: Red Hat, Inc. Mime-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Thu, 02 Dec 2010 19:46:46 +0000 (UTC) diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index 5fbdb55..cb73a73 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h @@ -79,6 +79,7 @@ struct kvm_vcpu { #endif int vcpu_id; struct mutex mutex; + struct task_struct *task; int cpu; struct kvm_run *run; unsigned long requests; diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 050577a..2bffa47 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -741,6 +741,7 @@ void vcpu_load(struct kvm_vcpu *vcpu) int cpu; mutex_lock(&vcpu->mutex); + vcpu->task = current; cpu = get_cpu(); preempt_notifier_register(&vcpu->preempt_notifier); kvm_arch_vcpu_load(vcpu, cpu); @@ -749,6 +750,7 @@ void vcpu_load(struct kvm_vcpu *vcpu) void vcpu_put(struct kvm_vcpu *vcpu) { + vcpu->task = NULL; preempt_disable(); kvm_arch_vcpu_put(vcpu); preempt_notifier_unregister(&vcpu->preempt_notifier);