debug: save irqflag locally when ftrace_ramoops io [1/1]

PD#SWPL-6028

Problem:
save irqflag locally when ftrace_ramoops io

Solution:
save irqflag locally when ftrace_ramoops io

Verify:
TL1 x301

Change-Id: I6df9700cceaccc97dc983d88ada73197a6968f73
Signed-off-by: Jianxin Pan <jianxin.pan@amlogic.com>
This commit is contained in:
Jianxin Pan
2019-04-22 18:57:12 +08:00
parent c0e00133bc
commit a197cb540f
2 changed files with 15 additions and 14 deletions

View File

@@ -33,7 +33,6 @@
#include <linux/moduleparam.h>
static DEFINE_PER_CPU(int, en);
static DEFINE_PER_CPU(unsigned long, irq_flag);
#define IRQ_D 1
@@ -122,17 +121,16 @@ void notrace pstore_ftrace_dump(struct pstore_ftrace_record *rec,
}
void notrace pstore_io_save(unsigned long reg, unsigned long val,
unsigned long parant, unsigned int flag)
unsigned long parant, unsigned int flag,
unsigned long *irq_flag)
{
struct pstore_ftrace_record rec;
int cpu = get_cpu();
put_cpu();
if (!ramoops_ftrace_en || !ramoops_io_en)
return;
if ((flag == PSTORE_FLAG_IO_R || flag == PSTORE_FLAG_IO_W) && IRQ_D)
local_irq_save(per_cpu(irq_flag, cpu));
local_irq_save(*irq_flag);
rec.ip = CALLER_ADDR0;
rec.parent_ip = parant;
@@ -141,9 +139,9 @@ void notrace pstore_io_save(unsigned long reg, unsigned long val,
rec.val2 = val;
pstore_ftrace_save(&rec);
if ((flag == PSTORE_FLAG_IO_R_END || flag == PSTORE_FLAG_IO_W_END)
&& IRQ_D)
local_irq_restore(per_cpu(irq_flag, cpu));
if ((flag == PSTORE_FLAG_IO_R_END || flag == PSTORE_FLAG_IO_W_END) &&
IRQ_D)
local_irq_restore(*irq_flag);
}
EXPORT_SYMBOL(pstore_io_save);

View File

@@ -33,20 +33,23 @@ extern unsigned int dump_iomap;
#define PSTORE_FLAG_MASK 0xF
void notrace pstore_io_save(unsigned long reg, unsigned long val,
unsigned long parant, unsigned int flag);
unsigned long parant, unsigned int flag,
unsigned long *irq_flag);
//#define SKIP_IO_TRACE
#if (defined CONFIG_AMLOGIC_DEBUG_FTRACE_PSTORE) && (!defined SKIP_IO_TRACE)
#define pstore_ftrace_io_wr(reg, val) \
pstore_io_save(reg, val, CALLER_ADDR0, PSTORE_FLAG_IO_W)
unsigned long irqflg; \
pstore_io_save(reg, val, CALLER_ADDR0, PSTORE_FLAG_IO_W, &irqflg)
#define pstore_ftrace_io_wr_end(reg, val) \
pstore_io_save(reg, 0, CALLER_ADDR0, PSTORE_FLAG_IO_W_END)
pstore_io_save(reg, 0, CALLER_ADDR0, PSTORE_FLAG_IO_W_END, &irqflg)
#define pstore_ftrace_io_rd(reg) \
pstore_io_save(reg, 0, CALLER_ADDR0, PSTORE_FLAG_IO_R)
#define pstore_ftrace_io_rd(reg) \
unsigned long irqflg; \
pstore_io_save(reg, 0, CALLER_ADDR0, PSTORE_FLAG_IO_R, &irqflg)
#define pstore_ftrace_io_rd_end(reg) \
pstore_io_save(reg, 0, CALLER_ADDR0, PSTORE_FLAG_IO_R_END)
pstore_io_save(reg, 0, CALLER_ADDR0, PSTORE_FLAG_IO_R_END, &irqflg)
#define need_dump_iomap() (ramoops_io_en | dump_iomap)