All of lore.kernel.org
 help / color / mirror / Atom feed
From: Philippe Gerum <rpm@xenomai.org>
To: Philippe Gerum <rpm@xenomai.org>
Cc: 87ed9urpex.fsf@xenomai.org, xenomai@lists.linux.dev
Subject: Re: A problem regarding SMP
Date: Thu, 23 May 2024 10:04:07 +0200	[thread overview]
Message-ID: <87msohrm1a.fsf@xenomai.org> (raw)
In-Reply-To: <87r0dtrmbe.fsf@xenomai.org>


Philippe Gerum <rpm@xenomai.org> writes:

> 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.

This said, I agree that the current implementation of evl_wait_flag()
prevents broadcast, which is wrong.

-- 
Philippe.

  reply	other threads:[~2024-05-23  8:05 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
2024-05-23  8:04   ` Philippe Gerum [this message]
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=87msohrm1a.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.