ch.rlist initialization with CH_CFG_NO_IDLE_THREAD Topic is solved

Report here problems in any of ChibiOS components. This forum is NOT for support.
lungj
Posts: 8
Joined: Wed Feb 03, 2016 7:57 am
Been thanked: 1 time

ch.rlist initialization with CH_CFG_NO_IDLE_THREAD  Topic is solved

Postby lungj » Wed Apr 13, 2016 11:46 pm

It looks like if CH_CFG_NO_IDLE_THREAD is enabled, the thread ready list's next/prev values are set incorrectly. This causes problems when attempting to sleep: an invalid thread address is selected as the next element by queue_fifo_remove in chSchGoSleepS. Is this behaviour intentional?

Code: Select all

int main(void) {
   halInit();
   chSysInit();

   while(1) {
      chThdSleepMilliseconds(1000); // This fails if CH_CFG_NO_IDLE_THREAD is TRUE.
   }
   return 0;
}

User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: ch.rlist initialization with CH_CFG_NO_IDLE_THREAD

Postby Giovanni » Thu Apr 14, 2016 7:54 am

Hi,

When CH_CFG_NO_IDLE_THREAD is enabled then the main() function is the idle thread, you must never try to sleep in there. Doing so causes the problems you are describing.

Giovanni

faisal
Posts: 374
Joined: Wed Jul 19, 2017 12:44 am
Has thanked: 44 times
Been thanked: 60 times

Re: ch.rlist initialization with CH_CFG_NO_IDLE_THREAD

Postby faisal » Wed Apr 10, 2019 7:08 pm

Giovanni wrote:Hi,

When CH_CFG_NO_IDLE_THREAD is enabled then the main() function is the idle thread, you must never try to sleep in there. Doing so causes the problems you are describing.

Giovanni


Is this still the case? If so, there should be an assert somewhere to catch this. I think chSchGoSleepS is the right place.

User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: ch.rlist initialization with CH_CFG_NO_IDLE_THREAD

Postby Giovanni » Wed Apr 10, 2019 8:57 pm

Yes, an assertion is a good idea.

Giovanni

Dzarda
Posts: 21
Joined: Sat Feb 28, 2015 2:28 pm
Location: Brno, Czech Republic
Has thanked: 7 times
Been thanked: 5 times

Re: ch.rlist initialization with CH_CFG_NO_IDLE_THREAD

Postby Dzarda » Thu Jan 07, 2021 2:06 pm

I got burned by this again, I think that an assertion should be very suitable.

User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: ch.rlist initialization with CH_CFG_NO_IDLE_THREAD

Postby Giovanni » Thu Jan 07, 2021 2:29 pm

Moving into "bug reports" so it is not lost in the noise.

Giovanni

User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: ch.rlist initialization with CH_CFG_NO_IDLE_THREAD

Postby Giovanni » Sat Feb 13, 2021 10:00 am

Hi,

Assertion added in thunk code.

Giovanni


Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 15 guests