From: Peter Xu <peterx@redhat.com>
To: Yichen Wang <yichen.wang@bytedance.com>
Cc: "Fabiano Rosas" <farosas@suse.de>,
"Dr. David Alan Gilbert" <dave@treblig.org>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Daniel P. Berrangé" <berrange@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Eric Blake" <eblake@redhat.com>,
"Markus Armbruster" <armbru@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Cornelia Huck" <cohuck@redhat.com>,
qemu-devel@nongnu.org, "Hao Xiang" <hao.xiang@linux.dev>,
"Liu, Yuan1" <yuan1.liu@intel.com>,
"Shivam Kumar" <shivam.kumar1@nutanix.com>,
"Ho-Ren (Jack) Chuang" <horenchuang@bytedance.com>
Subject: Re: [PATCH v8 08/12] migration/multifd: Add new migration option for multifd DSA offloading.
Date: Tue, 24 Dec 2024 11:53:31 -0500 [thread overview]
Message-ID: <Z2rnC8HHVOMkie9h@x1n> (raw)
In-Reply-To: <CAHObMVaaLAJZcQbDYKBr0nddvKeY1L=Nf8HjqN7CNd3Z3chfaA@mail.gmail.com>
On Mon, Dec 23, 2024 at 11:11:46PM -0800, Yichen Wang wrote:
> > @@ -563,6 +572,15 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDict *qdict)
> > p->has_x_checkpoint_delay = true;
> > visit_type_uint32(v, param, &p->x_checkpoint_delay, &err);
> > break;
> > + case MIGRATION_PARAMETER_ACCEL_PATH:
> > + p->has_accel_path = true;
> > + char **strv = g_strsplit(valuestr ? : "", " ", -1);
> > + strList **tail = &p->accel_path;
> > + for (int i = 0; strv[i]; i++) {
> > + QAPI_LIST_APPEND(tail, strv[i]);
> > + }
> > + g_strfreev(strv);
> > + break;
>
> I am doing my final testing, and seeing a new issue for above. This
> code doesn't really work, because strv is freed and all contents after
> the string split are gone. So here is what I am thinking:
>
> 1. This is supposed to be an easy visit_type_strList(v, param,
> &p->accel_path, &err), but it actually doesn't work. The code will
> throw:
> qemu-system-x86_64.dsa: ../../../qapi/string-input-visitor.c:343:
> parse_type_str: Assertion `siv->lm == LM_NONE' failed.
> when you are doing "migrate_set_parameter accel-path
> dsa:/dev/dsa/wq0.1" from HMP.
IIUC that's for JSON only.
>
> 2. If I remove the g_strfreev(strv), things are working perfectly. But
> I am worried about the memory leak here. As technically if you keep
> doing migrate_set_parameter for say 1 million times, memory will be
> exhausted.
Right, better not leak mem. Can you dup the str when constructing the
artifact? I mean something like:
- QAPI_LIST_APPEND(tail, strv[i]);
+ QAPI_LIST_APPEND(tail, g_strdup(strv[i]));
Thanks,
--
Peter Xu
next prev parent reply other threads:[~2024-12-24 16:54 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-04 2:11 [PATCH v8 00/12] Use Intel DSA accelerator to offload zero page checking in multifd live migration Yichen Wang
2024-12-04 2:11 ` [PATCH v8 01/12] meson: Introduce new instruction set enqcmd to the build system Yichen Wang
2024-12-04 2:11 ` [PATCH v8 02/12] util/dsa: Add idxd into linux header copy list Yichen Wang
2024-12-04 2:11 ` [PATCH v8 03/12] util/dsa: Implement DSA device start and stop logic Yichen Wang
2024-12-17 17:03 ` Fabiano Rosas
2024-12-04 2:11 ` [PATCH v8 04/12] util/dsa: Implement DSA task enqueue and dequeue Yichen Wang
2024-12-04 2:11 ` [PATCH v8 05/12] util/dsa: Implement DSA task asynchronous completion thread model Yichen Wang
2024-12-04 2:11 ` [PATCH v8 06/12] util/dsa: Implement zero page checking in DSA task Yichen Wang
2024-12-17 17:11 ` Fabiano Rosas
2024-12-04 2:11 ` [PATCH v8 07/12] util/dsa: Implement DSA task asynchronous submission and wait for completion Yichen Wang
2024-12-17 17:12 ` Fabiano Rosas
2024-12-04 2:11 ` [PATCH v8 08/12] migration/multifd: Add new migration option for multifd DSA offloading Yichen Wang
2024-12-17 17:51 ` Fabiano Rosas
2024-12-24 7:11 ` Yichen Wang
2024-12-24 16:53 ` Peter Xu [this message]
2024-12-04 2:11 ` [PATCH v8 09/12] migration/multifd: Enable DSA offloading in multifd sender path Yichen Wang
2024-12-17 17:56 ` Fabiano Rosas
2024-12-20 5:46 ` [External] " Yichen Wang
2024-12-20 12:29 ` Fabiano Rosas
2024-12-04 2:11 ` [PATCH v8 10/12] util/dsa: Add unit test coverage for Intel DSA task submission and completion Yichen Wang
2024-12-17 18:07 ` Fabiano Rosas
2024-12-04 2:11 ` [PATCH v8 11/12] migration/multifd: Add integration tests for multifd with Intel DSA offloading Yichen Wang
2024-12-04 2:11 ` [PATCH v8 12/12] migration/doc: Add DSA zero page detection doc Yichen Wang
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=Z2rnC8HHVOMkie9h@x1n \
--to=peterx@redhat.com \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=cohuck@redhat.com \
--cc=dave@treblig.org \
--cc=eblake@redhat.com \
--cc=farosas@suse.de \
--cc=hao.xiang@linux.dev \
--cc=horenchuang@bytedance.com \
--cc=marcandre.lureau@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=shivam.kumar1@nutanix.com \
--cc=yichen.wang@bytedance.com \
--cc=yuan1.liu@intel.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: 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.