cleanup spin lock in irq.c
-- move exception_lock to dump.c -- optimize the lock usage in request_irq Tracked-On: #4958 Signed-off-by: Mingqiang Chi <mingqiang.chi@intel.com>
This commit is contained in:
parent
d0a4052518
commit
67a7c355ec
|
@ -20,7 +20,6 @@
|
|||
#include <logmsg.h>
|
||||
#include <vmx.h>
|
||||
|
||||
static spinlock_t exception_spinlock = { .head = 0U, .tail = 0U, };
|
||||
static spinlock_t irq_alloc_spinlock = { .head = 0U, .tail = 0U, };
|
||||
|
||||
uint64_t irq_alloc_bitmap[IRQ_ALLOC_BITMAP_SIZE];
|
||||
|
@ -214,8 +213,8 @@ int32_t request_irq(uint32_t req_irq, irq_action_t action_fn, void *priv_data,
|
|||
ret = -EINVAL;
|
||||
} else {
|
||||
desc = &irq_desc_array[irq];
|
||||
spinlock_irqsave_obtain(&desc->lock, &rflags);
|
||||
if (desc->action == NULL) {
|
||||
spinlock_irqsave_obtain(&desc->lock, &rflags);
|
||||
desc->flags = flags;
|
||||
desc->priv_data = priv_data;
|
||||
desc->action = action_fn;
|
||||
|
@ -224,8 +223,6 @@ int32_t request_irq(uint32_t req_irq, irq_action_t action_fn, void *priv_data,
|
|||
ret = (int32_t)irq;
|
||||
dev_dbg(DBG_LEVEL_IRQ, "[%s] irq%d vr:0x%x", __func__, irq, desc->vector);
|
||||
} else {
|
||||
spinlock_irqrestore_release(&desc->lock, rflags);
|
||||
|
||||
ret = -EBUSY;
|
||||
pr_err("%s: request irq(%u) vr(%u) failed, already requested", __func__,
|
||||
irq, irq_to_vector(irq));
|
||||
|
@ -372,15 +369,9 @@ void dispatch_exception(struct intr_excp_ctx *ctx)
|
|||
{
|
||||
uint16_t pcpu_id = get_pcpu_id();
|
||||
|
||||
/* Obtain lock to ensure exception dump doesn't get corrupted */
|
||||
spinlock_obtain(&exception_spinlock);
|
||||
|
||||
/* Dump exception context */
|
||||
dump_exception(ctx, pcpu_id);
|
||||
|
||||
/* Release lock to let other CPUs handle exception */
|
||||
spinlock_release(&exception_spinlock);
|
||||
|
||||
/* Halt the CPU */
|
||||
cpu_dead();
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#define CALL_TRACE_HIERARCHY_MAX 20U
|
||||
#define DUMP_STACK_SIZE 0x200U
|
||||
|
||||
static spinlock_t exception_spinlock = { .head = 0U, .tail = 0U, };
|
||||
/*
|
||||
* readable exception descriptors.
|
||||
*/
|
||||
|
@ -242,6 +243,9 @@ void dump_intr_excp_frame(const struct intr_excp_ctx *ctx)
|
|||
|
||||
void dump_exception(struct intr_excp_ctx *ctx, uint16_t pcpu_id)
|
||||
{
|
||||
/* Obtain lock to ensure exception dump doesn't get corrupted */
|
||||
spinlock_obtain(&exception_spinlock);
|
||||
|
||||
/* Dump host context */
|
||||
dump_intr_excp_frame(ctx);
|
||||
/* Show host stack */
|
||||
|
@ -252,4 +256,7 @@ void dump_exception(struct intr_excp_ctx *ctx, uint16_t pcpu_id)
|
|||
/* Save registers*/
|
||||
crash_ctx = ctx;
|
||||
cache_flush_invalidate_all();
|
||||
|
||||
/* Release lock to let other CPUs handle exception */
|
||||
spinlock_release(&exception_spinlock);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue