disp: msm: sde: avoid using spinlock for register log
Add support to use atomic variable instead of spinlock for register logs during register write. This change helps in reducing the run-time and is safe to use as most of the register writes happen in commit context. Change-Id: Ib7e377f80cbf437e391792b0b424cbd1eefdf497 Signed-off-by: Yashwanth <yvulapu@codeaurora.org> Signed-off-by: Samantha Tran <samtran@codeaurora.org>
This commit is contained in:

committed by
Samantha Tran

orang tua
8b0b1d1c51
melakukan
e57b8443cc
@@ -191,11 +191,10 @@ struct sde_dbg_reglog {
|
|||||||
u32 first;
|
u32 first;
|
||||||
u32 last;
|
u32 last;
|
||||||
u32 last_dump;
|
u32 last_dump;
|
||||||
u32 curr;
|
atomic64_t curr;
|
||||||
u32 next;
|
u32 next;
|
||||||
u32 enable;
|
u32 enable;
|
||||||
u32 enable_mask;
|
u32 enable_mask;
|
||||||
spinlock_t spin_lock;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern struct sde_dbg_reglog *sde_dbg_base_reglog;
|
extern struct sde_dbg_reglog *sde_dbg_base_reglog;
|
||||||
|
@@ -103,27 +103,22 @@ exit:
|
|||||||
|
|
||||||
void sde_reglog_log(u8 blk_id, u32 val, u32 addr)
|
void sde_reglog_log(u8 blk_id, u32 val, u32 addr)
|
||||||
{
|
{
|
||||||
unsigned long flags;
|
|
||||||
struct sde_dbg_reglog_log *log;
|
struct sde_dbg_reglog_log *log;
|
||||||
struct sde_dbg_reglog *reglog = sde_dbg_base_reglog;
|
struct sde_dbg_reglog *reglog = sde_dbg_base_reglog;
|
||||||
|
int index;
|
||||||
|
|
||||||
if (!reglog)
|
if (!reglog)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
spin_lock_irqsave(®log->spin_lock, flags);
|
index = abs(atomic64_inc_return(®log->curr) % SDE_REGLOG_ENTRY);
|
||||||
|
|
||||||
log = ®log->logs[reglog->curr];
|
|
||||||
|
|
||||||
|
log = ®log->logs[index];
|
||||||
log->blk_id = blk_id;
|
log->blk_id = blk_id;
|
||||||
log->val = val;
|
log->val = val;
|
||||||
log->addr = addr;
|
log->addr = addr;
|
||||||
log->time = local_clock();
|
log->time = local_clock();
|
||||||
log->pid = current->pid;
|
log->pid = current->pid;
|
||||||
|
|
||||||
reglog->curr = (reglog->curr + 1) % SDE_REGLOG_ENTRY;
|
|
||||||
reglog->last++;
|
reglog->last++;
|
||||||
|
|
||||||
spin_unlock_irqrestore(®log->spin_lock, flags);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* always dump the last entries which are not dumped yet */
|
/* always dump the last entries which are not dumped yet */
|
||||||
@@ -245,7 +240,7 @@ struct sde_dbg_reglog *sde_reglog_init(void)
|
|||||||
if (!reglog)
|
if (!reglog)
|
||||||
return ERR_PTR(-ENOMEM);
|
return ERR_PTR(-ENOMEM);
|
||||||
|
|
||||||
spin_lock_init(®log->spin_lock);
|
atomic64_set(®log->curr, 0);
|
||||||
|
|
||||||
return reglog;
|
return reglog;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user