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: Avi Kivity
Subject:
Re: [PATCH v5 10/12] Handle async PF in non preemptable context
Date: Tuesday, August 24, 2010 - 2:46 am
On 08/24/2010 12:36 PM, Gleb Natapov wrote:
quoted text
> On Tue, Aug 24, 2010 at 12:30:25PM +0300, Avi Kivity wrote: >> 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.
Ok. -- error compiling committee.c: too many arguments to function --
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
:
Michael Trimarchi
Re: [PATCH] VFS: make file->f_pos access atomic on 32bit arch
Miklos Szeredi
[patch 14/15] vfs: more path_permission() conversions
Serge E. Hallyn
Re: [RFC v5][PATCH 7/8] Infrastructure for shared objects
Bernd Schmidt
Re: Dual-Licensing Linux Kernel with GPL V2 and GPL V3
Takashi Iwai
[PATCH 2/2] input: Add LED support to Synaptics device
git
:
Junio C Hamano
Re: mingw, windows, crlf/lf, and git
Eyvind Bernhardsen
Re: Where has "git ls-remote" reference pattern matching gone?
Shawn O. Pearce
Re: Switching from CVS to GIT
Todd Zullinger
Re: [PATCH 2/2] send-email: rfc2047-quote subject lines with non-ascii characters
Santi Béjar
Re: How to use git-fmt-merge-msg?
linux-netdev
:
Ramkrishna Vepa
[net-2.6 PATCH 1/10] Neterion: New driver: Driver help file
Mark Anthony
invitation / inquiry
Ingo Molnar
Re: [PATCH 08/16] dma-debug: add core checking functions
David Miller
Re: [PATCH 1/3] f_phonet: dev_kfree_skb instead of dev_kfree_skb_any in TX callback
Sascha Hauer
[PATCH 03/12] fec: do not typedef struct types
git-commits-head
:
Linux Kernel Mailing List
amba: struct device - replace bus_id with dev_name(), dev_set_name()
Linux Kernel Mailing List
MIPS: Yosemite: Convert SMP startup lock to arch spinlock.
Linux Kernel Mailing List
ARM: S5PC100: IRQ and timer
Linux Kernel Mailing List
davinci: edma: clear interrupt status for interrupt enabled channels only
Linux Kernel Mailing List
x86, mm, kprobes: fault.c, simplify notify_page_fault()
openbsd-misc
:
Daniel A. Ramaley
Re: [semi-OT] Can anyone recommend an OpenBSD-compatible colour laser printer?
Matthias Kilian
Re: can't get vesa @ 1280x800 or nv
Tobias Ulmer
Re: Problem after upgrade 4.5 to 4.6: ERR M
Philip Guenther
Re: SIGCHLD and libpthread.so
J.C. Roberts
Re: [semi-OT] Can anyone recommend an OpenBSD-compatible colour laser printer?
Colocation donated by:
Syndicate