Thread (118 messages) flat view 118 messages, 11 authors, 2011-08-30

Re: kvm PCI assignment & VFIO ramblings

From: Avi Kivity <hidden>
Date: 2011-08-28 14:04:50
Also in: kvm, qemu-devel

On 08/28/2011 04:56 PM, Joerg Roedel wrote:
On Sun, Aug 28, 2011 at 04:14:00PM +0300, Avi Kivity wrote:
quoted
 On 08/26/2011 12:24 PM, Roedel, Joerg wrote:
quoted
quoted
 The biggest problem with this approach is that it has to happen in the
 context of the given process. Linux can't really modify an mm which
 which belong to another context in a safe way.
 Is use_mm() insufficient?
Yes, it introduces a set of race conditions when a process that already
has an mm wants to take over another processes mm temporarily (and when
use_mm is modified to actually provide this functionality). It is only
save when used from kernel-thread context.

One example:

	Process A		Process B			Process C
	.			.				.
	.		<--	takes A->mm			.
	.			and assignes as B->mm		.
	.			.			-->	Wants to take
	.			.				B->mm, but gets
								A->mm now
Good catch.
This can't be secured by a lock, because it introduces potential
A->B<-->B->A lock problem when two processes try to take each others mm.
It could probably be solved by a task->real_mm pointer, havn't thought
about this yet...
Or a workqueue -  you get a kernel thread context with a bit of boilerplate.

-- 
error compiling committee.c: too many arguments to function
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help