Skip to content

Commit 8b8450f

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 8b8450f

2 files changed

Lines changed: 28 additions & 10 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: 17 additions & 10 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,19 @@ 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();
119-
size_t hdr_size = ALIGN_UP(offsetof(struct debug_stream_slot_hdr,
120-
section_desc[CONFIG_MP_MAX_NUM_CPUS]),
121-
CONFIG_DCACHE_LINE_SIZE);
125+
size_t hdr_size = ALIGN_UP(
126+
offsetof(struct debug_stream_slot_hdr,
127+
section_desc[CONFIG_SOF_DEBUG_STREAM_SLOT_FORCE_MAX_CPUS]),
128+
CONFIG_DCACHE_LINE_SIZE);
122129
size_t section_area_size = ADSP_DW_SLOT_SIZE - hdr_size;
123130
size_t section_size = ALIGN_DOWN(section_area_size /
124-
CONFIG_MP_MAX_NUM_CPUS,
131+
CONFIG_SOF_DEBUG_STREAM_SLOT_FORCE_MAX_CPUS,
125132
CONFIG_DCACHE_LINE_SIZE);
126133
size_t offset = hdr_size;
127134
int i;
128135

129136
LOG_INF("%u sections of %u bytes, hdr %u, section area %u",
130-
CONFIG_MP_MAX_NUM_CPUS, section_size, hdr_size,
137+
CONFIG_SOF_DEBUG_STREAM_SLOT_FORCE_MAX_CPUS, section_size, hdr_size,
131138
section_area_size);
132139

133140
#ifdef CONFIG_INTEL_ADSP_DEBUG_SLOT_MANAGER
@@ -142,9 +149,9 @@ static int debug_stream_slot_init(void)
142149

143150
hdr->hdr.magic = DEBUG_STREAM_IDENTIFIER;
144151
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++) {
152+
hdr->total_size = hdr_size + CONFIG_SOF_DEBUG_STREAM_SLOT_FORCE_MAX_CPUS * section_size;
153+
hdr->num_sections = CONFIG_SOF_DEBUG_STREAM_SLOT_FORCE_MAX_CPUS;
154+
for (i = 0; i < CONFIG_SOF_DEBUG_STREAM_SLOT_FORCE_MAX_CPUS; i++) {
148155
hdr->section_desc[i].core_id = i;
149156
hdr->section_desc[i].buf_words =
150157
(section_size - offsetof(struct debug_stream_circular_buf, data[0]))/
@@ -154,7 +161,7 @@ static int debug_stream_slot_init(void)
154161
i, section_size, offset);
155162
offset += section_size;
156163
}
157-
for (i = 0; i < CONFIG_MP_MAX_NUM_CPUS; i++) {
164+
for (i = 0; i < CONFIG_SOF_DEBUG_STREAM_SLOT_FORCE_MAX_CPUS; i++) {
158165
struct debug_stream_section_descriptor desc = { 0 };
159166
struct debug_stream_circular_buf *buf =
160167
debug_stream_get_circular_buffer(&desc, i);

0 commit comments

Comments
 (0)