On 05/13/2016 11:48 PM, Neo Jia wrote: > On Fri, May 13, 2016 at 05:46:17PM +0800, Jike Song wrote: >> On 05/13/2016 04:12 AM, Neo Jia wrote: >>> On Thu, May 12, 2016 at 01:05:52PM -0600, Alex Williamson wrote: >>>> >>>> If you're trying to equate the scale of what we need to track vs what >>>> type1 currently tracks, they're significantly different. Possible >>>> things we need to track include the pfn, the iova, and possibly a >>>> reference count or some sort of pinned page map. In the pin-all model >>>> we can assume that every page is pinned on map and unpinned on unmap, >>>> so a reference count or map is unnecessary. We can also assume that we >>>> can always regenerate the pfn with get_user_pages() from the vaddr, so >>>> we don't need to track that. >>> >>> Hi Alex, >>> >>> Thanks for pointing this out, we will not track those in our next rev and >>> get_user_pages will be used from the vaddr as you suggested to handle the >>> single VM with both passthru + mediated device case. >>> >> >> Just a gut feeling: >> >> Calling GUP every time for a particular vaddr, means locking mm->mmap_sem >> every time for a particular process. If the VM has dozens of VCPU, which >> is not rare, the semaphore is likely to be the bottleneck. > > Hi Jike, > > We do need to hold the lock of mm->mmap_sem for the VMM/QEMU process, but I > don't quite follow the reasoning with "dozens of vcpus", one situation that I > can think of is that we have other thread competing with the mmap_sem for the > VMM/QEMU process within KVM kernel such as hva_to_pfn, after a quick search it > seems only mostly gets used by iotcl "KVM_ASSIGN_PCI_DEVICE". > I meant, on guest's writing a gfn to GPU MMU, which could happen on any vcpu, so vmexit happens and mmap_sem required. But I'm now realized that it's also the situation even we store the pfn in rbtree .. > We will definitely conduct performance analysis with large configuration on > servers with E5-2697 v4. :-) My homage :) -- Thanks, Jike -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html