Currently if two cores access the same page concurrently one will return VM_FAULT_NOPAGE
and the other VM_FAULT_SIGBUS crashing the user code.
Also report when mapping fails.
Signed-off-by: popcornmix <popcornmix@gmail.com>
switch (ret) {
case 0:
case -ERESTARTSYS:
+ /*
+ * EBUSY is ok: this just means that another thread
+ * already did the job.
+ */
+ case -EBUSY:
return VM_FAULT_NOPAGE;
case -ENOMEM:
case -EAGAIN:
+ pr_err("[%s]: failed to map page pfn:%lx virt:%lx ret:%d\n", __func__,
+ pfn, (unsigned long)vmf->virtual_address, ret);
return VM_FAULT_OOM;
default:
+ pr_err("[%s]: failed to map page pfn:%lx virt:%lx ret:%d\n", __func__,
+ pfn, (unsigned long)vmf->virtual_address, ret);
return VM_FAULT_SIGBUS;
}
}