From: Keir Fraser Date: Thu, 18 Nov 2010 12:28:31 +0000 (+0000) Subject: x86 hvm: Refuse to perform __hvm_copy() work in atomic context. X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~11241 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=138880600a0572ea13748e2c166f22727299a367;p=xen.git x86 hvm: Refuse to perform __hvm_copy() work in atomic context. Soon we will properly handle paged out memory in this function by sleeping in hypervisor context. This will require that all callers can sleep. If this check is too strong, we can reduce it to only applying to guests with paging enabled (which also currently implies only guests using Intel EPT). However my brief testing seems to indicate it works okay. Signed-off-by: Keir Fraser --- diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index ccf0d88b9e..bede0ae658 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -1905,6 +1905,13 @@ static enum hvm_copy_result __hvm_copy( char *p; int count, todo = size; + /* + * If the required guest memory is paged out, this function may sleep. + * Hence we bail immediately if called from atomic context. + */ + if ( in_atomic() ) + return HVMCOPY_unhandleable; + while ( todo > 0 ) { count = min_t(int, PAGE_SIZE - (addr & ~PAGE_MASK), todo);