login
Login
/
Register
Search
Search this site:
Forums
News
Blogs
Features
Site
Home
»
Mailing list archives
»
linux-kernel
»
2010
»
August
»
24
Re: [PATCH v5 10/12] Handle async PF in non preemptable context
view
thread
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
[view in full thread]
From: Gleb Natapov
Subject:
Re: [PATCH v5 10/12] Handle async PF in non preemptable context
Date: Tuesday, August 24, 2010 - 2:36 am
On Tue, Aug 24, 2010 at 12:30:25PM +0300, Avi Kivity wrote:
quoted text
> On 07/19/2010 06:31 PM, Gleb Natapov wrote: > >If async page fault is received by idle task or when preemp_count is > >not zero guest cannot reschedule, so do sti; hlt and wait for page to be > >ready. vcpu can still process interrupts while it waits for the page to > >be ready. > > > >Acked-by: Rik van Riel<riel@redhat.com> > >Signed-off-by: Gleb Natapov<gleb@redhat.com> > >--- > > arch/x86/kernel/kvm.c | 36 ++++++++++++++++++++++++++++++++---- > > 1 files changed, 32 insertions(+), 4 deletions(-) > > > >diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c > >index a6db92e..914b0fc 100644 > >--- a/arch/x86/kernel/kvm.c > >+++ b/arch/x86/kernel/kvm.c > >@@ -37,6 +37,7 @@ > > #include<asm/cpu.h> > > #include<asm/traps.h> > > #include<asm/desc.h> > >+#include<asm/tlbflush.h> > > > > #define MMU_QUEUE_SIZE 1024 > > > >@@ -68,6 +69,8 @@ struct kvm_task_sleep_node { > > wait_queue_head_t wq; > > u32 token; > > int cpu; > >+ bool halted; > >+ struct mm_struct *mm; > > }; > > > > static struct kvm_task_sleep_head { > >@@ -96,6 +99,11 @@ static void apf_task_wait(struct task_struct *tsk, u32 token) > > struct kvm_task_sleep_head *b =&async_pf_sleepers[key]; > > struct kvm_task_sleep_node n, *e; > > DEFINE_WAIT(wait); > >+ int cpu, idle; > >+ > >+ cpu = get_cpu(); > >+ idle = idle_cpu(cpu); > >+ put_cpu(); > > > > spin_lock(&b->lock); > > e = _find_apf_task(b, token); > >@@ -109,17 +117,31 @@ static void apf_task_wait(struct task_struct *tsk, u32 token) > > > > n.token = token; > > n.cpu = smp_processor_id(); > >+ n.mm = current->active_mm; > >+ n.halted = idle || preempt_count()> 1; > >+ atomic_inc(&n.mm->mm_count); > > init_waitqueue_head(&n.wq); > > hlist_add_head(&n.link,&b->list); > > spin_unlock(&b->lock); > > > > for (;;) { > >- prepare_to_wait(&n.wq,&wait, TASK_UNINTERRUPTIBLE); > >+ if (!n.halted) > >+ prepare_to_wait(&n.wq,&wait, TASK_UNINTERRUPTIBLE); > > if (hlist_unhashed(&n.link)) > > break; > >- schedule(); > >+ > >+ if (!n.halted) { > >+ schedule(); > >+ } else { > >+ /* > >+ * We cannot reschedule. So halt. > >+ */ > > If we get the wakeup here, we'll halt and never wake up again. >
We will not. IRQs are disabled here. native_safe_halt() enables them.
quoted text
> >+ native_safe_halt(); > >+ local_irq_disable(); > > So we need a local_irq_disable() before the hlish_unhashed() check.
We are still in exception handler, so IRQ should be off.
quoted text
> > >+ } > > } > >- finish_wait(&n.wq,&wait); > >+ if (!n.halted) > >+ finish_wait(&n.wq,&wait); > > > > return; > > } > >@@ -127,7 +149,12 @@ static void apf_task_wait(struct task_struct *tsk, u32 token) > > static void apf_task_wake_one(struct kvm_task_sleep_node *n) > > { > > hlist_del_init(&n->link); > >- if (waitqueue_active(&n->wq)) > >+ if (!n->mm) > >+ return; > >+ mmdrop(n->mm); > >+ if (n->halted) > >+ smp_send_reschedule(n->cpu); > >+ else if (waitqueue_active(&n->wq)) > > wake_up(&n->wq); > > } > > > >@@ -157,6 +184,7 @@ again: > > } > > n->token = token; > > n->cpu = smp_processor_id(); > >+ n->mm = NULL; > > init_waitqueue_head(&n->wq); > > hlist_add_head(&n->link,&b->list); > > } else > > > -- > error compiling committee.c: too many arguments to function
-- Gleb. --
unsubscribe notice
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to
majordomo@vger.kernel.org
More majordomo info at
http://vger.kernel.org/majordomo-info.html
Please read the FAQ at
http://www.tux.org/lkml/
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
Messages in current thread:
[PATCH v5 00/12] KVM: Add host swap event notifications fo ...
, Gleb Natapov
, (Mon Jul 19, 8:30 am)
[PATCH v5 06/12] Add get_user_pages() variant that fails i ...
, Gleb Natapov
, (Mon Jul 19, 8:30 am)
[PATCH v5 07/12] Maintain memslot version number
, Gleb Natapov
, (Mon Jul 19, 8:30 am)
[PATCH v5 08/12] Inject asynchronous page fault into a gue ...
, Gleb Natapov
, (Mon Jul 19, 8:30 am)
[PATCH v5 10/12] Handle async PF in non preemptable context
, Gleb Natapov
, (Mon Jul 19, 8:31 am)
[PATCH v5 11/12] Let host know whether the guest can handl ...
, Gleb Natapov
, (Mon Jul 19, 8:31 am)
[PATCH v5 12/12] Send async PF when guest is not in usersp ...
, Gleb Natapov
, (Mon Jul 19, 8:31 am)
Re: [PATCH v5 06/12] Add get_user_pages() variant that fai ...
, Avi Kivity
, (Mon Aug 23, 8:50 am)
Re: [PATCH v5 07/12] Maintain memslot version number
, Avi Kivity
, (Mon Aug 23, 8:53 am)
Re: [PATCH v5 08/12] Inject asynchronous page fault into a ...
, Avi Kivity
, (Mon Aug 23, 9:17 am)
Re: [PATCH v5 08/12] Inject asynchronous page fault into a ...
, Gleb Natapov
, (Tue Aug 24, 12:52 am)
Re: [PATCH v5 08/12] Inject asynchronous page fault into a ...
, Avi Kivity
, (Tue Aug 24, 2:04 am)
Re: [PATCH v5 10/12] Handle async PF in non preemptable co ...
, Avi Kivity
, (Tue Aug 24, 2:30 am)
Re: [PATCH v5 11/12] Let host know whether the guest can h ...
, Avi Kivity
, (Tue Aug 24, 2:31 am)
Re: [PATCH v5 12/12] Send async PF when guest is not in us ...
, Avi Kivity
, (Tue Aug 24, 2:36 am)
Re: [PATCH v5 10/12] Handle async PF in non preemptable co ...
, Gleb Natapov
, (Tue Aug 24, 2:36 am)
Re: [PATCH v5 10/12] Handle async PF in non preemptable co ...
, Avi Kivity
, (Tue Aug 24, 2:46 am)
Re: [PATCH v5 08/12] Inject asynchronous page fault into a ...
, Gleb Natapov
, (Tue Aug 24, 5:28 am)
Re: [PATCH v5 08/12] Inject asynchronous page fault into a ...
, Avi Kivity
, (Tue Aug 24, 5:33 am)
Navigation
Mailing list archives
Recent posts
Popular discussions
linux-kernel
:
Fortier,Vincent [Montreal]
2.6.21.5 june 30th to july 1st date hang?
Jeff Dike
[ PATCH 2/6 ] UML - Formatting fixes around os_{read_write}_file callers
Liam Girdwood
[PATCH 07/13] regulator: regulator test harness
Oleg Nesterov
Re: Getting the new RxRPC patches upstream
Stefan Seyfried
Re: 2.6.19-rc5: grub is much slower resuming from suspend-to-disk than in 2.6.18
linux-netdev
:
Arnaud Ebalard
Re: [REGRESSION,BISECTED] MIPv6 support broken by f4f914b58019f0
Jan Engelhardt
Re: [PATCH iptables] extension: add xt_cpu match
Jarek Poplawski
Re: [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock().
Sebastian Andrzej Siewior
[PATCH 8/8] net/emergency: remove locking from reycling pool if emergncy pools are...
David Miller
Re: [PATCH] qlcnic: dont assume NET_IP_ALIGN is 2
git
:
Jakub Narebski
Re: git on MacOSX and files with decomposed utf-8 file names
Brandon Casey
Re: Thunderbird and patches (was Re: [PATCH v2] Enable setting attach as the def...
Christian Couder
[PATCH 1/3] rev-parse: add test script for "--verify"
Ramkumar Ramachandra
Re: [GSoC update] git-remote-svn: The final one
Junio C Hamano
Re: git-rm isn't the inverse action of git-add
openbsd-misc
:
Joachim Schipper
Re: UVC Webcams
Florin Andrei
SOLVED [was: firewall is very slow, something's wrong]
Todd Alan Smith
Re: Microsoft gets the Most Secure Operating Systems award
Neal Hogan
Re: Need Advice: Thinkpad T60 or T61?
Sam Fourman Jr.
Re: Real men don't attack straw men
git-commits-head
:
Linux Kernel Mailing List
ACPI: Disable ARB_DISABLE on platforms where it is not needed
Linux Kernel Mailing List
m68knommu: add read_barrier_depends() and irqs_disabled_flags()
Linux Kernel Mailing List
[MTD] Add mtd panic_write function pointer
Linux Kernel Mailing List
[ARM] pxa: remove duplicate select statements from Kconfig
Linux Kernel Mailing List
mlx4_core: Don't read reserved fields in mlx4_QUERY_ADAPTER()
Colocation donated by:
Syndicate