From patchwork Wed Oct 27 09:07:32 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiao Guangrong X-Patchwork-Id: 285102 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 o9R93BHp016046 for ; Wed, 27 Oct 2010 09:03:12 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759603Ab0J0JDH (ORCPT ); Wed, 27 Oct 2010 05:03:07 -0400 Received: from cn.fujitsu.com ([222.73.24.84]:49202 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1754436Ab0J0JDG (ORCPT ); Wed, 27 Oct 2010 05:03:06 -0400 Received: from tang.cn.fujitsu.com (tang.cn.fujitsu.com [10.167.250.3]) by song.cn.fujitsu.com (Postfix) with ESMTP id 40907170E90; Wed, 27 Oct 2010 17:03:05 +0800 (CST) Received: from fnst.cn.fujitsu.com (tang.cn.fujitsu.com [127.0.0.1]) by tang.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id o9R8wuHj024562; Wed, 27 Oct 2010 16:58:56 +0800 Received: from [10.167.225.99] (unknown [10.167.225.99]) by fnst.cn.fujitsu.com (Postfix) with ESMTPA id 8DEFC14C09A; Wed, 27 Oct 2010 17:04:47 +0800 (CST) Message-ID: <4CC7EBD4.6070105@cn.fujitsu.com> Date: Wed, 27 Oct 2010 17:07:32 +0800 From: Xiao Guangrong User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.11) Gecko/20100713 Thunderbird/3.0.6 MIME-Version: 1.0 To: Avi Kivity CC: Marcelo Tosatti , LKML , KVM Subject: [PATCH 6/8] KVM: simply wakup async pf References: <4CC7EA7D.5020901@cn.fujitsu.com> In-Reply-To: <4CC7EA7D.5020901@cn.fujitsu.com> 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]); Wed, 27 Oct 2010 09:03:12 +0000 (UTC) diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index 0c1b7c5..d91add9 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h @@ -131,6 +131,7 @@ struct kvm_vcpu { struct list_head queue; struct list_head done; spinlock_t lock; + bool wakeup; } async_pf; #endif diff --git a/virt/kvm/async_pf.c b/virt/kvm/async_pf.c index 5307a32..0d1f6c4 100644 --- a/virt/kvm/async_pf.c +++ b/virt/kvm/async_pf.c @@ -124,6 +124,11 @@ bool kvm_check_async_pf_completion(struct kvm_vcpu *vcpu) { struct kvm_async_pf *work; + if (vcpu->async_pf.wakeup) { + vcpu->async_pf.wakeup = false; + return true; + } + if (list_empty_careful(&vcpu->async_pf.done) || !kvm_arch_can_inject_async_page_present(vcpu)) return false; @@ -197,20 +202,6 @@ retry_sync: int kvm_async_pf_wakeup_all(struct kvm_vcpu *vcpu) { - struct kvm_async_pf *work; - - if (!list_empty(&vcpu->async_pf.done)) - return 0; - - work = kmem_cache_zalloc(async_pf_cache, GFP_ATOMIC); - if (!work) - return -ENOMEM; - - work->page = bad_page; - get_page(bad_page); - INIT_LIST_HEAD(&work->queue); /* for list_del to work */ - - list_add_tail(&work->link, &vcpu->async_pf.done); - vcpu->async_pf.queued++; + vcpu->async_pf.wakeup = true; return 0; }