Re: [PATCH 4/6] kvm tools: Add rwlock wrapper

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* Sasha Levin <levinsasha928@xxxxxxxxx> wrote:

> So the basic plan here is to allocate a futex(?) for each VCPU 
> thread, and have the writer thread lock all futexes when it needs 
> to write?
> 
> If we assume we only have one writer thread, it can stay pretty 
> simple.

We can use an even simpler and more scalable method:

  - writers can 'stop' all other threads, by sending them a 
    threadpool signal and waiting for each thread to have completed 
    processing their current work and notifying the writer back that 
    they have stopped running.

This means that the read-side lock is _zero instructions_, basically 
just a barrier() to make sure the compiler does not move instructions 
across threadpool functions (it wont).

This method requires that we know about every worker thread - i.e. 
no-one does a stray pthread_create() and uses data structures from 
there. It also requires that each worker thread can 'stop' within a 
reasonable amount of time.

Thanks,

	Ingo
--
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


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux