From a2d2a49ba991b585c9a70cbbc3b9ec124c4673e9 Mon Sep 17 00:00:00 2001 From: hujun5 Date: Fri, 11 Apr 2025 15:52:06 +0800 Subject: [PATCH] sched/irq: align irq work queue stack buffer Add aligned_data(STACK_ALIGNMENT) attribute to g_irq_work_stack buffer declaration in irq_attach_wqueue.c. Ensures stack memory is properly aligned to architecture requirements, preventing unaligned stack addresses that could cause data access faults or performance degradation on strict alignment architectures. Signed-off-by: hujun5 --- sched/irq/irq_attach_wqueue.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sched/irq/irq_attach_wqueue.c b/sched/irq/irq_attach_wqueue.c index 3c8554bd5e7..fc1eb11539d 100644 --- a/sched/irq/irq_attach_wqueue.c +++ b/sched/irq/irq_attach_wqueue.c @@ -72,11 +72,12 @@ static mutex_t g_irq_wqueue_lock = NXMUTEX_INITIALIZER; static FAR struct kwork_wqueue_s *g_irq_wqueue[CONFIG_IRQ_NWORKS]; #ifdef IRQ_WORK_SECTION -static uint8_t g_irq_work_stack[CONFIG_IRQ_NWORKS][CONFIG_IRQ_WORK_STACKSIZE] +static aligned_data(STACK_ALIGNMENT) uint8_t +g_irq_work_stack[CONFIG_IRQ_NWORKS][CONFIG_IRQ_WORK_STACKSIZE] locate_data(IRQ_WORK_SECTION); #else -static uint8_t g_irq_work_stack[CONFIG_IRQ_NWORKS] - [CONFIG_IRQ_WORK_STACKSIZE]; +static aligned_data(STACK_ALIGNMENT) uint8_t +g_irq_work_stack[CONFIG_IRQ_NWORKS][CONFIG_IRQ_WORK_STACKSIZE]; #endif /****************************************************************************