From patchwork Mon Jan 3 21:27:40 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rik van Riel X-Patchwork-Id: 449131 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 p03LVQKN024685 for ; Mon, 3 Jan 2011 21:31:26 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754503Ab1ACVa1 (ORCPT ); Mon, 3 Jan 2011 16:30:27 -0500 Received: from mx1.redhat.com ([209.132.183.28]:29453 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753407Ab1ACVa0 (ORCPT ); Mon, 3 Jan 2011 16:30:26 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id p03LUJF9016887 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 3 Jan 2011 16:30:19 -0500 Received: from annuminas.surriel.com (ovpn-113-70.phx2.redhat.com [10.3.113.70]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p03LUAlJ011529; Mon, 3 Jan 2011 16:30:18 -0500 Date: Mon, 3 Jan 2011 16:27:40 -0500 From: Rik van Riel To: kvm@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Avi Kiviti , Srivatsa Vaddagiri , Peter Zijlstra , Mike Galbraith , Chris Wright Subject: [RFC -v3 PATCH 1/3] kvm: keep track of which task is running a KVM vcpu Message-ID: <20110103162740.0af52955@annuminas.surriel.com> In-Reply-To: <20110103162637.29f23c40@annuminas.surriel.com> References: <20110103162637.29f23c40@annuminas.surriel.com> Organization: Red Hat, Inc. Mime-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 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]); Mon, 03 Jan 2011 21:31:26 +0000 (UTC) diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index a055742..180085b 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h @@ -81,6 +81,7 @@ struct kvm_vcpu { #endif int vcpu_id; struct mutex mutex; + struct task_struct *task; int cpu; atomic_t guest_mode; struct kvm_run *run; diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 5225052..c95bad1 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -2248,6 +2248,7 @@ static void kvm_sched_in(struct preempt_notifier *pn, int cpu) { struct kvm_vcpu *vcpu = preempt_notifier_to_vcpu(pn); + vcpu->task = NULL; kvm_arch_vcpu_load(vcpu, cpu); } @@ -2256,6 +2257,7 @@ static void kvm_sched_out(struct preempt_notifier *pn, { struct kvm_vcpu *vcpu = preempt_notifier_to_vcpu(pn); + vcpu->task = current; kvm_arch_vcpu_put(vcpu); }