From a197cb540fdad9d0fb2c4c7fc5d705a7b407abd0 Mon Sep 17 00:00:00 2001 From: Jianxin Pan Date: Mon, 22 Apr 2019 18:57:12 +0800 Subject: [PATCH] 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 --- drivers/amlogic/debug/debug_ftrace_ramoops.c | 14 ++++++-------- include/linux/amlogic/debug_ftrace_ramoops.h | 15 +++++++++------ 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/drivers/amlogic/debug/debug_ftrace_ramoops.c b/drivers/amlogic/debug/debug_ftrace_ramoops.c index f67c59f..145c66f 100644 --- a/drivers/amlogic/debug/debug_ftrace_ramoops.c +++ b/drivers/amlogic/debug/debug_ftrace_ramoops.c @@ -33,7 +33,6 @@ #include 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); diff --git a/include/linux/amlogic/debug_ftrace_ramoops.h b/include/linux/amlogic/debug_ftrace_ramoops.h index 51f4c88..fa6d4c4 100644 --- a/include/linux/amlogic/debug_ftrace_ramoops.h +++ b/include/linux/amlogic/debug_ftrace_ramoops.h @@ -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) -- 2.7.4