#3000 closed defect (fixed)

Setting interrupt level in the mode arg on SMP returns RTEMS_UNSATISFIED

Reported by: Chris Johns Owned by: Joel Sherrill
Priority: normal Milestone: 5.1
Component: score Version: 5
Severity: normal Keywords:
Cc: Blocked By:
Blocking:

Description (last modified by Chris Johns)

If for any reason a user sets the interrupt level in the mode on an SMP build the error RTEMS_UNSATISFIED is returned. The documentation indicates this is a lack of stack and this confusing.

The reason this happens is the SMP check for an interrupt level being set is in the score's _Thread_Initialize. I propose that and is_preemptible check be converted to an assert and checks be added to the Classic API to catch these errors and report suitable error codes.

There is no meaningful error code available without abusing an existing one so I propose adding RTEMS_INVALID_MODE.

Change History (19)

comment:1 Changed on Apr 19, 2017 at 3:28:50 AM by Joel Sherrill

I think this is a generally a good idea but there are a number of pieces to do this completely:

  • the status has to also be returned by rtems_task_mode()
  • add status to list in rtems status to string
  • add status to list in Ada binding. Should be mechanical.
  • add status to status table in Classic API manual
  • add new status to rtems_task_create() documentation
  • add new status to rtems_task_mode() documentation
  • add test for rtems_task_create() new error
  • add test for rtems_task_mode() new error

I am unsure if the assert() is debug mode only. That needs to be clarified.

Sorry to be pedantic with the list but this looks like the type of change that is small but has tentacles that would be easy to miss pieces. I suspect my list isn't complete yet.

comment:2 in reply to:  1 Changed on Apr 19, 2017 at 4:42:23 AM by Chris Johns

Replying to Joel Sherrill:

I think this is a generally a good idea but there are a number of pieces to do this completely:

Great and yes.

  • the status has to also be returned by rtems_task_mode()

OK.

  • add status to list in rtems status to string

Done in the posted patch.

  • add status to list in Ada binding. Should be mechanical.

Is there any documentation on how to do this?

Answer: Edit rtems.ads and add it. It is just an enumerated
list. You won't have trouble. c/src/ada/rtems.ads around line
353.

  • add status to status table in Classic API manual
  • add new status to rtems_task_create() documentation
  • add new status to rtems_task_mode() documentation

I will create a docs patch once I have a suitable patch for master.

  • add test for rtems_task_create() new error
  • add test for rtems_task_mode() new error

Yes however the tests are only running in the single core mode even when built with SMP so the error is not able to be tripped.

ANSWER: Sounds like a new SMP test is needed.

I am unsure if the assert() is debug mode only. That needs to be clarified.

That is correct. The assert's catch a bug in a user of the score API when built with RTEMS_DEBUG. The users of the call need to protect the score thread initialise call.

Sorry to be pedantic with the list but this looks like the type of change that is small but has tentacles that would be easy to miss pieces. I suspect my list isn't complete yet.

This looks the list to me.

Last edited on Apr 19, 2017 at 6:43:19 PM by Joel Sherrill (previous) (diff)

comment:3 Changed on May 2, 2017 at 5:34:57 AM by Sebastian Huber

See smpunsupported01 test.

comment:4 in reply to:  3 ; Changed on May 2, 2017 at 6:28:22 AM by Chris Johns

Replying to Sebastian Huber:

See smpunsupported01 test.

What what? Could you please elaborate a little more?

Thanks

comment:5 in reply to:  4 Changed on May 2, 2017 at 6:54:04 AM by Sebastian Huber

Replying to Chris Johns:

Replying to Sebastian Huber:

See smpunsupported01 test.

What what? Could you please elaborate a little more?

This is the test program the new error cases should be added.

comment:6 Changed on Oct 12, 2017 at 5:46:04 PM by Chris Johns

Description: modified (diff)

comment:7 Changed on Oct 12, 2017 at 6:46:16 PM by Joel Sherrill

Updated work list:

  • Whine that this was easier to report than to fix.
  • CPUKit Changes
    • (PREVIOUSLY COMMITTED) Add status to enumeration
    • (PREVIOUSLY COMMITTED) Add status to list in rtems status to string
    • (PREVIOUSLY COMMITTED) Add status to list in Ada binding. Should be mechanical
    • (PREVIOUSLY COMMITTED) Add both error checks to rtems_task_create()
    • (CLEAN UP PASS) Add both error checks to rtems_task_mode()
  • Documentation
    • (ADDED) Add status to status table in Classic API manual
    • (ADDED) Add new status to rtems_task_create() documentation
    • (ADDED) Add new status to rtems_task_mode() documentation
  • Testing
    • (PREVIOUSLY COMMITTED) Add rtems_task_create() test case(s) to smpunsupported01
    • (ONE PREVIOUSLY COMMITTED, ONE ADDED) Add rtems_task_mode() test case(s) to smpunsupported01

Patches for "CLEAN UP PASS" and "ADDED" submitted to devel@ mailing list. Pending review to be committed and close this.

Last edited on Dec 5, 2017 at 4:22:29 PM by Joel Sherrill (previous) (diff)

comment:8 Changed on Oct 12, 2017 at 6:51:18 PM by Joel Sherrill

Owner: changed from Chris Johns to Joel Sherrill

comment:9 Changed on Nov 9, 2017 at 6:27:14 AM by Sebastian Huber

Milestone: 4.12.05.1

Milestone renamed

comment:10 Changed on Dec 6, 2017 at 6:49:12 PM by Joel Sherrill <joel@…>

In e9e0f1d4/rtems:

smpunsupported01: Add missing error check for rtems_task_mode

Update test documentation to include more cases.

Updates #3000.

comment:11 Changed on Dec 6, 2017 at 6:49:57 PM by Joel Sherrill <joel@…>

Resolution: fixed
Status: assignedclosed

In 3079455/rtems-docs:

Account for non-preemption and interrupt level not supported on SMP

Closes #3000.

comment:12 Changed on Dec 7, 2017 at 8:22:31 AM by Sebastian Huber

Resolution: fixed
Status: closedreopened

Tests tm04 and tm20 fail now with --enable-smp.

comment:13 Changed on Dec 8, 2017 at 6:16:34 PM by Joel Sherrill <joel@…>

In 1307e75/rtems:

tm08: Do not use RTEMS_INTERRUPT_MASK for no reschedule case

Updates #3000.

comment:14 Changed on Jan 19, 2018 at 6:46:33 AM by Sebastian Huber <sebastian.huber@…>

In a5b4db4b/rtems:

rtems: Fix rtems_task_mode()

A rtems_configuration_is_smp_enabled() inside a !defined( RTEMS_SMP)
block makes no sense.

Remove !defined( RTEMS_SMP ) conditions.

Test tm04 works now again.

Update #3000.

comment:15 Changed on Apr 13, 2018 at 1:46:14 AM by Chris Johns

Can this ticket be closed? If it cannot be closed what is outstanding to be done?

comment:16 Changed on Oct 14, 2018 at 12:29:16 AM by Joel Sherrill

Resolution: fixed
Status: reopenedclosed

comment:17 Changed on Jan 9, 2019 at 9:37:11 AM by Sebastian Huber <sebastian.huber@…>

In 38cb59e/rtems:

Separate task mode checks

Update #3000.

comment:18 Changed on Jan 9, 2019 at 9:37:14 AM by Sebastian Huber <sebastian.huber@…>

In 1f285186/rtems:

rtems: Allow to set ISR level 0 in SMP config

Update #3000.

comment:19 Changed on Jan 9, 2019 at 9:37:17 AM by Sebastian Huber <sebastian.huber@…>

In 3bd39999/rtems:

Adjust interrupt mode tests for some CPU ports

In case the robust thread dispatch is enabled by the CPU port, then the
interrupt level must not be changed through the task mode.

Update #3000.

Note: See TracTickets for help on using tickets.