[ERD][NEUS7920-76] [COMMON] lib: dss: refactor dbg_snapshot_irq logging
authorHosung Kim <hosung0.kim@samsung.com>
Thu, 2 Aug 2018 02:18:37 +0000 (11:18 +0900)
committerKim Gunho <gunho.kim@samsung.com>
Fri, 30 Aug 2019 07:58:56 +0000 (16:58 +0900)
This commit refactors logging of dbg_snapshot_irq as following.

1. Remove dbg_snapshot_irq_exit logging (actually it is merged to
   dbg_snapshot_irq like measuring latency)
2. Adding logging actually called function in smp_call_function
   to dbg_snapshot_irq. its flag is DSS_FLAG_SMP_CALL_FN.
3. Replace logging from irqaction structure to irq_desc structure.
   irq_desc includes irqaction and it has more informations.
   And we are too hard to see it in ramdump.

Change-Id: I351593a454fd39eb87a965093349d69b6182e7ce
Signed-off-by: Hosung Kim <hosung0.kim@samsung.com>
arch/arm64/kernel/smp.c
include/linux/debug-snapshot.h
kernel/irq/handle.c
kernel/irq/irqdesc.c
kernel/smp.c
kernel/softirq.c
kernel/time/timer.c
lib/Kconfig.debug
lib/debug-snapshot-log.c
lib/debug-snapshot-log.h

index 1d6be043d3ff6a696e76a3b5d1133a46f6d5f45f..055ef7d1c5ae1a7e5b8d5b67c42c192064e3cb6e 100644 (file)
@@ -24,6 +24,7 @@
 #include <linux/sched/mm.h>
 #include <linux/sched/hotplug.h>
 #include <linux/sched/task_stack.h>
+#include <linux/sched/clock.h>
 #include <linux/interrupt.h>
 #include <linux/cache.h>
 #include <linux/profile.h>
@@ -889,15 +890,18 @@ void handle_IPI(int ipinr, struct pt_regs *regs)
 {
        unsigned int cpu = smp_processor_id();
        struct pt_regs *old_regs = set_irq_regs(regs);
+       unsigned long long start_time;
 
        if ((unsigned)ipinr < NR_IPI) {
                trace_ipi_entry_rcuidle(ipi_types[ipinr]);
                __inc_irq_stat(cpu, ipi_irqs[ipinr]);
        }
 
+       dbg_snapshot_irq_var(start_time);
+       dbg_snapshot_irq(ipinr, handle_IPI, NULL, 0, DSS_FLAG_IN);
+
        switch (ipinr) {
        case IPI_RESCHEDULE:
-               dbg_snapshot_irq(ipinr, scheduler_ipi, NULL, DSS_FLAG_IN);
                scheduler_ipi();
                break;
 
@@ -914,13 +918,11 @@ void handle_IPI(int ipinr, struct pt_regs *regs)
 
        case IPI_CPU_STOP:
                irq_enter();
-               dbg_snapshot_irq(ipinr, ipi_cpu_stop, NULL, DSS_FLAG_IN);
                ipi_cpu_stop(cpu, regs);
                irq_exit();
                break;
 
        case IPI_CPU_CRASH_STOP:
-               dbg_snapshot_irq(ipinr, ipi_cpu_crash_stop, NULL, DSS_FLAG_IN);
                if (IS_ENABLED(CONFIG_KEXEC_CORE)) {
                        irq_enter();
                        ipi_cpu_crash_stop(cpu, regs);
@@ -932,7 +934,6 @@ void handle_IPI(int ipinr, struct pt_regs *regs)
 #ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST
        case IPI_TIMER:
                irq_enter();
-               dbg_snapshot_irq(ipinr, tick_receive_broadcast, NULL, DSS_FLAG_IN);
                tick_receive_broadcast();
                irq_exit();
                break;
@@ -941,7 +942,6 @@ void handle_IPI(int ipinr, struct pt_regs *regs)
 #ifdef CONFIG_IRQ_WORK
        case IPI_IRQ_WORK:
                irq_enter();
-               dbg_snapshot_irq(ipinr, irq_work_run, NULL, DSS_FLAG_IN);
                irq_work_run();
                irq_exit();
                break;
@@ -949,7 +949,6 @@ void handle_IPI(int ipinr, struct pt_regs *regs)
 
 #ifdef CONFIG_ARM64_ACPI_PARKING_PROTOCOL
        case IPI_WAKEUP:
-               dbg_snapshot_irq(ipinr, handle_IPI, NULL, DSS_FLAG_IN);
                WARN_ONCE(!acpi_parking_protocol_valid(cpu),
                          "CPU%u: Wake-up IPI outside the ACPI parking protocol\n",
                          cpu);
@@ -957,7 +956,6 @@ void handle_IPI(int ipinr, struct pt_regs *regs)
 #endif
 
        default:
-               dbg_snapshot_irq(ipinr, handle_IPI, NULL, DSS_FLAG_IN);
                pr_crit("CPU%u: Unknown IPI message 0x%x\n", cpu, ipinr);
                break;
        }
@@ -965,7 +963,7 @@ void handle_IPI(int ipinr, struct pt_regs *regs)
        if ((unsigned)ipinr < NR_IPI)
                trace_ipi_exit_rcuidle(ipi_types[ipinr]);
 
-       dbg_snapshot_irq(ipinr, handle_IPI, NULL, DSS_FLAG_OUT);
+       dbg_snapshot_irq(ipinr, handle_IPI, NULL, start_time, DSS_FLAG_OUT);
 
        set_irq_regs(old_regs);
 }
index 2961dca8ed457fdac7cfbd4e376d78704d54f9c9..d4136b0003575c66dcba7b45335d43d07515cfaf 100644 (file)
@@ -24,7 +24,7 @@ extern void dbg_snapshot_task(int cpu, void *v_task);
 extern void dbg_snapshot_work(void *worker, void *v_task, void *fn, int en);
 extern void dbg_snapshot_cpuidle(char *modes, unsigned state, int diff, int en);
 extern void dbg_snapshot_suspend(char *log, void *fn, void *dev, int state, int en);
-extern void dbg_snapshot_irq(int irq, void *fn, void *val, int en);
+extern void dbg_snapshot_irq(int irq, void *fn, void *val, unsigned long long time, int en);
 extern void dbg_snapshot_print_notifier_call(void **nl, unsigned long func, int en);
 extern int dbg_snapshot_try_enable(const char *name, unsigned long long duration);
 extern int dbg_snapshot_set_enable(const char *name, int en);
@@ -57,7 +57,8 @@ extern void dbg_snapshot_hook_hardlockup_exit(void);
 extern void dbg_snapshot_dump_sfr(void);
 extern int dbg_snapshot_hook_pmsg(char *buffer, size_t count);
 extern void dbg_snapshot_save_log(int cpu, unsigned long where);
-
+#define dbg_snapshot_irq_var(v)   do {    v = cpu_clock(raw_smp_processor_id());  \
+                                 } while(0)
 /* option */
 #ifdef CONFIG_DEBUG_SNAPSHOT_ACPM
 extern void dbg_snapshot_acpm(unsigned long long timestamp, const char *log, unsigned int data);
@@ -152,15 +153,6 @@ void dbg_snapshot_dm(int type, unsigned long min, unsigned long max, s32 wait_t,
 #define dbg_snapshot_dm(a,b,c,d,e)             do { } while(0)
 #endif
 
-#ifdef CONFIG_DEBUG_SNAPSHOT_IRQ_EXIT
-extern void dbg_snapshot_irq_exit(unsigned int irq, unsigned long long start_time);
-#define dbg_snapshot_irq_exit_var(v)   do {    v = cpu_clock(raw_smp_processor_id());  \
-                                       } while(0)
-#else
-#define dbg_snapshot_irq_exit(a,b)             do { } while(0)
-#define dbg_snapshot_irq_exit_var(v)   do { v = 0; } while(0)
-#endif
-
 #ifdef CONFIG_DEBUG_SNAPSHOT_CRASH_KEY
 void dbg_snapshot_check_crash_key(unsigned int code, int value);
 #else
@@ -194,14 +186,13 @@ extern void dbg_snapshot_binder(struct trace_binder_transaction_base *base,
 #define dbg_snapshot_suspend(a,b,c,d,e)        do { } while(0)
 #define dbg_snapshot_regulator(a,b,c,d,e,f)    do { } while(0)
 #define dbg_snapshot_thermal(a,b,c,d)  do { } while(0)
-#define dbg_snapshot_irq(a,b,c,d)              do { } while(0)
-#define dbg_snapshot_irq_exit(a,b)             do { } while(0)
+#define dbg_snapshot_irq(a,b,c,d,e)            do { } while(0)
 #define dbg_snapshot_irqs_disabled(a)  do { } while(0)
 #define dbg_snapshot_spinlock(a,b)             do { } while(0)
 #define dbg_snapshot_clk(a,b,c,d)              do { } while(0)
 #define dbg_snapshot_pmu(a,b,c)                do { } while(0)
 #define dbg_snapshot_freq(a,b,c,d)             do { } while(0)
-#define dbg_snapshot_irq_exit_var(v)   do { v = 0; } while(0)
+#define dbg_snapshot_irq_var(v)                do { v = 0; } while(0)
 #define dbg_snapshot_reg(a,b,c,d)              do { } while(0)
 #define dbg_snapshot_hrtimer(a,b,c,d)  do { } while(0)
 #define dbg_snapshot_i2c(a,b,c,d)              do { } while(0)
@@ -283,7 +274,8 @@ enum dsslog_flag {
        DSS_FLAG_SOFTIRQ                = 10000,
        DSS_FLAG_SOFTIRQ_HI_TASKLET     = 10100,
        DSS_FLAG_SOFTIRQ_TASKLET        = 10200,
-       DSS_FLAG_CALL_TIMER_FN          = 20000
+       DSS_FLAG_CALL_TIMER_FN          = 20000,
+       DSS_FLAG_SMP_CALL_FN            = 30000,
 };
 
 enum dsslog_freq_flag {
index 0846667ac8f1a0fdc86416125702249303d70e8d..969071c5af1f501039b8beae361e251a0654a1f2 100644 (file)
@@ -145,9 +145,7 @@ irqreturn_t __handle_irq_event_percpu(struct irq_desc *desc, unsigned int *flags
                irqreturn_t res;
 
                trace_irq_handler_entry(irq, action);
-               dbg_snapshot_irq(irq, (void *)action->handler, action, DSS_FLAG_IN);
                res = action->handler(irq, action->dev_id);
-               dbg_snapshot_irq(irq, (void *)action->handler, action, DSS_FLAG_OUT);
                trace_irq_handler_exit(irq, action, res);
 
                if (WARN_ONCE(!irqs_disabled(),"irq %u handler %pF enabled interrupts\n",
index 183b7b3f9bd43d5e16158414c764c17992fabb4c..fbdea4868f43291f9a946d887a2d39031ea71b73 100644 (file)
@@ -602,10 +602,22 @@ void irq_init_desc(unsigned int irq)
 int generic_handle_irq(unsigned int irq)
 {
        struct irq_desc *desc = irq_to_desc(irq);
+       struct irqaction *action;
+       unsigned long long start_time;
 
        if (!desc)
                return -EINVAL;
+
+       action = desc->action;
+       dbg_snapshot_irq_var(start_time);
+       dbg_snapshot_irq(irq, (void *)action->handler, (void *)desc,
+                               0, DSS_FLAG_IN);
+
        generic_handle_irq_desc(desc);
+
+       dbg_snapshot_irq(irq, (void *)action->handler, (void *)desc,
+                               start_time, DSS_FLAG_OUT);
+
        return 0;
 }
 EXPORT_SYMBOL_GPL(generic_handle_irq);
@@ -624,11 +636,9 @@ int __handle_domain_irq(struct irq_domain *domain, unsigned int hwirq,
                        bool lookup, struct pt_regs *regs)
 {
        struct pt_regs *old_regs = set_irq_regs(regs);
-       unsigned long long start_time;
        unsigned int irq = hwirq;
        int ret = 0;
 
-       dbg_snapshot_irq_exit_var(start_time);
        irq_enter();
 
 #ifdef CONFIG_IRQ_DOMAIN
@@ -648,7 +658,6 @@ int __handle_domain_irq(struct irq_domain *domain, unsigned int hwirq,
        }
 
        irq_exit();
-       dbg_snapshot_irq_exit(irq, start_time);
        set_irq_regs(old_regs);
        return ret;
 }
index 55b39c191bf674902cfc466eeeeb0dd59ad67dff..db415796fd68a63efd562658d5ef922fdc670132 100644 (file)
@@ -239,8 +239,7 @@ static void flush_smp_call_function_queue(bool warn_cpu_offline)
                void *info = csd->info;
 
                /* This should be called by handle_IPI in smp.c */
-               if (warn_cpu_offline)
-                       dbg_snapshot_irq(1, func, NULL, DSS_FLAG_IN);
+               dbg_snapshot_irq(DSS_FLAG_SMP_CALL_FN, func, NULL, 0, DSS_FLAG_IN);
 
                /* Do we wait until *after* callback? */
                if (csd->flags & CSD_FLAG_SYNCHRONOUS) {
@@ -250,6 +249,8 @@ static void flush_smp_call_function_queue(bool warn_cpu_offline)
                        csd_unlock(csd);
                        func(info);
                }
+
+               dbg_snapshot_irq(DSS_FLAG_SMP_CALL_FN, func, NULL, 0, DSS_FLAG_OUT);
        }
 
        /*
index 74f06305fc757e9a23bc000b36a90203ba30fcbc..4ab5a564c6ad82af3e68edbdedb1feb03e5358af 100644 (file)
@@ -27,6 +27,7 @@
 #include <linux/tick.h>
 #include <linux/irq.h>
 #include <linux/debug-snapshot.h>
+#include <linux/sched/clock.h>
 
 #define CREATE_TRACE_POINTS
 #include <trace/events/irq.h>
@@ -247,6 +248,7 @@ asmlinkage __visible void __softirq_entry __do_softirq(void)
 {
        unsigned long end = jiffies + MAX_SOFTIRQ_TIME;
        unsigned long old_flags = current->flags;
+       unsigned long long start_time;
        int max_restart = MAX_SOFTIRQ_RESTART;
        struct softirq_action *h;
        bool in_hardirq;
@@ -286,9 +288,10 @@ restart:
                kstat_incr_softirqs_this_cpu(vec_nr);
 
                trace_softirq_entry(vec_nr);
-               dbg_snapshot_irq(DSS_FLAG_SOFTIRQ, h->action, NULL, DSS_FLAG_IN);
+               dbg_snapshot_irq_var(start_time);
+               dbg_snapshot_irq(DSS_FLAG_SOFTIRQ, h->action, NULL, 0, DSS_FLAG_IN);
                h->action(h);
-               dbg_snapshot_irq(DSS_FLAG_SOFTIRQ, h->action, NULL, DSS_FLAG_OUT);
+               dbg_snapshot_irq(DSS_FLAG_SOFTIRQ, h->action, NULL, start_time, DSS_FLAG_OUT);
                trace_softirq_exit(vec_nr);
                if (unlikely(prev_count != preempt_count())) {
                        pr_err("huh, entered softirq %u %s %p with preempt_count %08x, exited with %08x?\n",
@@ -496,6 +499,7 @@ EXPORT_SYMBOL(__tasklet_hi_schedule);
 static __latent_entropy void tasklet_action(struct softirq_action *a)
 {
        struct tasklet_struct *list;
+       unsigned long long start_time;
 
        local_irq_disable();
        list = __this_cpu_read(tasklet_vec.head);
@@ -513,11 +517,12 @@ static __latent_entropy void tasklet_action(struct softirq_action *a)
                                if (!test_and_clear_bit(TASKLET_STATE_SCHED,
                                                        &t->state))
                                        BUG();
+                               dbg_snapshot_irq_var(start_time);
                                dbg_snapshot_irq(DSS_FLAG_SOFTIRQ_TASKLET,
-                                               t->func, NULL, DSS_FLAG_IN);
+                                               t->func, NULL, 0, DSS_FLAG_IN);
                                t->func(t->data);
                                dbg_snapshot_irq(DSS_FLAG_SOFTIRQ_TASKLET,
-                                               t->func, NULL, DSS_FLAG_OUT);
+                                               t->func, NULL, start_time, DSS_FLAG_OUT);
                                tasklet_unlock(t);
                                continue;
                        }
@@ -536,6 +541,7 @@ static __latent_entropy void tasklet_action(struct softirq_action *a)
 static __latent_entropy void tasklet_hi_action(struct softirq_action *a)
 {
        struct tasklet_struct *list;
+       unsigned long long start_time;
 
        local_irq_disable();
        list = __this_cpu_read(tasklet_hi_vec.head);
@@ -553,11 +559,12 @@ static __latent_entropy void tasklet_hi_action(struct softirq_action *a)
                                if (!test_and_clear_bit(TASKLET_STATE_SCHED,
                                                        &t->state))
                                        BUG();
+                               dbg_snapshot_irq_var(start_time);
                                dbg_snapshot_irq(DSS_FLAG_SOFTIRQ_HI_TASKLET,
-                                               t->func, NULL, DSS_FLAG_IN);
+                                               t->func, NULL, 0, DSS_FLAG_IN);
                                t->func(t->data);
                                dbg_snapshot_irq(DSS_FLAG_SOFTIRQ_HI_TASKLET,
-                                               t->func, NULL, DSS_FLAG_OUT);
+                                               t->func, NULL, start_time, DSS_FLAG_OUT);
                                tasklet_unlock(t);
                                continue;
                        }
index 9bf6177e78a48a1397952b5f244c632bacba1887..a32cf416acd5c6e17a989aacd662040b9aebbdb5 100644 (file)
@@ -42,6 +42,7 @@
 #include <linux/sched/sysctl.h>
 #include <linux/sched/nohz.h>
 #include <linux/sched/debug.h>
+#include <linux/sched/clock.h>
 #include <linux/slab.h>
 #include <linux/compat.h>
 #include <linux/debug-snapshot.h>
@@ -1256,6 +1257,7 @@ static void call_timer_fn(struct timer_list *timer, void (*fn)(unsigned long),
                          unsigned long data)
 {
        int count = preempt_count();
+       unsigned long long start_time;
 
 #ifdef CONFIG_LOCKDEP
        /*
@@ -1276,10 +1278,11 @@ static void call_timer_fn(struct timer_list *timer, void (*fn)(unsigned long),
         */
        lock_map_acquire(&lockdep_map);
 
+       dbg_snapshot_irq_var(start_time);
        trace_timer_expire_entry(timer);
-       dbg_snapshot_irq(DSS_FLAG_CALL_TIMER_FN, fn, NULL, DSS_FLAG_IN);
+       dbg_snapshot_irq(DSS_FLAG_CALL_TIMER_FN, fn, NULL, 0, DSS_FLAG_IN);
        fn(data);
-       dbg_snapshot_irq(DSS_FLAG_CALL_TIMER_FN, fn, NULL, DSS_FLAG_OUT);
+       dbg_snapshot_irq(DSS_FLAG_CALL_TIMER_FN, fn, NULL, start_time, DSS_FLAG_OUT);
        trace_timer_expire_exit(timer);
 
        lock_map_release(&lockdep_map);
index 23ebfb9b58a1f4d1bf809ee4388695e993060069..536664639b74676edae6f2f8221ffcd5f6895aa1 100644 (file)
@@ -2015,17 +2015,6 @@ config DEBUG_SNAPSHOT_CALLSTACK
        range 1 4
        default 4
 
-config DEBUG_SNAPSHOT_IRQ_EXIT
-       bool "Enable debugging of interrupt exit event by kevent"
-       depends on DEBUG_SNAPSHOT && !DEBUG_SNAPSHOT_MINIMIZED_MODE
-       default y
-
-config DEBUG_SNAPSHOT_IRQ_EXIT_THRESHOLD
-       int "threshold of detection(microsecond)"
-       depends on DEBUG_SNAPSHOT_IRQ_EXIT && !DEBUG_SNAPSHOT_MINIMIZED_MODE
-       range 0 1000000
-       default 0
-
 config DEBUG_SNAPSHOT_IRQ_DISABLED
        bool "Enable debugging of interrupt disable event by kevent(EXPERIMENTAL)"
        depends on DEBUG_SNAPSHOT && !DEBUG_SNAPSHOT_MINIMIZED_MODE
index 77838950441b07f924ea6cdb1996918007ef0b5d..83471dd119a77f218f578604235ceefd6ffb08e8 100644 (file)
@@ -87,9 +87,6 @@ struct dbg_snapshot_log_idx {
 #ifdef CONFIG_DEBUG_SNAPSHOT_IRQ_DISABLED
        atomic_t irqs_disabled_log_idx[DSS_NR_CPUS];
 #endif
-#ifdef CONFIG_DEBUG_SNAPSHOT_IRQ_EXIT
-       atomic_t irq_exit_log_idx[DSS_NR_CPUS];
-#endif
 #ifdef CONFIG_DEBUG_SNAPSHOT_REG
        atomic_t reg_log_idx[DSS_NR_CPUS];
 #endif
@@ -143,16 +140,6 @@ int dss_irqlog_exlist[DSS_EX_MAX_NUM] = {
        -1,
 };
 
-#ifdef CONFIG_DEBUG_SNAPSHOT_IRQ_EXIT
-int dss_irqexit_exlist[DSS_EX_MAX_NUM] = {
-/*  interrupt number ex) 152, 153, 154, */
-       -1,
-};
-
-unsigned int dss_irqexit_threshold =
-               CONFIG_DEBUG_SNAPSHOT_IRQ_EXIT_THRESHOLD;
-#endif
-
 #ifdef CONFIG_DEBUG_SNAPSHOT_REG
 struct dss_reg_list {
        size_t addr;
@@ -242,9 +229,6 @@ void __init dbg_snapshot_init_log_idx(void)
 #ifdef CONFIG_DEBUG_SNAPSHOT_IRQ_DISABLED
                atomic_set(&(dss_idx.irqs_disabled_log_idx[i]), -1);
 #endif
-#ifdef CONFIG_DEBUG_SNAPSHOT_IRQ_EXIT
-               atomic_set(&(dss_idx.irq_exit_log_idx[i]), -1);
-#endif
 #ifdef CONFIG_DEBUG_SNAPSHOT_REG
                atomic_set(&(dss_idx.reg_log_idx[i]), -1);
 #endif
@@ -395,32 +379,6 @@ bool dbg_snapshot_dumper_one(void *v_dumper, char *line, size_t size, size_t *le
                                                irq, irq_fn, en == DSS_FLAG_IN ? "IN" : "OUT");
                break;
        }
-#ifdef CONFIG_DEBUG_SNAPSHOT_IRQ_EXIT
-       case DSS_FLAG_IRQ_EXIT:
-       {
-               unsigned long end_time, latency;
-               int irq;
-
-               array_size = ARRAY_SIZE(dss_log->irq_exit[0]) - 1;
-               if (!dumper->active) {
-                       idx = (atomic_read(&dss_idx.irq_exit_log_idx[0]) + 1) & array_size;
-                       dumper->init_idx = idx;
-                       dumper->active = true;
-               }
-               ts = dss_log->irq_exit[cpu][idx].time;
-               rem_nsec = do_div(ts, NSEC_PER_SEC);
-
-               end_time = dss_log->irq_exit[cpu][idx].end_time;
-               latency = dss_log->irq_exit[cpu][idx].latency;
-               irq = dss_log->irq_exit[cpu][idx].irq;
-
-               *len = snprintf(line, size, "[%8lu.%09lu][%04d:CPU%u] irq:%6d,  "
-                                           "latency:%16zu,  end_time:%16zu\n",
-                                               (unsigned long)ts, rem_nsec / NSEC_PER_USEC, idx, cpu,
-                                               irq, latency, end_time);
-               break;
-       }
-#endif
 #ifdef CONFIG_DEBUG_SNAPSHOT_SPINLOCK
        case DSS_FLAG_SPINLOCK:
        {
@@ -885,7 +843,7 @@ void dbg_snapshot_thermal(void *data, unsigned int temp, char *name, unsigned in
 }
 #endif
 
-void dbg_snapshot_irq(int irq, void *fn, void *val, int en)
+void dbg_snapshot_irq(int irq, void *fn, void *val, unsigned long long start_time, int en)
 {
        struct dbg_snapshot_item *item = &dss_items[dss_desc.kevents_num];
        unsigned long flags;
@@ -896,62 +854,29 @@ void dbg_snapshot_irq(int irq, void *fn, void *val, int en)
        flags = pure_arch_local_irq_save();
        {
                int cpu = raw_smp_processor_id();
+               unsigned long long time, latency;
                unsigned long i;
 
-               for (i = 0; i < ARRAY_SIZE(dss_irqlog_exlist); i++) {
-                       if (irq == dss_irqlog_exlist[i]) {
-                               pure_arch_local_irq_restore(flags);
-                               return;
-                       }
-               }
+               time = cpu_clock(cpu);
+
+               if (start_time == 0)
+                       start_time = time;
+
+               latency = time - start_time;
                i = atomic_inc_return(&dss_idx.irq_log_idx[cpu]) &
                                (ARRAY_SIZE(dss_log->irq[0]) - 1);
 
-               dss_log->irq[cpu][i].time = cpu_clock(cpu);
+               dss_log->irq[cpu][i].time = time;
                dss_log->irq[cpu][i].sp = (unsigned long) current_stack_pointer;
                dss_log->irq[cpu][i].irq = irq;
                dss_log->irq[cpu][i].fn = (void *)fn;
-               dss_log->irq[cpu][i].action = (struct irqaction *)val;
+               dss_log->irq[cpu][i].desc = (struct irq_desc *)val;
+               dss_log->irq[cpu][i].latency = latency;
                dss_log->irq[cpu][i].en = en;
        }
        pure_arch_local_irq_restore(flags);
 }
 
-#ifdef CONFIG_DEBUG_SNAPSHOT_IRQ_EXIT
-void dbg_snapshot_irq_exit(unsigned int irq, unsigned long long start_time)
-{
-       struct dbg_snapshot_item *item = &dss_items[dss_desc.kevents_num];
-       unsigned long i;
-
-       if (unlikely(!dss_base.enabled || !item->entry.enabled))
-               return;
-
-       for (i = 0; i < ARRAY_SIZE(dss_irqexit_exlist); i++)
-               if (irq == dss_irqexit_exlist[i])
-                       return;
-       {
-               int cpu = raw_smp_processor_id();
-               unsigned long long time, latency;
-
-               i = atomic_inc_return(&dss_idx.irq_exit_log_idx[cpu]) &
-                       (ARRAY_SIZE(dss_log->irq_exit[0]) - 1);
-
-               time = cpu_clock(cpu);
-               latency = time - start_time;
-
-               if (unlikely(latency >
-                       (dss_irqexit_threshold * 1000))) {
-                       dss_log->irq_exit[cpu][i].latency = latency;
-                       dss_log->irq_exit[cpu][i].sp = (unsigned long) current_stack_pointer;
-                       dss_log->irq_exit[cpu][i].end_time = time;
-                       dss_log->irq_exit[cpu][i].time = start_time;
-                       dss_log->irq_exit[cpu][i].irq = irq;
-               } else
-                       atomic_dec(&dss_idx.irq_exit_log_idx[cpu]);
-       }
-}
-#endif
-
 #ifdef CONFIG_DEBUG_SNAPSHOT_SPINLOCK
 void dbg_snapshot_spinlock(void *v_lock, int en)
 {
index 68bab912ff09b42bcae66ad4c6b7d7e101c0a92e..c672225998a61d516f23595905a81ebf0ddf89c8 100644 (file)
@@ -137,22 +137,13 @@ struct dbg_snapshot_log {
                int irq;
                void *fn;
 #ifdef CONFIG_DEBUG_SNAPSHOT_LINUX_BUILD
-               struct irqaction *action;
+               struct irq_desc *desc;
 #else
-               void *action;
+               void *desc;
 #endif
+               unsigned long long latency;
                int en;
        } irq[DSS_NR_CPUS][DSS_LOG_MAX_NUM * 2];
-
-#ifdef CONFIG_DEBUG_SNAPSHOT_IRQ_EXIT
-       struct __irq_exit_log {
-               unsigned long long time;
-               unsigned long sp;
-               unsigned long long end_time;
-               unsigned long long latency;
-               int irq;
-       } irq_exit[DSS_NR_CPUS][DSS_LOG_MAX_NUM];
-#endif
 #ifdef CONFIG_DEBUG_SNAPSHOT_SPINLOCK
        struct __spinlock_log {
                unsigned long long time;