From: Philippe Gerum <rpm@xenomai.org>
To: 87ed9urpex.fsf@xenomai.org
Cc: xenomai@lists.linux.dev
Subject: Re: A problem regarding SMP
Date: Thu, 23 May 2024 09:52:06 +0200 [thread overview]
Message-ID: <87r0dtrmbe.fsf@xenomai.org> (raw)
In-Reply-To: <Zk68Q+2tgdwEkcS9@2956c958a175>
JiajunDu <wonderboy512@163.com> writes:
> Thanks for your reply!
>
> By using a barrier to synchronize all evl kthreads, I did achieve the
> effect of multiple processes running in parallel. My solution is
> in the next patch, and the branch I tried on is the latest
> `v5.13-evl-rebase`.
>
> But I still ran into two other problems while trying this solution.
>
> The first problem is that `evl_flag` cann't solve the problem. The wait
> condition in `evl_wait_flag_timeout` is `evl_read_flag`, in which the
> flag is set to false as soon as the flag is found to be raised in
> `evl_raise_flag`, so `evl_raise_flag` can only wake up one waiting process
> at a time. And it's not possible to wake up more processes by calling
> `evl_raise_flag` multiple times, because it's not possible to determine
> the time when processes are woken up in the SMP environment. If we did, it's
> possible to have a situation where two processes are woken up at the same
> time after the flag was raised twice, and then only one of them can be
> woken up at the same time. So in light of this, I defined two new functions,
> `evl_wait_flag_same` and `evl_wait_flag_timeout_same`, to read flags using
> `evl_peek_flag`.
The semantics you are looking for are available from evl_wait_queue,
which basically implements a condition variable.
>
> The second problem is that after using barrier, load balancing is no longer
> possible when creating processes using `kthread_run`, which is called in
> `evl_run_kthread`. The phenomenon is that all processes are created on the
> same CPU. Therefore, I can only specify CPUs manually for load balancing
> purpose by calling `evl_run_kthread_on_cpu`.
Which is not an issue, is it? Since dynamic load balancing is not
supported by design by evl (or any earlier xenomai cores for that
matter), static pinning is the way. So evl_run_kthread_on_cpu should
indeed be used. Another option would be that each spawned kthread pins
itself to the right CPU when emerging (set_cpus_allowed).
>
> The code I tried is available in the next patch. Is there anything we can do
> about these two problems?
>
> Best regards,
> Jiajun
--
Philippe.
next prev parent reply other threads:[~2024-05-23 7:59 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-23 3:47 A problem regarding SMP JiajunDu
2024-05-23 7:52 ` Philippe Gerum [this message]
2024-05-23 8:04 ` Philippe Gerum
2024-05-23 11:33 ` JiajunDu
2024-05-23 13:32 ` Philippe Gerum
-- strict thread matches above, loose matches on Subject: below --
2024-05-22 10:11 JiajunDu
2024-05-22 12:32 ` Philippe Gerum
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=87r0dtrmbe.fsf@xenomai.org \
--to=rpm@xenomai.org \
--cc=87ed9urpex.fsf@xenomai.org \
--cc=xenomai@lists.linux.dev \
/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.