From: Paolo Bonzini <pbonzini@redhat.com> To: "Emilio G. Cota" <cota@braap.org> Cc: kvm@vger.kernel.org, mst@redhat.com, mtosatti@redhat.com, Xiao Guangrong <xiaoguangrong@tencent.com>, dgilbert@redhat.com, peterx@redhat.com, qemu-devel@nongnu.org, quintela@redhat.com, wei.w.wang@intel.com, guangrong.xiao@gmail.com, jiang.biao2@zte.com.cn Subject: Re: [PATCH 2/4] migration: introduce lockless multithreads model Date: Sun, 28 Oct 2018 08:50:17 +0100 [thread overview] Message-ID: <5e062ad6-6779-b7de-ee15-482ddaac9556@redhat.com> (raw) In-Reply-To: <20181026233354.GA31660@flamenco> On 27/10/2018 01:33, Emilio G. Cota wrote: > On Wed, Oct 17, 2018 at 12:10:15 +0200, Paolo Bonzini wrote: >> On 16/10/2018 13:10, guangrong.xiao@gmail.com wrote: > >> An idea: the total number of requests is going to be very small, and a >> PtrRing is not the nicest data structure for multiple producer/single >> consumer. So you could instead: > (snip) >> - now that you have request indices, you can replace the completion >> ptr_ring with a bitmap, and set a bit in the bitmap with set_bit_atomic >> to report completion. On the writer side you use find_next_bit to find > (snip) >> Emilio, can you review the above ideas? > > Sorry it took me a while to go through this. > > I like your suggestions. Just one nit; I'm not sure I understood > the use case very well, but I think using a bitmap to signal > completion might be suboptimal, since we'd have several > thread spinning on the same cacheline yet caring about > different bits. Requests are asynchronous, the bitmap is only used to find a free submission slot. You're right that the bitmap can bounce across processors, but I'm not sure how else you would do that because you don't know in advance how many submitting threads you have. It wouldn't be any worse if there was a spinlock. However, in the migration case there is only one submitting thread, so it's okay. :) Paolo > Xiao: a couple of suggestions > > - Since you'll be adding a generic module, make its commit and > description self-contained. That is, mentioning in the > log that this will be used for migration is fine, but please > describe the module (and the assumptions it makes about its > users) in general, so that someone that doesn't know anything > about migration can still understand this module (and hopefully > adopt it for other use cases). > > - I'd like to see a simple test program (or rather, benchmark) > that shows how this works. This benchmark would be completely > unrelated to migration; it should just be a simple test of > the performance/scalability of this module. > Having this benchmark would help (1) discuss and quantitately > evaluate modifications to the module, and (2) help others to > quickly understand what the module does. > See tests/qht-bench.c for an example. > > Thanks, > > Emilio >
WARNING: multiple messages have this Message-ID (diff)
From: Paolo Bonzini <pbonzini@redhat.com> To: "Emilio G. Cota" <cota@braap.org> Cc: guangrong.xiao@gmail.com, mst@redhat.com, mtosatti@redhat.com, qemu-devel@nongnu.org, kvm@vger.kernel.org, dgilbert@redhat.com, peterx@redhat.com, wei.w.wang@intel.com, jiang.biao2@zte.com.cn, eblake@redhat.com, quintela@redhat.com, Xiao Guangrong <xiaoguangrong@tencent.com> Subject: Re: [Qemu-devel] [PATCH 2/4] migration: introduce lockless multithreads model Date: Sun, 28 Oct 2018 08:50:17 +0100 [thread overview] Message-ID: <5e062ad6-6779-b7de-ee15-482ddaac9556@redhat.com> (raw) In-Reply-To: <20181026233354.GA31660@flamenco> On 27/10/2018 01:33, Emilio G. Cota wrote: > On Wed, Oct 17, 2018 at 12:10:15 +0200, Paolo Bonzini wrote: >> On 16/10/2018 13:10, guangrong.xiao@gmail.com wrote: > >> An idea: the total number of requests is going to be very small, and a >> PtrRing is not the nicest data structure for multiple producer/single >> consumer. So you could instead: > (snip) >> - now that you have request indices, you can replace the completion >> ptr_ring with a bitmap, and set a bit in the bitmap with set_bit_atomic >> to report completion. On the writer side you use find_next_bit to find > (snip) >> Emilio, can you review the above ideas? > > Sorry it took me a while to go through this. > > I like your suggestions. Just one nit; I'm not sure I understood > the use case very well, but I think using a bitmap to signal > completion might be suboptimal, since we'd have several > thread spinning on the same cacheline yet caring about > different bits. Requests are asynchronous, the bitmap is only used to find a free submission slot. You're right that the bitmap can bounce across processors, but I'm not sure how else you would do that because you don't know in advance how many submitting threads you have. It wouldn't be any worse if there was a spinlock. However, in the migration case there is only one submitting thread, so it's okay. :) Paolo > Xiao: a couple of suggestions > > - Since you'll be adding a generic module, make its commit and > description self-contained. That is, mentioning in the > log that this will be used for migration is fine, but please > describe the module (and the assumptions it makes about its > users) in general, so that someone that doesn't know anything > about migration can still understand this module (and hopefully > adopt it for other use cases). > > - I'd like to see a simple test program (or rather, benchmark) > that shows how this works. This benchmark would be completely > unrelated to migration; it should just be a simple test of > the performance/scalability of this module. > Having this benchmark would help (1) discuss and quantitately > evaluate modifications to the module, and (2) help others to > quickly understand what the module does. > See tests/qht-bench.c for an example. > > Thanks, > > Emilio >
next prev parent reply other threads:[~2018-10-28 7:50 UTC|newest] Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-10-16 11:10 [PATCH 0/4] migration: improve multithreads guangrong.xiao 2018-10-16 11:10 ` [Qemu-devel] " guangrong.xiao 2018-10-16 11:10 ` [PATCH 1/4] ptr_ring: port ptr_ring from linux kernel to QEMU guangrong.xiao 2018-10-16 11:10 ` [Qemu-devel] " guangrong.xiao 2018-10-16 16:40 ` Emilio G. Cota 2018-10-16 16:40 ` [Qemu-devel] " Emilio G. Cota 2018-10-17 8:14 ` Paolo Bonzini 2018-10-17 8:14 ` [Qemu-devel] " Paolo Bonzini 2018-10-18 6:52 ` Xiao Guangrong 2018-10-18 6:52 ` [Qemu-devel] " Xiao Guangrong 2018-10-16 11:10 ` [PATCH 2/4] migration: introduce lockless multithreads model guangrong.xiao 2018-10-16 11:10 ` [Qemu-devel] " guangrong.xiao 2018-10-17 10:10 ` Paolo Bonzini 2018-10-17 10:10 ` [Qemu-devel] " Paolo Bonzini 2018-10-18 9:30 ` Xiao Guangrong 2018-10-18 9:30 ` [Qemu-devel] " Xiao Guangrong 2018-10-18 10:39 ` Paolo Bonzini 2018-10-18 10:39 ` [Qemu-devel] " Paolo Bonzini 2018-10-26 23:33 ` Emilio G. Cota 2018-10-26 23:33 ` [Qemu-devel] " Emilio G. Cota 2018-10-28 7:50 ` Paolo Bonzini [this message] 2018-10-28 7:50 ` Paolo Bonzini 2018-10-29 2:52 ` Xiao Guangrong 2018-10-29 2:52 ` [Qemu-devel] " Xiao Guangrong 2018-10-16 11:10 ` [PATCH 3/4] migration: use lockless Multithread model for compression guangrong.xiao 2018-10-16 11:10 ` [Qemu-devel] " guangrong.xiao 2018-10-16 11:10 ` [PATCH 4/4] migration: use lockless Multithread model for decompression guangrong.xiao 2018-10-16 11:10 ` [Qemu-devel] " guangrong.xiao
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=5e062ad6-6779-b7de-ee15-482ddaac9556@redhat.com \ --to=pbonzini@redhat.com \ --cc=cota@braap.org \ --cc=dgilbert@redhat.com \ --cc=guangrong.xiao@gmail.com \ --cc=jiang.biao2@zte.com.cn \ --cc=kvm@vger.kernel.org \ --cc=mst@redhat.com \ --cc=mtosatti@redhat.com \ --cc=peterx@redhat.com \ --cc=qemu-devel@nongnu.org \ --cc=quintela@redhat.com \ --cc=wei.w.wang@intel.com \ --cc=xiaoguangrong@tencent.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.