Skip to content

Commit ee02719

Browse files
author
Jyri Sarha
committed
debug_stream: text_msg: Add CONFIG_SOF_DEBUG_STREAM_SLOT_FORCE_MAX_CPUS
The CONFIG_SOF_DEBUG_STREAM_SLOT_FORCE_MAX_CPUS option limit the number of debug stream slot section to lower number than the actual number of cores. In some situations a high number of cpu sections shrinks the circular buffer size so much that it limit debugging. With this option its possible to use fewer sections. The downside is that the cpus above the number of sections can not send any debug stream messages. Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
1 parent f2388f1 commit ee02719

2 files changed

Lines changed: 26 additions & 9 deletions

File tree

src/debug/debug_stream/Kconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,17 @@ config SOF_DEBUG_STREAM_THREAD_INFO_INTERVAL
4545
Decides how often thread info runs and checks execution cycle
4646
statistics and stack usage.
4747

48+
config SOF_DEBUG_STREAM_SLOT_FORCE_MAX_CPUS
49+
int "Number of cpu sections slot is divided to"
50+
default MP_MAX_NUM_CPUS
51+
range 1 MP_MAX_NUM_CPUS
52+
help
53+
In some situations a high number of cpu sections shrinks the
54+
circular buffer size so much that it limit debugging. With
55+
this option its possible to use fewer sections. The downside
56+
is that the cpus above the number of sections can not send
57+
any debug stream messages.
58+
4859
config SOF_DEBUG_STREAM_TEXT_MSG
4960
bool "Enable text message sending through Debug-Stream"
5061
help

src/debug/debug_stream/debug_stream_slot.c

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ struct cpu_mutex {
1919
} __aligned(CONFIG_DCACHE_LINE_SIZE);
2020

2121
/* CPU specific mutexes for each circular buffer */
22-
static struct cpu_mutex cpu_mutex[CONFIG_MP_MAX_NUM_CPUS];
22+
static struct cpu_mutex cpu_mutex[CONFIG_SOF_DEBUG_STREAM_SLOT_FORCE_MAX_CPUS];
2323

2424
#ifdef CONFIG_INTEL_ADSP_DEBUG_SLOT_MANAGER
2525
static struct debug_stream_slot_hdr *dbg_stream_slot;
@@ -54,6 +54,12 @@ debug_stream_get_circular_buffer(struct debug_stream_section_descriptor *desc, u
5454
return NULL;
5555
}
5656

57+
if (core >= CONFIG_SOF_DEBUG_STREAM_SLOT_FORCE_MAX_CPUS) {
58+
LOG_DBG("No section for cpu %u >= %u ", core,
59+
CONFIG_SOF_DEBUG_STREAM_SLOT_FORCE_MAX_CPUS);
60+
return NULL;
61+
}
62+
5763
*desc = hdr->section_desc[core];
5864
LOG_DBG("Section %u (desc %u %u %u)", core, desc->core_id, desc->buf_words, desc->offset);
5965

@@ -116,18 +122,18 @@ int debug_stream_slot_send_record(struct debug_stream_record *rec)
116122
static int debug_stream_slot_init(void)
117123
{
118124
struct debug_stream_slot_hdr *hdr = debug_stream_get_slot();
125+
unsigned int max_num_cpus = CONFIG_SOF_DEBUG_STREAM_SLOT_FORCE_MAX_CPUS;
119126
size_t hdr_size = ALIGN_UP(offsetof(struct debug_stream_slot_hdr,
120-
section_desc[CONFIG_MP_MAX_NUM_CPUS]),
127+
section_desc[max_num_cpus]),
121128
CONFIG_DCACHE_LINE_SIZE);
122129
size_t section_area_size = ADSP_DW_SLOT_SIZE - hdr_size;
123-
size_t section_size = ALIGN_DOWN(section_area_size /
124-
CONFIG_MP_MAX_NUM_CPUS,
130+
size_t section_size = ALIGN_DOWN(section_area_size / max_num_cpus,
125131
CONFIG_DCACHE_LINE_SIZE);
126132
size_t offset = hdr_size;
127133
int i;
128134

129135
LOG_INF("%u sections of %u bytes, hdr %u, section area %u",
130-
CONFIG_MP_MAX_NUM_CPUS, section_size, hdr_size,
136+
max_num_cpus, section_size, hdr_size,
131137
section_area_size);
132138

133139
#ifdef CONFIG_INTEL_ADSP_DEBUG_SLOT_MANAGER
@@ -142,9 +148,9 @@ static int debug_stream_slot_init(void)
142148

143149
hdr->hdr.magic = DEBUG_STREAM_IDENTIFIER;
144150
hdr->hdr.hdr_size = hdr_size;
145-
hdr->total_size = hdr_size + CONFIG_MP_MAX_NUM_CPUS * section_size;
146-
hdr->num_sections = CONFIG_MP_MAX_NUM_CPUS;
147-
for (i = 0; i < CONFIG_MP_MAX_NUM_CPUS; i++) {
151+
hdr->total_size = hdr_size + max_num_cpus * section_size;
152+
hdr->num_sections = max_num_cpus;
153+
for (i = 0; i < max_num_cpus; i++) {
148154
hdr->section_desc[i].core_id = i;
149155
hdr->section_desc[i].buf_words =
150156
(section_size - offsetof(struct debug_stream_circular_buf, data[0]))/
@@ -154,7 +160,7 @@ static int debug_stream_slot_init(void)
154160
i, section_size, offset);
155161
offset += section_size;
156162
}
157-
for (i = 0; i < CONFIG_MP_MAX_NUM_CPUS; i++) {
163+
for (i = 0; i < max_num_cpus; i++) {
158164
struct debug_stream_section_descriptor desc = { 0 };
159165
struct debug_stream_circular_buf *buf =
160166
debug_stream_get_circular_buffer(&desc, i);

0 commit comments

Comments
 (0)