arm: optimize up_interrupt_context used in armv[6/7/8]-m

resson:
using percpu storage for g_current_regs or leveraging interrupt status
registers to determine if code is running within an interrupt context can enhance performance.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
This commit is contained in:
hujun5 2024-03-28 09:32:14 +08:00 committed by archer
parent 6a3a32b185
commit 0561b55860
3 changed files with 3 additions and 33 deletions

View File

@ -394,17 +394,7 @@ static inline_function void up_set_current_regs(uint32_t *regs)
noinstrument_function
static inline_function bool up_interrupt_context(void)
{
#ifdef CONFIG_SMP
irqstate_t flags = up_irq_save();
#endif
bool ret = up_current_regs() != NULL;
#ifdef CONFIG_SMP
up_irq_restore(flags);
#endif
return ret;
return getipsr() != 0;
}
/****************************************************************************

View File

@ -599,17 +599,7 @@ static inline_function void up_set_current_regs(uint32_t *regs)
noinstrument_function
static inline_function bool up_interrupt_context(void)
{
#ifdef CONFIG_SMP
irqstate_t flags = up_irq_save();
#endif
bool ret = up_current_regs() != NULL;
#ifdef CONFIG_SMP
up_irq_restore(flags);
#endif
return ret;
return getipsr() != 0;
}
/****************************************************************************

View File

@ -572,17 +572,7 @@ static inline_function void up_set_current_regs(uint32_t *regs)
noinstrument_function
static inline_function bool up_interrupt_context(void)
{
#ifdef CONFIG_SMP
irqstate_t flags = up_irq_save();
#endif
bool ret = up_current_regs() != NULL;
#ifdef CONFIG_SMP
up_irq_restore(flags);
#endif
return ret;
return getipsr() != 0;
}
/****************************************************************************