diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-10-09 03:02:35 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-10-09 03:02:35 -0400 |
commit | 1236d6bb6e19fc72ffc6bbcdeb1bfefe450e54ee (patch) | |
tree | 47da3feee8e263e8c9352c85cf518e624be3c211 /arch/x86/kernel/kvm.c | |
parent | 750b1a6894ecc9b178c6e3d0a1170122971b2036 (diff) | |
parent | 8a5776a5f49812d29fe4b2d0a2d71675c3facf3f (diff) |
Merge 4.14-rc4 into staging-next
We want the staging/iio fixes in here as well to handle merge issues.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'arch/x86/kernel/kvm.c')
-rw-r--r-- | arch/x86/kernel/kvm.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c index aa60a08b65b1..8bb9594d0761 100644 --- a/arch/x86/kernel/kvm.c +++ b/arch/x86/kernel/kvm.c | |||
@@ -117,7 +117,11 @@ static struct kvm_task_sleep_node *_find_apf_task(struct kvm_task_sleep_head *b, | |||
117 | return NULL; | 117 | return NULL; |
118 | } | 118 | } |
119 | 119 | ||
120 | void kvm_async_pf_task_wait(u32 token) | 120 | /* |
121 | * @interrupt_kernel: Is this called from a routine which interrupts the kernel | ||
122 | * (other than user space)? | ||
123 | */ | ||
124 | void kvm_async_pf_task_wait(u32 token, int interrupt_kernel) | ||
121 | { | 125 | { |
122 | u32 key = hash_32(token, KVM_TASK_SLEEP_HASHBITS); | 126 | u32 key = hash_32(token, KVM_TASK_SLEEP_HASHBITS); |
123 | struct kvm_task_sleep_head *b = &async_pf_sleepers[key]; | 127 | struct kvm_task_sleep_head *b = &async_pf_sleepers[key]; |
@@ -140,7 +144,10 @@ void kvm_async_pf_task_wait(u32 token) | |||
140 | 144 | ||
141 | n.token = token; | 145 | n.token = token; |
142 | n.cpu = smp_processor_id(); | 146 | n.cpu = smp_processor_id(); |
143 | n.halted = is_idle_task(current) || preempt_count() > 1; | 147 | n.halted = is_idle_task(current) || |
148 | (IS_ENABLED(CONFIG_PREEMPT_COUNT) | ||
149 | ? preempt_count() > 1 || rcu_preempt_depth() | ||
150 | : interrupt_kernel); | ||
144 | init_swait_queue_head(&n.wq); | 151 | init_swait_queue_head(&n.wq); |
145 | hlist_add_head(&n.link, &b->list); | 152 | hlist_add_head(&n.link, &b->list); |
146 | raw_spin_unlock(&b->lock); | 153 | raw_spin_unlock(&b->lock); |
@@ -268,7 +275,7 @@ do_async_page_fault(struct pt_regs *regs, unsigned long error_code) | |||
268 | case KVM_PV_REASON_PAGE_NOT_PRESENT: | 275 | case KVM_PV_REASON_PAGE_NOT_PRESENT: |
269 | /* page is swapped out by the host. */ | 276 | /* page is swapped out by the host. */ |
270 | prev_state = exception_enter(); | 277 | prev_state = exception_enter(); |
271 | kvm_async_pf_task_wait((u32)read_cr2()); | 278 | kvm_async_pf_task_wait((u32)read_cr2(), !user_mode(regs)); |
272 | exception_exit(prev_state); | 279 | exception_exit(prev_state); |
273 | break; | 280 | break; |
274 | case KVM_PV_REASON_PAGE_READY: | 281 | case KVM_PV_REASON_PAGE_READY: |