blob: 0cca6a18f9cc11eb7487bffd987dc768105ac57d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
copyrights:
- Copyright (C) 2021 embedded brains GmbH & Co. KG
enabled-by: RTEMS_SMP
links: []
test-actions:
- action-brief: |
Create one worker thread to validate the thread pinning on only one
processor using a uniprocessor scheduler.
action-code: |
Per_CPU_Control *cpu_self;
Thread_Control *executing;
executing = _Thread_Get_executing();
SetSelfPriority( PRIO_NORMAL );
ctx->counter = 0;
ctx->worker_id = CreateTask( "WORK", PRIO_HIGH );
StartTask( ctx->worker_id, WorkerTask, ctx );
checks:
- brief: |
Pin the runner thread. Preempt the runner thread. Unpin the runner
thread.
code: |
_Thread_Pin( executing );
/* We have to preempt the runner to end up in _Thread_Do_unpin() */
SendEvents( ctx->worker_id, EVENT_COUNT );
T_eq_u32( ctx->counter, 1 );
cpu_self = _Thread_Dispatch_disable();
_Thread_Unpin( executing, cpu_self );
_Thread_Dispatch_direct( cpu_self );
links:
- role: validation
uid: ../req/pinning-preemptible
- brief: |
Clean up all used resources.
code: |
DeleteTask( ctx->worker_id );
RestoreRunnerPriority();
links: []
links: []
test-brief: |
Tests SMP-specific thread behaviour using only one processor and a
uniprocessor scheduler.
test-context:
- brief: |
This member contains the worker thread identifier.
description: null
member: |
rtems_id worker_id
- brief: |
This member contains a counter for EVENT_COUNT.
description: null
member: |
volatile uint32_t counter
test-context-support: null
test-description: null
test-header: null
test-includes:
- rtems/score/threadimpl.h
test-local-includes:
- tx-support.h
test-setup: null
test-stop: null
test-support: |
#define EVENT_COUNT RTEMS_EVENT_0
typedef ${.:/test-context-type} Context;
static void WorkerTask( rtems_task_argument arg )
{
Context *ctx;
ctx = (Context *) arg;
while ( true ) {
rtems_event_set events;
events = ReceiveAnyEvents();
if ( ( events & EVENT_COUNT ) != 0 ) {
++ctx->counter;
}
}
}
test-target: testsuites/validation/tc-score-thread-smp-one-cpu.c
test-teardown: null
type: test-case
|