All of lore.kernel.org
 help / color / mirror / Atom feed
From: hao.xiang@linux.dev
To: Jonathan.Cameron@huawei.com
Cc: farosas@suse.de, peter.maydell@linaro.org, peterx@redhat.com,
	marcandre.lureau@redhat.com, bryan.zhang@bytedance.com,
	qemu-devel@nongnu.org
Subject: Re: [External] Re: [PATCH v3 11/20] util/dsa: Implement DSA task asynchronous submission and wait for completion.
Date: Fri, 08 Mar 2024 21:50:58 +0000	[thread overview]
Message-ID: <d95728dfd166c9291eeb022e4a49d27c6c6c075c@linux.dev> (raw)
In-Reply-To: <CAAYibXhSdeTod4VNyE5ZsZAjQteRdBZEhh5UieNs8s6Ji+X5og@mail.gmail.com>

> 
> On Fri, Mar 8, 2024 at 2:11 AM Jonathan Cameron
> 
> <Jonathan.Cameron@huawei.com> wrote:
> 
> > 
> > On Thu, 4 Jan 2024 00:44:43 +0000
> > 
> >  Hao Xiang <hao.xiang@bytedance.com> wrote:
> > 
> >  * Add a DSA task completion callback.
> > 
> >  * DSA completion thread will call the tasks's completion callback
> > 
> >  on every task/batch task completion.
> > 
> >  * DSA submission path to wait for completion.
> > 
> >  * Implement CPU fallback if DSA is not able to complete the task.
> > 
> >  Signed-off-by: Hao Xiang <hao.xiang@bytedance.com>
> > 
> >  Signed-off-by: Bryan Zhang <bryan.zhang@bytedance.com>
> > 
> >  Hi,
> > 
> >  One naming comment inline. You had me confused on how you were handling async
> > 
> >  processing at where this is used. Answer is that I think you aren't!
> > 
> >  +/**
> > 
> >  + * @brief Performs buffer zero comparison on a DSA batch task asynchronously.
> > 
> >  The hardware may be doing it asynchronously but unless that
> > 
> >  buffer_zero_dsa_wait() call doesn't do what it's name suggests, this function
> > 
> >  is wrapping the async hardware related stuff to make it synchronous.
> > 
> >  So name it buffer_is_zero_dsa_batch_sync()!
> > 
> >  Jonathan


Thanks for reviewing this. The first completion model I tried was to use a busy loop to pull for completion on the submission thread but it turns out to have too much unnecessary overhead. Think about 10 threads all submitting tasks and we end up having 10 busy loops. I moved the completion work to a dedicated thread and named it async! However, the async model doesn't fit well with the current live migration thread model so eventually I added a wait on the submission thread. It was intended to be async but I agree that it is not currently. I will rename it in the next revision.

> > 
> >  + *
> > 
> >  + * @param batch_task A pointer to the batch task.
> > 
> >  + * @param buf An array of memory buffers.
> > 
> >  + * @param count The number of buffers in the array.
> > 
> >  + * @param len The buffer length.
> > 
> >  + *
> > 
> >  + * @return Zero if successful, otherwise non-zero.
> > 
> >  + */
> > 
> >  +int
> > 
> >  +buffer_is_zero_dsa_batch_async(struct dsa_batch_task *batch_task,
> > 
> >  + const void **buf, size_t count, size_t len)
> > 
> >  +{
> > 
> >  + if (count <= 0 || count > batch_task->batch_size) {
> > 
> >  + return -1;
> > 
> >  + }
> > 
> >  +
> > 
> >  + assert(batch_task != NULL);
> > 
> >  + assert(len != 0);
> > 
> >  + assert(buf != NULL);
> > 
> >  +
> > 
> >  + if (count == 1) {
> > 
> >  + /* DSA doesn't take batch operation with only 1 task. */
> > 
> >  + buffer_zero_dsa_async(batch_task, buf[0], len);
> > 
> >  + } else {
> > 
> >  + buffer_zero_dsa_batch_async(batch_task, buf, count, len);
> > 
> >  + }
> > 
> >  +
> > 
> >  + buffer_zero_dsa_wait(batch_task);
> > 
> >  + buffer_zero_cpu_fallback(batch_task);
> > 
> >  +
> > 
> >  + return 0;
> > 
> >  +}
> > 
> >  +
> > 
> >  #endif
> >
>


  parent reply	other threads:[~2024-03-08 21:52 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-04  0:44 [PATCH v3 00/20] Use Intel DSA accelerator to offload zero page checking in multifd live migration Hao Xiang
2024-01-04  0:44 ` [PATCH v3 01/20] multifd: Add capability to enable/disable zero_page Hao Xiang
2024-01-08 20:39   ` Fabiano Rosas
2024-01-11  5:47     ` [External] " Hao Xiang
2024-01-15  6:02   ` Shivam Kumar
2024-01-23  0:33     ` [External] " Hao Xiang
2024-01-23 15:10       ` Fabiano Rosas
2024-01-23 21:00         ` Hao Xiang
2024-02-01  4:27         ` Peter Xu
2024-01-04  0:44 ` [PATCH v3 02/20] multifd: Support for zero pages transmission Hao Xiang
2024-01-04  0:44 ` [PATCH v3 03/20] multifd: Zero " Hao Xiang
2024-01-15  7:01   ` Shivam Kumar
2024-01-23  0:46     ` [External] " Hao Xiang
2024-02-01  5:22   ` Peter Xu
2024-02-01 23:24     ` [External] " Hao Xiang
2024-01-04  0:44 ` [PATCH v3 04/20] So we use multifd to transmit zero pages Hao Xiang
2024-01-04  0:44 ` [PATCH v3 05/20] meson: Introduce new instruction set enqcmd to the build system Hao Xiang
2024-01-04  0:44 ` [PATCH v3 06/20] util/dsa: Add dependency idxd Hao Xiang
2024-02-01  5:34   ` Peter Xu
2024-01-04  0:44 ` [PATCH v3 07/20] util/dsa: Implement DSA device start and stop logic Hao Xiang
2024-01-04  0:44 ` [PATCH v3 08/20] util/dsa: Implement DSA task enqueue and dequeue Hao Xiang
2024-01-04  0:44 ` [PATCH v3 09/20] util/dsa: Implement DSA task asynchronous completion thread model Hao Xiang
2024-01-04  0:44 ` [PATCH v3 10/20] util/dsa: Implement zero page checking in DSA task Hao Xiang
2024-01-04  0:44 ` [PATCH v3 11/20] util/dsa: Implement DSA task asynchronous submission and wait for completion Hao Xiang
2024-03-08 10:10   ` Jonathan Cameron via
     [not found]     ` <CAAYibXhSdeTod4VNyE5ZsZAjQteRdBZEhh5UieNs8s6Ji+X5og@mail.gmail.com>
2024-03-08 21:50       ` hao.xiang [this message]
2024-01-04  0:44 ` [PATCH v3 12/20] migration/multifd: Add new migration option for multifd DSA offloading Hao Xiang
2024-01-04  0:44 ` [PATCH v3 13/20] migration/multifd: Prepare to introduce DSA acceleration on the multifd path Hao Xiang
2024-01-15  6:46   ` Shivam Kumar
2024-01-23  0:37     ` [External] " Hao Xiang
2024-02-02 10:03       ` Peter Xu
2024-01-04  0:44 ` [PATCH v3 14/20] migration/multifd: Enable DSA offloading in multifd sender path Hao Xiang
2024-01-04  0:44 ` [PATCH v3 15/20] migration/multifd: Add test hook to set normal page ratio Hao Xiang
2024-02-01  5:24   ` Peter Xu
2024-02-01 23:10     ` [External] " Hao Xiang
2024-01-04  0:44 ` [PATCH v3 16/20] migration/multifd: Enable set normal page ratio test hook in multifd Hao Xiang
2024-01-04  0:44 ` [PATCH v3 17/20] migration/multifd: Add migration option set packet size Hao Xiang
2024-01-04  0:44 ` [PATCH v3 18/20] migration/multifd: Enable set packet size migration option Hao Xiang
2024-01-04  0:44 ` [PATCH v3 19/20] util/dsa: Add unit test coverage for Intel DSA task submission and completion Hao Xiang
2024-01-04  0:44 ` [PATCH v3 20/20] migration/multifd: Add integration tests for multifd with Intel DSA offloading Hao Xiang
2024-03-08  1:47 ` [PATCH v3 00/20] Use Intel DSA accelerator to offload zero page checking in multifd live migration liulongfang via

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=d95728dfd166c9291eeb022e4a49d27c6c6c075c@linux.dev \
    --to=hao.xiang@linux.dev \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=bryan.zhang@bytedance.com \
    --cc=farosas@suse.de \
    --cc=marcandre.lureau@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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: link
Be 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.