Re: [PATCH v8 1/5] QIOChannel: Add flags on io_writev and introduce io_flush callback

2022-02-01 Thread Leonardo Bras Soares Passos
Hello Daniel, thanks for reviewing! On Tue, Feb 1, 2022 at 6:35 AM Daniel P. Berrangé wrote: > > On Tue, Feb 01, 2022 at 03:28:59AM -0300, Leonardo Bras wrote: > > Add flags to io_writev and introduce io_flush as optional callback to > > QIOChannelClass, allowing the implementation of zero copy w

Re: [PATCH v8 1/5] QIOChannel: Add flags on io_writev and introduce io_flush callback

2022-02-07 Thread Leonardo Bras Soares Passos
Hello Peter, On Mon, Feb 7, 2022 at 9:50 AM Peter Xu wrote: > > On Tue, Feb 01, 2022 at 03:28:59AM -0300, Leonardo Bras wrote: > > Add flags to io_writev and introduce io_flush as optional callback to > > QIOChannelClass, allowing the implementation of zero copy writes by > > subclasses. > > > >

Re: [PATCH v8 5/5] multifd: Implement zero copy write in multifd migration (multifd-zero-copy)

2022-02-07 Thread Leonardo Bras Soares Passos
Hello Peter, thanks for reviewing! On Mon, Feb 7, 2022 at 11:22 PM Peter Xu wrote: > > On Tue, Feb 01, 2022 at 03:29:03AM -0300, Leonardo Bras wrote: > > -void multifd_send_sync_main(QEMUFile *f) > > +int multifd_send_sync_main(QEMUFile *f) > > { > > int i; > > +bool flush_zero_copy; >

Re: [PATCH v1 0/3] QIOChannel flags + multifd zerocopy

2021-09-01 Thread Leonardo Bras Soares Passos
Hello Peter, On Tue, Aug 31, 2021 at 6:24 PM Peter Xu wrote: > > On Tue, Aug 31, 2021 at 08:02:36AM -0300, Leonardo Bras wrote: > > Results: > > So far, the resource usage of __sys_sendmsg() reduced 15 times, and the > > overall migration took 13-18% less time, based in synthetic workload. > > Le

Re: [PATCH v1 2/3] io: Add zerocopy and errqueue

2021-09-01 Thread Leonardo Bras Soares Passos
Hello Daniel, thank you for the feedback! Comments inline. On Tue, Aug 31, 2021 at 9:57 AM Daniel P. Berrangé wrote: > > On Tue, Aug 31, 2021 at 08:02:38AM -0300, Leonardo Bras wrote: > > MSG_ZEROCOPY is a feature that enables copy avoidance in TCP/UDP socket > > send calls. It does so by avoidi

Re: [PATCH v1 2/3] io: Add zerocopy and errqueue

2021-09-01 Thread Leonardo Bras Soares Passos
Thanks for this feedback Peter! I ended up reading/replying the e-mails in thread order, so I may have been redundant with your argument, sorry about that. I will add my comments inline, but I will add references to the previous mail I sent Daniel, so please read it too. On Tue, Aug 31, 2021 at

Re: [PATCH v1 2/3] io: Add zerocopy and errqueue

2021-09-02 Thread Leonardo Bras Soares Passos
Hello Daniel,. A few more comments: On Wed, Sep 1, 2021 at 5:51 AM Daniel P. Berrangé wrote: > > On Tue, Aug 31, 2021 at 04:27:04PM -0400, Peter Xu wrote: > > On Tue, Aug 31, 2021 at 01:57:33PM +0100, Daniel P. Berrangé wrote: > > > On Tue, Aug 31, 2021 at 08:02:38AM -0300, Leonardo Bras wrote: >

Re: [PATCH v1 3/3] migration: multifd: Enable zerocopy

2021-09-02 Thread Leonardo Bras Soares Passos
Hello Daniel, thanks for the feedback ! On Tue, Aug 31, 2021 at 10:17 AM Daniel P. Berrangé wrote: > > On Tue, Aug 31, 2021 at 08:02:39AM -0300, Leonardo Bras wrote: > > Call qio_channel_set_zerocopy(true) in the start of every multifd thread. > > > > Change the send_write() interface of multifd,

Re: [PATCH v1 3/3] migration: multifd: Enable zerocopy

2021-09-02 Thread Leonardo Bras Soares Passos
Hello Peter, thank you for this feedback! On Tue, Aug 31, 2021 at 5:29 PM Peter Xu wrote: > Yes it would be great to be a migration capability in parallel to multifd. At > initial phase if it's easy to be implemented on multi-fd only, we can add a > dependency between the caps. In the future we

Re: [PATCH v1 3/3] migration: multifd: Enable zerocopy

2021-09-02 Thread Leonardo Bras Soares Passos
A few more comments on this one: On Wed, Sep 1, 2021 at 12:44 PM Daniel P. Berrangé wrote: > > > From the safe side we may want to only enable one of them until we prove > > they'll work together I guess.. > > MPTCP is good when we're network limited for migration > > KTLS will be good when we're

Re: [PATCH v1 3/3] migration: multifd: Enable zerocopy

2021-09-02 Thread Leonardo Bras Soares Passos
Thanks for contributing Jason! On Thu, Sep 2, 2021 at 4:23 AM Jason Wang wrote: > > > 在 2021/9/1 下午11:35, Peter Xu 写道: > > On Wed, Sep 01, 2021 at 09:53:07AM +0100, Daniel P. Berrangé wrote: > >> On Tue, Aug 31, 2021 at 04:29:09PM -0400, Peter Xu wrote: > >>> On Tue, Aug 31, 2021 at 02:16:42PM +0

Re: [PATCH v1 1/3] io: Enable write flags for QIOChannel

2021-09-02 Thread Leonardo Bras Soares Passos
Thanks for the feedback Eric! On Wed, Sep 1, 2021 at 5:54 PM Eric Blake wrote: > > On Tue, Aug 31, 2021 at 08:02:37AM -0300, Leonardo Bras wrote: > > Some syscalls used for writting, such as sendmsg(), accept flags that > > can modify their behavior, even allowing the usage of features such as >

Re: [PATCH v1 3/3] migration: multifd: Enable zerocopy

2021-09-02 Thread Leonardo Bras Soares Passos
On Thu, Sep 2, 2021 at 5:21 AM Daniel P. Berrangé wrote: > > On Thu, Sep 02, 2021 at 04:22:55AM -0300, Leonardo Bras Soares Passos wrote: > > Hello Daniel, thanks for the feedback ! > > > > On Tue, Aug 31, 2021 at 10:17 AM Daniel P. Berrangé > > wrote: > > &

Re: [PATCH v1 2/3] io: Add zerocopy and errqueue

2021-09-02 Thread Leonardo Bras Soares Passos
On Thu, Sep 2, 2021 at 5:47 AM Daniel P. Berrangé wrote: > > On Thu, Sep 02, 2021 at 03:38:11AM -0300, Leonardo Bras Soares Passos wrote: > > Hello Daniel, thank you for the feedback! > > > > Comments inline. > > > > On Tue, Aug 31, 2021 at 9:57 AM Daniel P.

Re: [PATCH v1 3/3] migration: multifd: Enable zerocopy

2021-09-02 Thread Leonardo Bras Soares Passos
On Thu, Sep 2, 2021 at 6:20 AM Daniel P. Berrangé wrote: > > On Thu, Sep 02, 2021 at 05:52:15AM -0300, Leonardo Bras Soares Passos wrote: > > On Thu, Sep 2, 2021 at 5:21 AM Daniel P. Berrangé > > wrote: > > > > > > On Thu, Sep 02, 2021 at 04:22:55A

Re: [PATCH v1 2/3] io: Add zerocopy and errqueue

2021-09-02 Thread Leonardo Bras Soares Passos
On Thu, Sep 2, 2021 at 6:50 AM Daniel P. Berrangé wrote: > > On Thu, Sep 02, 2021 at 06:34:01AM -0300, Leonardo Bras Soares Passos wrote: > > On Thu, Sep 2, 2021 at 5:47 AM Daniel P. Berrangé > > wrote: > > > > > > On Thu, Sep 02, 2021 at 03:38:11A

Re: [PATCH v1 3/3] migration: multifd: Enable zerocopy

2021-09-02 Thread Leonardo Bras Soares Passos
On Thu, Sep 2, 2021 at 6:59 AM Daniel P. Berrangé wrote: > > On Thu, Sep 02, 2021 at 06:49:06AM -0300, Leonardo Bras Soares Passos wrote: > > On Thu, Sep 2, 2021 at 6:20 AM Daniel P. Berrangé > > wrote: > > > > > > On Thu, Sep 02, 2021 at 05:52:15A

Re: [PATCH v1 2/3] io: Add zerocopy and errqueue

2021-09-08 Thread Leonardo Bras Soares Passos
On Tue, Sep 7, 2021 at 1:44 PM Peter Xu wrote: > > On Thu, Sep 02, 2021 at 03:59:25AM -0300, Leonardo Bras Soares Passos wrote: > > I also suggested something like that, but I thought it could be good if we > > could > > fall back to io_writev() if we didn't have the

Re: [PATCH v1 2/3] io: Add zerocopy and errqueue

2021-09-08 Thread Leonardo Bras Soares Passos
On Tue, Sep 7, 2021 at 8:06 AM Dr. David Alan Gilbert wrote: > > Possibly, yes. This really need David G's input since he understands > > the code in way more detail than me. > > Hmm I'm not entirely sure why we have the sync after each iteration; > the case I can think of is if we're doing async

Re: [PATCH v1 2/3] io: Add zerocopy and errqueue

2021-09-08 Thread Leonardo Bras Soares Passos
On Wed, Sep 8, 2021 at 11:05 PM Peter Xu wrote: > > On Wed, Sep 08, 2021 at 10:57:06PM +0100, Daniel P. Berrangé wrote: > > We think we're probably ok with migration as we are going to rely on the > > face that we eventually pause the guest to stop page changes during the > > final switchover. Non

Re: [PATCH v8 1/5] QIOChannel: Add flags on io_writev and introduce io_flush callback

2022-02-21 Thread Leonardo Bras Soares Passos
Thanks for reviewing, Juan! On Fri, Feb 18, 2022 at 1:36 PM Juan Quintela wrote: > > Leonardo Bras wrote: > > Add flags to io_writev and introduce io_flush as optional callback to > > QIOChannelClass, allowing the implementation of zero copy writes by > > subclasses. > > > > How to use them: > >

Re: [PATCH v8 5/5] multifd: Implement zero copy write in multifd migration (multifd-zero-copy)

2022-02-21 Thread Leonardo Bras Soares Passos
Hello Juan, thanks for the feedback! On Fri, Feb 18, 2022 at 1:57 PM Juan Quintela wrote: > > Leonardo Bras wrote: > > Implement zero copy send on nocomp_send_write(), by making use of QIOChannel > > writev + flags & flush interface. > > > > Change multifd_send_sync_main() so flush_zero_copy() c

Re: [PATCH v8 5/5] multifd: Implement zero copy write in multifd migration (multifd-zero-copy)

2022-02-21 Thread Leonardo Bras Soares Passos
On Fri, Feb 18, 2022 at 2:36 PM Juan Quintela wrote: > > Leonardo Bras Soares Passos wrote: > > Hello Peter, thanks for reviewing! > > > > On Mon, Feb 7, 2022 at 11:22 PM Peter Xu wrote: > >> > >> On Tue, Feb 01, 2022 at 03:29:03AM -0300, Leonardo Bras

Re: [PATCH v8 5/5] multifd: Implement zero copy write in multifd migration (multifd-zero-copy)

2022-02-21 Thread Leonardo Bras Soares Passos
On Mon, Feb 21, 2022 at 4:41 PM Leonardo Bras Soares Passos wrote: > > Hello Juan, thanks for the feedback! > > On Fri, Feb 18, 2022 at 1:57 PM Juan Quintela wrote: > > > > Leonardo Bras wrote: > > > Implement zero copy send on nocomp_send_write(), b

Re: [PATCH v8 5/5] multifd: Implement zero copy write in multifd migration (multifd-zero-copy)

2022-03-07 Thread Leonardo Bras Soares Passos
On Tue, Mar 1, 2022 at 12:57 AM Peter Xu wrote: > > On Fri, Feb 18, 2022 at 05:57:13PM +0100, Juan Quintela wrote: > > I did a change on: > > > > commit d48c3a044537689866fe44e65d24c7d39a68868a > > Author: Juan Quintela > > Date: Fri Nov 19 15:35:58 2021 +0100 > > > > multifd: Use a single

Re: [PATCH v9 5/7] multifd: multifd_send_sync_main now returns negative on error

2022-04-26 Thread Leonardo Bras Soares Passos
On Tue, Apr 26, 2022 at 9:59 AM Peter Xu wrote: > > On Mon, Apr 25, 2022 at 06:50:54PM -0300, Leonardo Bras wrote: > > Even though multifd_send_sync_main() currently emits error_reports, it's > > callers don't really check it before continuing. > > > > Change multifd_send_sync_main() to return -1

Re: [PATCH v9 6/7] multifd: Send header packet without flags if zero-copy-send is enabled

2022-04-26 Thread Leonardo Bras Soares Passos
Hello Daniel, thank you for the feedback! On Tue, Apr 26, 2022 at 5:11 AM Daniel P. Berrangé wrote: > > On Mon, Apr 25, 2022 at 06:50:55PM -0300, Leonardo Bras wrote: > > Since d48c3a0445 ("multifd: Use a single writev on the send side"), > > sending the header packet and the memory pages happens

Re: [PATCH v9 7/7] multifd: Implement zero copy write in multifd migration (multifd-zero-copy)

2022-04-26 Thread Leonardo Bras Soares Passos
Hello Peter, thanks for helping! On Tue, Apr 26, 2022 at 1:02 PM Peter Xu wrote: > > Leo, > > This patch looks mostly good to me, a few nitpicks below. > > On Mon, Apr 25, 2022 at 06:50:56PM -0300, Leonardo Bras wrote: [...] > > } > > + > > +/* > > + * When using zero-copy, it's nece

Re: [PATCH v10 6/7] multifd: Send header packet without flags if zero-copy-send is enabled

2022-04-27 Thread Leonardo Bras Soares Passos
On Tue, Apr 26, 2022 at 8:26 PM Peter Xu wrote: > > On Tue, Apr 26, 2022 at 08:06:55PM -0300, Leonardo Bras wrote: > > Since d48c3a0445 ("multifd: Use a single writev on the send side"), > > sending the header packet and the memory pages happens in the same > > writev, which can potentially make t

Re: [PATCH v10 7/7] multifd: Implement zero copy write in multifd migration (multifd-zero-copy)

2022-04-27 Thread Leonardo Bras Soares Passos
On Wed, Apr 27, 2022 at 5:46 AM Daniel P. Berrangé wrote: > > On Tue, Apr 26, 2022 at 08:06:56PM -0300, Leonardo Bras wrote: > > Implement zero copy send on nocomp_send_write(), by making use of QIOChannel > > writev + flags & flush interface. > > > > Change multifd_send_sync_main() so flush_zero_

Re: [PATCH v10 6/7] multifd: Send header packet without flags if zero-copy-send is enabled

2022-04-27 Thread Leonardo Bras Soares Passos
On Wed, Apr 27, 2022 at 5:44 AM Daniel P. Berrangé wrote: > > On Tue, Apr 26, 2022 at 08:06:55PM -0300, Leonardo Bras wrote: > > Since d48c3a0445 ("multifd: Use a single writev on the send side"), > > sending the header packet and the memory pages happens in the same > > writev, which can potentia

Re: [PATCH v10 7/7] multifd: Implement zero copy write in multifd migration (multifd-zero-copy)

2022-04-27 Thread Leonardo Bras Soares Passos
On Tue, Apr 26, 2022 at 8:26 PM Peter Xu wrote: > > On Tue, Apr 26, 2022 at 08:06:56PM -0300, Leonardo Bras wrote: > > Implement zero copy send on nocomp_send_write(), by making use of QIOChannel > > writev + flags & flush interface. > > > > Change multifd_send_sync_main() so flush_zero_copy() can

Re: [PATCH v10 0/7] MSG_ZEROCOPY + multifd

2022-04-28 Thread Leonardo Bras Soares Passos
On Thu, Apr 28, 2022 at 11:08 AM Dr. David Alan Gilbert wrote: > > * Leonardo Bras (leob...@redhat.com) wrote: > > This patch series intends to enable MSG_ZEROCOPY in QIOChannel, and make > > use of it for multifd migration performance improvement, by reducing cpu > > usage. > > > > Patch #1 creat

Re: [PATCH v9 3/7] migration: Add zero-copy-send parameter for QMP/HMP for Linux

2022-05-04 Thread Leonardo Bras Soares Passos
On Wed, May 4, 2022 at 7:48 AM Markus Armbruster wrote: > > Leonardo Bras writes: > > > Add property that allows zero-copy migration of memory pages > > on the sending side, and also includes a helper function > > migrate_use_zero_copy_send() to check if it's enabled. > > > > No code is introduce

Re: [PATCH v11 2/7] QIOChannelSocket: Implement io_writev zero copy flag & io_flush for CONFIG_LINUX

2022-05-04 Thread Leonardo Bras Soares Passos
On Wed, May 4, 2022 at 4:53 PM Peter Xu wrote: > > On Wed, May 04, 2022 at 04:18:31PM -0300, Leonardo Bras wrote: > > +/* > > + * Zero-copy defines bellow are included to avoid breaking builds on > > systems > > + * that don't support MSG_ZEROCOPY, while keeping the functions more > > readable >

Re: [PATCH v11 2/7] QIOChannelSocket: Implement io_writev zero copy flag & io_flush for CONFIG_LINUX

2022-05-05 Thread Leonardo Bras Soares Passos
On Thu, May 5, 2022 at 5:05 AM Daniel P. Berrangé wrote: > > On Wed, May 04, 2022 at 04:18:31PM -0300, Leonardo Bras wrote: > > For CONFIG_LINUX, implement the new zero copy flag and the optional callback > > io_flush on QIOChannelSocket, but enables it only when MSG_ZEROCOPY > > feature is availa

Re: [PATCH v11 2/7] QIOChannelSocket: Implement io_writev zero copy flag & io_flush for CONFIG_LINUX

2022-05-05 Thread Leonardo Bras Soares Passos
On Thu, May 5, 2022 at 12:55 PM Daniel P. Berrangé wrote: > > On Thu, May 05, 2022 at 12:42:47PM -0300, Leonardo Bras Soares Passos wrote: > > > > Hello Daniel, > > > > But what if this gets compiled in a Linux system without MSG_ZEROCOPY > > support? > &

Re: [External] [PATCH v13 3/8] QIOChannelSocket: Implement io_writev zero copy flag & io_flush for CONFIG_LINUX

2022-06-07 Thread Leonardo Bras Soares Passos
Hello 徐闯, Thanks for reviewing! On Wed, Jun 1, 2022 at 6:37 AM 徐闯 wrote: [...] > Hi, Leonardo. I'm also paying attention to the application of > MSG_ZEROCOPY in live migration recently. I noticed that you defined a > member `zero_copy_queued` in the struct QIOChannelSocket, but I can't > find ou

Re: [External] [PATCH v13 3/8] QIOChannelSocket: Implement io_writev zero copy flag & io_flush for CONFIG_LINUX

2022-06-08 Thread Leonardo Bras Soares Passos
Hello Peter, On Wed, Jun 1, 2022 at 10:58 AM Peter Xu wrote: > [...] > > Hi, Leonardo. I'm also paying attention to the application of MSG_ZEROCOPY > > in live migration recently. I noticed that you defined a member > > `zero_copy_queued` in the struct QIOChannelSocket, but I can't find out > > w

Re: [External] [PATCH v13 3/8] QIOChannelSocket: Implement io_writev zero copy flag & io_flush for CONFIG_LINUX

2022-06-08 Thread Leonardo Bras Soares Passos
On Wed, Jun 8, 2022 at 8:41 AM Peter Xu wrote: > > On Wed, Jun 08, 2022 at 02:37:28AM -0300, Leonardo Bras Soares Passos wrote: > > (1) is not an option, as the interface currently uses ret=1 to make > > sure MSG_ZEROCOPY is getting used, > > I added that so the user of qi

Re: [External] [PATCH v13 3/8] QIOChannelSocket: Implement io_writev zero copy flag & io_flush for CONFIG_LINUX

2022-06-13 Thread Leonardo Bras Soares Passos
Hello Peter, On Wed, Jun 8, 2022 at 5:23 PM Peter Xu wrote: [...] > > In a previous iteration of the patchset, it was made clear that it's > > desirable to detect when the kernel falls back to copying mechanism, > > so the user of 'QIOChannelSocket' can switch to copying and avoid the > > overhea

Re: [External] [PATCH v13 3/8] QIOChannelSocket: Implement io_writev zero copy flag & io_flush for CONFIG_LINUX

2022-06-13 Thread Leonardo Bras Soares Passos
On Mon, Jun 13, 2022 at 7:53 PM Peter Xu wrote: > > On Mon, Jun 13, 2022 at 05:58:44PM -0300, Leonardo Bras Soares Passos wrote: > > Hello Peter, > > > > On Wed, Jun 8, 2022 at 5:23 PM Peter Xu wrote: > > [...] > > > > In a previous iteration of

Re: [PATCH v2 02/16] migration: Correct transferred bytes value

2023-05-26 Thread Leonardo Bras Soares Passos
On Fri, May 26, 2023 at 5:04 AM Juan Quintela wrote: > > Leonardo Brás wrote: > > On Mon, 2023-05-15 at 21:56 +0200, Juan Quintela wrote: > >> We forget several places to add to trasferred amount of data. With > >> this fixes I get: > >> > >>qemu_file_transferred() + multifd_bytes == transfe

Re: [PATCH v2 03/16] migration: Move setup_time to mig_stats

2023-05-26 Thread Leonardo Bras Soares Passos
On Fri, May 26, 2023 at 5:07 AM Juan Quintela wrote: > > Leonardo Brás wrote: > > On Mon, 2023-05-15 at 21:56 +0200, Juan Quintela wrote: > >> It is a time that needs to be cleaned each time cancel migration. > >> Once there create migration_time_since() to calculate how time since a > >> time in

Re: [PATCH v2 04/16] qemu-file: Account for rate_limit usage on qemu_fflush()

2023-05-26 Thread Leonardo Bras Soares Passos
On Fri, May 26, 2023 at 5:09 AM Juan Quintela wrote: > > Leonardo Brás wrote: > > On Mon, 2023-05-15 at 21:56 +0200, Juan Quintela wrote: > >> That is the moment we know we have transferred something. > >> > >> Signed-off-by: Juan Quintela > >> Reviewed-by: Cédric Le Goater > >> --- > >> migra

Re: [PATCH v2 08/16] migration: Use migration_transferred_bytes() to calculate rate_limit

2023-05-26 Thread Leonardo Bras Soares Passos
On Fri, May 26, 2023 at 5:17 AM Juan Quintela wrote: > > Leonardo Brás wrote: > > On Mon, 2023-05-15 at 21:57 +0200, Juan Quintela wrote: > >> Signed-off-by: Juan Quintela > >> Reviewed-by: Cédric Le Goater > >> --- > >> migration/migration-stats.h | 8 +++- > >> migration/migration-stats.

Re: [PATCH v2 09/16] migration: We don't need the field rate_limit_used anymore

2023-05-26 Thread Leonardo Bras Soares Passos
On Fri, May 26, 2023 at 5:18 AM Juan Quintela wrote: > > Leonardo Brás wrote: > > On Mon, 2023-05-15 at 21:57 +0200, Juan Quintela wrote: > >> Since previous commit, we calculate how much data we have send with > >> migration_transferred_bytes() so no need to maintain this counter and > >> rememb

Re: [PATCH v2 15/16] migration/rdma: Simplify the function that saves a page

2023-05-26 Thread Leonardo Bras Soares Passos
On Fri, May 26, 2023 at 5:21 AM Juan Quintela wrote: > > Leonardo Brás wrote: > > On Mon, 2023-05-15 at 21:57 +0200, Juan Quintela wrote: > >> When we sent a page through QEMUFile hooks (RDMA) there are three > >> posiblities: > >> - We are not using RDMA. return RAM_SAVE_CONTROL_DELAYED and > >>

Re: [PATCH v2 16/16] migration/multifd: Compute transferred bytes correctly

2023-05-26 Thread Leonardo Bras Soares Passos
On Fri, May 26, 2023 at 5:24 AM Juan Quintela wrote: > > Leonardo Brás wrote: > > On Mon, 2023-05-15 at 21:57 +0200, Juan Quintela wrote: > >> In the past, we had to put the in the main thread all the operations > >> related with sizes due to qemu_file not beeing thread safe. As now > >> all cou