All of lore.kernel.org
 help / color / mirror / Atom feed
* Sleep while holding a mutex
@ 2022-07-15 16:31 Russell Johnson
  2022-07-16 10:22 ` Philippe Gerum
  0 siblings, 1 reply; 3+ messages in thread
From: Russell Johnson @ 2022-07-15 16:31 UTC (permalink / raw)
  To: xenomai@lists.linux.dev


[-- Attachment #1.1: Type: text/plain, Size: 744 bytes --]

In one of my functions, I lock a mutex, call evl_timedwat_event(), and then
unlock the mutex. Whenever I call the timedwait, I get an error from the EVL
Core saying that there was a sleep while holding a mutex. I was following
the example on [1]. I also noticed under a test at [2] that there is a
comment saying to disable the T_WOLI mode on the thread because there will
be a sleep during a mutex. The test appears to verify the timedwait call. So
do I need to just ignore that error whenever I am using an EVL event? Or do
I have something else going wrong potentially?

 

[1] https://evlproject.org/core/user-api/event/

[2]
https://source.denx.de/Xenomai/xenomai4/libevl/-/blob/next/tests/monitor-eve
nt.c#L40

 

Thanks,

 

Russell

 


[-- Attachment #1.2: Type: text/html, Size: 2687 bytes --]

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 6759 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Sleep while holding a mutex
  2022-07-15 16:31 Sleep while holding a mutex Russell Johnson
@ 2022-07-16 10:22 ` Philippe Gerum
  2022-07-18 16:28   ` [External] - " Russell Johnson
  0 siblings, 1 reply; 3+ messages in thread
From: Philippe Gerum @ 2022-07-16 10:22 UTC (permalink / raw)
  To: Russell Johnson; +Cc: xenomai@lists.linux.dev


Russell Johnson <russell.johnson@kratosdefense.com> writes:

> [[S/MIME Signed Part:Undecided]]
> In one of my functions, I lock a mutex, call evl_timedwat_event(), and then unlock the mutex. Whenever I call the timedwait, I get an error from the EVL Core saying that there was a sleep while holding a mutex. I was following the example on [1]. I also noticed under a test at [2] that there is a comment saying to disable the T_WOLI mode on the thread because there will be a sleep during a mutex. The test appears to verify the timedwait
> call. So do I need to just ignore that error whenever I am using an EVL event? Or do I have something else going wrong potentially?
>
>  
>
> [1] https://evlproject.org/core/user-api/event/
>
> [2] https://source.denx.de/Xenomai/xenomai4/libevl/-/blob/next/tests/monitor-event.c#L40
>
>  
>
> Thanks,
>
>  
>
> Russell
>
> [[End of S/MIME Signed Part]]

The documentation is right, but the code is wrong. This patch fixes it:
https://source.denx.de/Xenomai/xenomai4/linux-evl/-/commit/1dc0d91aa3a5c2055fe8e492df0b229546d4f5da

The test suite was updated accordingly to check the right behavior:
https://source.denx.de/Xenomai/xenomai4/libevl/-/commit/1b30808a6b0095736c5e1059377e2cb07225e9f6

-- 
Philippe.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [External] - Re: Sleep while holding a mutex
  2022-07-16 10:22 ` Philippe Gerum
@ 2022-07-18 16:28   ` Russell Johnson
  0 siblings, 0 replies; 3+ messages in thread
From: Russell Johnson @ 2022-07-18 16:28 UTC (permalink / raw)
  To: Philippe Gerum; +Cc: xenomai@lists.linux.dev

[-- Attachment #1: Type: text/plain, Size: 214 bytes --]

Sounds good. I did notice when compiling the updated libevl that there was
an error with not using the return value of the write call in the sigdebug
handler in the updated test. Just a heads up.

Thanks,

Russell

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 6759 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-07-18 16:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-15 16:31 Sleep while holding a mutex Russell Johnson
2022-07-16 10:22 ` Philippe Gerum
2022-07-18 16:28   ` [External] - " Russell Johnson

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.