[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v8 08/12] migration/multifd: Add new migration option for mul
From: |
Peter Xu |
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 |
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
- Re: [PATCH v8 03/12] util/dsa: Implement DSA device start and stop logic., (continued)
- [PATCH v8 04/12] util/dsa: Implement DSA task enqueue and dequeue., Yichen Wang, 2024/12/03
- [PATCH v8 05/12] util/dsa: Implement DSA task asynchronous completion thread model., Yichen Wang, 2024/12/03
- [PATCH v8 06/12] util/dsa: Implement zero page checking in DSA task., Yichen Wang, 2024/12/03
- [PATCH v8 07/12] util/dsa: Implement DSA task asynchronous submission and wait for completion., Yichen Wang, 2024/12/03
- [PATCH v8 08/12] migration/multifd: Add new migration option for multifd DSA offloading., Yichen Wang, 2024/12/03
- [PATCH v8 09/12] migration/multifd: Enable DSA offloading in multifd sender path., Yichen Wang, 2024/12/03
- [PATCH v8 10/12] util/dsa: Add unit test coverage for Intel DSA task submission and completion., Yichen Wang, 2024/12/03
- [PATCH v8 11/12] migration/multifd: Add integration tests for multifd with Intel DSA offloading., Yichen Wang, 2024/12/03
- [PATCH v8 12/12] migration/doc: Add DSA zero page detection doc, Yichen Wang, 2024/12/03