From: Fabiano Rosas <farosas@suse.de>
To: Peter Xu <peterx@redhat.com>
Cc: Trieu Huynh <vikingtc4@gmail.com>, qemu-devel@nongnu.org
Subject: Re: [PATCH 1/1] migration/multifd: fix channel count TOCTOU race on cancel and retry
Date: Thu, 23 Apr 2026 16:41:39 -0300 [thread overview]
Message-ID: <87fr4lea6k.fsf@suse.de> (raw)
In-Reply-To: <aepokJ2N1w7fA2Ye@x1.local>
Peter Xu <peterx@redhat.com> writes:
> On Thu, Apr 23, 2026 at 03:13:42PM -0300, Fabiano Rosas wrote:
>> Looking again at this argument I put (too many variables), I notice we
>> also have multifd_send_state->channels_ready and
>
> channels_ready seems to be special? In busy systems I think it should
> normally always be less than the number of threads on sender side, because
> some of them will be busy.
>
Argh, sorry, I meant channels_created!
>> multifd_recv_state->count, both of which should contain the right number
>
> This one is used so far to just count how many channels are established on
> dest side. Logically after setup phase it can be gone. It's just not hurt
> to be available until cleanups.
>
>> of channels after multifd_send_setup() and migration_start_incoming(),
>> respectively. Maybe we could unify all of this into a single semaphore
>> used in both sides and take the semaphore count as number of
>> channels. @Peter, do you think it's worth it?
>
> My memory is reading counter from a sem isn't always reliable. I always
> only use sem as thread-safety purpose primitives.
>
> So if I was correct on channels_ready above, then it may not apply on the
> idea to merge. We're essentially trying to save one 8B for ->count.. and
> it can only be gone after it's finished its use (IOW, we still need it to
> work before recv side setup).
>
> Just leave them as-is?
next prev parent reply other threads:[~2026-04-23 19:42 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-22 16:12 [PATCH 0/1] migration/multifd: fix channel count TOCTOU race on cancel and retry Trieu Huynh
2026-04-22 16:12 ` [PATCH 1/1] " Trieu Huynh
2026-04-22 22:30 ` Fabiano Rosas
2026-04-23 16:14 ` Peter Xu
2026-04-23 18:13 ` Fabiano Rosas
2026-04-23 18:44 ` Peter Xu
2026-04-23 19:41 ` Fabiano Rosas [this message]
2026-04-24 13:53 ` Peter Xu
2026-04-24 14:15 ` Fabiano Rosas
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=87fr4lea6k.fsf@suse.de \
--to=farosas@suse.de \
--cc=peterx@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=vikingtc4@gmail.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.