You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nuttx.apache.org by fft <ff...@feedforward.com.cn> on 2022/03/27 04:57:59 UTC
usleep can't wake up incidentally in tickless mode
Hi team,
I've been puzzled by a strange problem for a long time, when i use tickless OS mode on stm32f405, usleep can't wake up incidentally.
My config about tickless OS mode as shown below:
CONFIG_ARCH_HAVE_TICKLESS=y
CONFIG_SCHED_TICKLESS=y
# CONFIG_SCHED_TICKLESS_ALARM is not set
# CONFIG_SCHED_TICKLESS_LIMIT_MAX_SLEEP is not set
CONFIG_USEC_PER_TICK=10
# CONFIG_STM32_TICKLESS_SYSTICK is not set
CONFIG_STM32_TICKLESS_TIMER=2
CONFIG_STM32_TICKLESS_CHANNEL=1
When use usleep(1000) in a pthread A, then thread A maybe sporadic sleep dead and can't be wake up, the probability is about 1/100000.
Moreover, when the problem happened, if i execute usleep 10000 in NSH terminus, then thread A will wakeup. Is my configuration incorrect?
Does anyone else have the same problem?
Best regard
Zou
Re: usleep can't wake up incidentally in tickless mode
Posted by fft <ff...@feedforward.com.cn>.
Hi Alan,
I'm tried enable the CONFIG_PRIORITY_INHERITANCE and the problem remains, thanks for your reply
Best regard
Zou
------------------ Original ------------------
From: "Alan Carvalho de Assis"<acassis@gmail.com>;
Date: Sun, Mar 27, 2022 10:11 PM
To: "dev"<dev@nuttx.apache.org>;
Subject: Re: usleep can't wake up incidentally in tickless mode
Zou,
just a think that passed on my mind:
try to enable the CONFIG_PRIORITY_INHERITANCE and let us know if the
issue will happen again in this case.
BR,
Alan
On 3/27/22, Alan Carvalho de Assis <acassis@gmail.com> wrote:
> Hi Zou,
>
> Is there some way to identify that thread A didn't wake up and create
> some unity test to report and to analyze it?
>
> Maybe there is some very specific race condition that we never saw before.
>
> BR,
>
> Alan
>
> On 3/27/22, fft <fft@feedforward.com.cn> wrote:
>> Hi team,
>>
>>
>> I've been puzzled by a strange problem for a long time, when i use
>> tickless
>> OS mode on stm32f405, usleep can't wake up incidentally.
>>
>> My config about tickless OS mode as shown below:
>>
>>
>> CONFIG_ARCH_HAVE_TICKLESS=y
>> CONFIG_SCHED_TICKLESS=y
>> # CONFIG_SCHED_TICKLESS_ALARM is not set
>> # CONFIG_SCHED_TICKLESS_LIMIT_MAX_SLEEP is not set
>> CONFIG_USEC_PER_TICK=10
>>
>> # CONFIG_STM32_TICKLESS_SYSTICK is not set
>>
>> CONFIG_STM32_TICKLESS_TIMER=2
>> CONFIG_STM32_TICKLESS_CHANNEL=1
>>
>>
>> When use usleep(1000) in a pthread A, then thread A maybe sporadic sleep
>> dead and can't be wake up, the probability is about 1/100000.
>> Moreover, when the problem happened, if i execute usleep 10000 in NSH
>> terminus, then thread A will wakeup. Is my configuration incorrect?
>>
>> Does anyone else have the same problem?
>>
>>
>> Best regard
>> Zou
>
Re: usleep can't wake up incidentally in tickless mode
Posted by Alan Carvalho de Assis <ac...@gmail.com>.
Zou,
just a think that passed on my mind:
try to enable the CONFIG_PRIORITY_INHERITANCE and let us know if the
issue will happen again in this case.
BR,
Alan
On 3/27/22, Alan Carvalho de Assis <ac...@gmail.com> wrote:
> Hi Zou,
>
> Is there some way to identify that thread A didn't wake up and create
> some unity test to report and to analyze it?
>
> Maybe there is some very specific race condition that we never saw before.
>
> BR,
>
> Alan
>
> On 3/27/22, fft <ff...@feedforward.com.cn> wrote:
>> Hi team,
>>
>>
>> I've been puzzled by a strange problem for a long time, when i use
>> tickless
>> OS mode on stm32f405, usleep can't wake up incidentally.
>>
>> My config about tickless OS mode as shown below:
>>
>>
>> CONFIG_ARCH_HAVE_TICKLESS=y
>> CONFIG_SCHED_TICKLESS=y
>> # CONFIG_SCHED_TICKLESS_ALARM is not set
>> # CONFIG_SCHED_TICKLESS_LIMIT_MAX_SLEEP is not set
>> CONFIG_USEC_PER_TICK=10
>>
>> # CONFIG_STM32_TICKLESS_SYSTICK is not set
>>
>> CONFIG_STM32_TICKLESS_TIMER=2
>> CONFIG_STM32_TICKLESS_CHANNEL=1
>>
>>
>> When use usleep(1000) in a pthread A, then thread A maybe sporadic sleep
>> dead and can't be wake up, the probability is about 1/100000.
>> Moreover, when the problem happened, if i execute usleep 10000 in NSH
>> terminus, then thread A will wakeup. Is my configuration incorrect?
>>
>> Does anyone else have the same problem?
>>
>>
>> Best regard
>> Zou
>
Re: usleep can't wake up incidentally in tickless mode
Posted by Alan Carvalho de Assis <ac...@gmail.com>.
Hi Zou,
Is there some way to identify that thread A didn't wake up and create
some unity test to report and to analyze it?
Maybe there is some very specific race condition that we never saw before.
BR,
Alan
On 3/27/22, fft <ff...@feedforward.com.cn> wrote:
> Hi team,
>
>
> I've been puzzled by a strange problem for a long time, when i use tickless
> OS mode on stm32f405, usleep can't wake up incidentally.
>
> My config about tickless OS mode as shown below:
>
>
> CONFIG_ARCH_HAVE_TICKLESS=y
> CONFIG_SCHED_TICKLESS=y
> # CONFIG_SCHED_TICKLESS_ALARM is not set
> # CONFIG_SCHED_TICKLESS_LIMIT_MAX_SLEEP is not set
> CONFIG_USEC_PER_TICK=10
>
> # CONFIG_STM32_TICKLESS_SYSTICK is not set
>
> CONFIG_STM32_TICKLESS_TIMER=2
> CONFIG_STM32_TICKLESS_CHANNEL=1
>
>
> When use usleep(1000) in a pthread A, then thread A maybe sporadic sleep
> dead and can't be wake up, the probability is about 1/100000.
> Moreover, when the problem happened, if i execute usleep 10000 in NSH
> terminus, then thread A will wakeup. Is my configuration incorrect?
>
> Does anyone else have the same problem?
>
>
> Best regard
> Zou