forked from Imagelibrary/rtems
record: Use BSS section instead of per-CPU data
The .rtemsrwset section is used for the per-CPU data. This section has loadable content. Place the ring buffers in the BSS section to avoid large executable image sizes. Not using the per-CPU data makes it possible to initialize the record support earlier. Update #3665.
This commit is contained in:
@@ -2942,14 +2942,18 @@ struct _reent *__getreent(void)
|
||||
#error "CONFIGURE_RECORD_PER_PROCESSOR_ITEMS must be at least 16"
|
||||
#endif
|
||||
|
||||
const unsigned int _Record_Item_count = CONFIGURE_RECORD_PER_PROCESSOR_ITEMS;
|
||||
|
||||
struct Record_Configured_control {
|
||||
Record_Control Control;
|
||||
typedef struct {
|
||||
RTEMS_ALIGNED( CPU_CACHE_LINE_BYTES ) Record_Control Control;
|
||||
rtems_record_item Items[ CONFIGURE_RECORD_PER_PROCESSOR_ITEMS ];
|
||||
};
|
||||
} Record_Configured_control;
|
||||
|
||||
PER_CPU_DATA_ITEM( Record_Configured_control, _Record_Per_CPU );
|
||||
static Record_Configured_control _Record_Controls[ _CONFIGURE_MAXIMUM_PROCESSORS ];
|
||||
|
||||
const Record_Configuration _Record_Configuration = {
|
||||
CONFIGURE_RECORD_PER_PROCESSOR_ITEMS,
|
||||
sizeof( Record_Configured_control ),
|
||||
&_Record_Controls[ 0 ].Control
|
||||
};
|
||||
|
||||
RTEMS_SYSINIT_ITEM(
|
||||
_Record_Initialize,
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
#include <rtems/score/atomic.h>
|
||||
#include <rtems/score/cpu.h>
|
||||
#include <rtems/score/percpudata.h>
|
||||
#include <rtems/score/percpu.h>
|
||||
#include <rtems/score/watchdog.h>
|
||||
#include <rtems/rtems/intr.h>
|
||||
#include <rtems/rtems/tasks.h>
|
||||
@@ -42,19 +42,20 @@
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
struct Record_Control {
|
||||
typedef struct Record_Control {
|
||||
Atomic_Uint head;
|
||||
unsigned int tail;
|
||||
unsigned int mask;
|
||||
Watchdog_Control Watchdog;
|
||||
rtems_record_item Header[ 3 ];
|
||||
rtems_record_item Items[ RTEMS_ZERO_LENGTH_ARRAY ];
|
||||
};
|
||||
} Record_Control;
|
||||
|
||||
typedef struct Record_Control Record_Control;
|
||||
|
||||
typedef RTEMS_ALIGNED( CPU_CACHE_LINE_BYTES )
|
||||
struct Record_Configured_control Record_Configured_control;
|
||||
typedef struct {
|
||||
unsigned int item_count;
|
||||
size_t control_size;
|
||||
Record_Control *controls;
|
||||
} Record_Configuration;
|
||||
|
||||
typedef struct {
|
||||
Record_Control *control;
|
||||
@@ -63,9 +64,7 @@ typedef struct {
|
||||
rtems_interrupt_level level;
|
||||
} rtems_record_context;
|
||||
|
||||
PER_CPU_DATA_ITEM_DECLARE( Record_Configured_control, _Record_Per_CPU );
|
||||
|
||||
extern const unsigned int _Record_Item_count;
|
||||
extern const Record_Configuration _Record_Configuration;
|
||||
|
||||
void _Record_Initialize( void );
|
||||
|
||||
|
||||
@@ -29,11 +29,11 @@ extern "C" {
|
||||
#define RTEMS_SYSINIT_BSP_WORK_AREAS 000100
|
||||
#define RTEMS_SYSINIT_BSP_START 000200
|
||||
#define RTEMS_SYSINIT_CPU_COUNTER 000300
|
||||
#define RTEMS_SYSINIT_INITIAL_EXTENSIONS 000400
|
||||
#define RTEMS_SYSINIT_MP_EARLY 000500
|
||||
#define RTEMS_SYSINIT_DATA_STRUCTURES 000600
|
||||
#define RTEMS_SYSINIT_MP 000700
|
||||
#define RTEMS_SYSINIT_RECORD 000800
|
||||
#define RTEMS_SYSINIT_RECORD 000400
|
||||
#define RTEMS_SYSINIT_INITIAL_EXTENSIONS 000500
|
||||
#define RTEMS_SYSINIT_MP_EARLY 000600
|
||||
#define RTEMS_SYSINIT_DATA_STRUCTURES 000700
|
||||
#define RTEMS_SYSINIT_MP 000800
|
||||
#define RTEMS_SYSINIT_USER_EXTENSIONS 000900
|
||||
#define RTEMS_SYSINIT_CLASSIC_TASKS 000a00
|
||||
#define RTEMS_SYSINIT_CLASSIC_TIMER 000b00
|
||||
|
||||
@@ -151,7 +151,7 @@ void _Record_Stream_header_initialize( Record_Stream_header *header )
|
||||
header->Processor_maximum.data = rtems_scheduler_get_processor_maximum() - 1;
|
||||
|
||||
header->Count.event = RTEMS_RECORD_TIME_EVENT( 0, RTEMS_RECORD_PER_CPU_COUNT );
|
||||
header->Count.data = _Record_Item_count;
|
||||
header->Count.data = _Record_Configuration.item_count;
|
||||
|
||||
header->Frequency.event =
|
||||
RTEMS_RECORD_TIME_EVENT( 0, RTEMS_RECORD_FREQUENCY );
|
||||
|
||||
@@ -39,21 +39,21 @@ static Watchdog_Interval _Record_Tick_interval;
|
||||
|
||||
void _Record_Initialize( void )
|
||||
{
|
||||
uint32_t cpu_max;
|
||||
uint32_t cpu_index;
|
||||
uintptr_t offset;
|
||||
Record_Control *control;
|
||||
uint32_t cpu_max;
|
||||
uint32_t cpu_index;
|
||||
|
||||
control = _Record_Configuration.controls;
|
||||
cpu_max = rtems_configuration_get_maximum_processors();
|
||||
offset = PER_CPU_DATA_OFFSET( _Record_Per_CPU );
|
||||
|
||||
for ( cpu_index = 0; cpu_index < cpu_max; ++cpu_index ) {
|
||||
Per_CPU_Control *cpu;
|
||||
Record_Control *control;
|
||||
|
||||
cpu = _Per_CPU_Get_by_index( cpu_index );
|
||||
control = PER_CPU_DATA_GET_BY_OFFSET( cpu, Record_Control, offset );
|
||||
control->mask = _Record_Item_count - 1U;
|
||||
control->mask = _Record_Configuration.item_count - 1U;
|
||||
cpu->record = control;
|
||||
control = (Record_Control *)
|
||||
( (char *) control + _Record_Configuration.control_size );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -59,7 +59,9 @@ typedef struct {
|
||||
|
||||
static test_context test_instance;
|
||||
|
||||
const unsigned int _Record_Item_count = ITEM_COUNT;
|
||||
const Record_Configuration _Record_Configuration = {
|
||||
.item_count = ITEM_COUNT
|
||||
};
|
||||
|
||||
#define UE(user) RTEMS_RECORD_USER(user)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user