munmap: fix deadlock with remote pagefault on vm range lock
Add similar protection to clear_host_pte than to set_host_vma (see #986) Also make the page fault handler only skip taking lock if the munmap happened on the same cpu id Change-Id: I6d9e68e8f8905b20bb2ccfa72848e04fe6404ab6
This commit is contained in:
committed by
Balazs Gerofi
parent
621533bbd3
commit
a563d780c1
@@ -2168,19 +2168,11 @@ static int do_page_fault_process_vm(struct process_vm *vm, void *fault_addr0, ui
|
||||
dkprintf("[%d]do_page_fault_process_vm(%p,%lx,%lx)\n",
|
||||
ihk_mc_get_processor_id(), vm, fault_addr0, reason);
|
||||
|
||||
if (!thread->vm->is_memory_range_lock_taken) {
|
||||
/* For the case where is_memory_range_lock_taken is incremented after memory_range_lock is taken. */
|
||||
while (1) {
|
||||
if (thread->vm->is_memory_range_lock_taken) {
|
||||
goto skip;
|
||||
}
|
||||
if (ihk_mc_spinlock_trylock_noirq(&vm->memory_range_lock)) {
|
||||
locked = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (thread->vm->is_memory_range_lock_taken == -1 ||
|
||||
thread->vm->is_memory_range_lock_taken != ihk_mc_get_processor_id()) {
|
||||
ihk_mc_spinlock_lock_noirq(&vm->memory_range_lock);
|
||||
locked = 1;
|
||||
} else {
|
||||
skip:;
|
||||
dkprintf("%s: INFO: skip locking of memory_range_lock,pid=%d,tid=%d\n",
|
||||
__func__, thread->proc->pid, thread->tid);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user