summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJone Chou <jonechou@google.com>2023-07-26 14:11:59 +0800
committerTreehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com>2023-07-26 17:14:49 +0000
commit06f9c98ac26423811a73bb7502d2871f5ec56583 (patch)
tree9126582b24c989f40ce945ccee2e3b64b8dc3e33
parent3cc639f0bd22f3b4fb8990bb21c271160fa9c44c (diff)
downloadgs-06f9c98ac26423811a73bb7502d2871f5ec56583.tar.gz
Revert "soc/google: DSS: fix dss_log items"
This reverts commit 50e8dc8beae71e7342a50b92658077ac860c55f9. BUG: 291109325 Signed-off-by: Jone Chou <jonechou@google.com> Change-Id: I66045c3bd2ac77ea139a0c393e2cc6ff996c1179
-rw-r--r--drivers/soc/google/debug/debug-snapshot-local.h1
-rw-r--r--drivers/soc/google/debug/debug-snapshot-log.c214
-rw-r--r--drivers/soc/google/debug/debug-snapshot.c2
-rw-r--r--include/soc/google/debug-snapshot-log.h5
-rw-r--r--include/soc/google/debug-snapshot.h5
-rw-r--r--include/soc/google/pixel-suspend-diag.h7
6 files changed, 44 insertions, 190 deletions
diff --git a/drivers/soc/google/debug/debug-snapshot-local.h b/drivers/soc/google/debug/debug-snapshot-local.h
index d759701e7..d28fe93ba 100644
--- a/drivers/soc/google/debug/debug-snapshot-local.h
+++ b/drivers/soc/google/debug/debug-snapshot-local.h
@@ -74,7 +74,6 @@ struct dbg_snapshot_dpm {
unsigned int p_el1_serror;
};
-void dbg_snapshot_register_vh_log(void);
extern void dbg_snapshot_init_log(void);
extern void dbg_snapshot_init_dpm(void);
extern void dbg_snapshot_init_utils(void);
diff --git a/drivers/soc/google/debug/debug-snapshot-log.c b/drivers/soc/google/debug/debug-snapshot-log.c
index b5c8a83e5..2193572c7 100644
--- a/drivers/soc/google/debug/debug-snapshot-log.c
+++ b/drivers/soc/google/debug/debug-snapshot-log.c
@@ -22,10 +22,6 @@
#include "debug-snapshot-local.h"
#include <trace/events/power.h>
-#include <trace/events/sched.h>
-#include <trace/events/workqueue.h>
-#include <trace/events/irq.h>
-#include <trace/events/timer.h>
struct dbg_snapshot_log_item dss_log_items[] = {
[DSS_LOG_TASK_ID] = {DSS_LOG_TASK, {0, 0, 0, false}, },
@@ -250,8 +246,8 @@ void dbg_snapshot_set_enable_log_item(const char *name, int en)
static unsigned long dbg_snapshot_suspend(const char *log, struct device *dev,
int event, int en)
{
- unsigned long i = atomic_fetch_inc(&dss_log_misc.suspend_log_idx) %
- ARRAY_SIZE(dss_log->suspend);
+ unsigned long i = atomic_fetch_inc(&dss_log_misc.suspend_log_idx) &
+ (ARRAY_SIZE(dss_log->suspend) - 1);
dss_log->suspend[i].time = local_clock();
dss_log->suspend[i].log = log ? log : NULL;
@@ -270,13 +266,15 @@ static unsigned long dbg_snapshot_suspend(const char *log, struct device *dev,
static void dbg_snapshot_suspend_resume(void *ignore, const char *action,
int event, bool start)
{
- unsigned long curr_index;
-
- curr_index = dbg_snapshot_suspend(action, NULL, event,
- start ? DSS_FLAG_IN : DSS_FLAG_OUT);
+#if IS_ENABLED(CONFIG_PIXEL_SUSPEND_DIAG)
+ unsigned long curr_index =
+#endif
+ dbg_snapshot_suspend(action, NULL, event,
+ start ? DSS_FLAG_IN : DSS_FLAG_OUT);
- if (IS_ENABLED(CONFIG_PIXEL_SUSPEND_DIAG))
- pixel_suspend_diag_suspend_resume(dss_log, action, start, curr_index);
+#if IS_ENABLED(CONFIG_PIXEL_SUSPEND_DIAG)
+ pixel_suspend_diag_suspend_resume(dss_log, action, start, curr_index);
+#endif
}
void dbg_snapshot_dev_pm_cb_start(void *ignore, struct device *dev,
@@ -287,65 +285,13 @@ void dbg_snapshot_dev_pm_cb_start(void *ignore, struct device *dev,
void dbg_snapshot_dev_pm_cb_end(void *ignore, struct device *dev, int error)
{
- int ret = 0;
-
- if (IS_ENABLED(CONFIG_PIXEL_SUSPEND_DIAG))
- ret = pixel_suspend_diag_dev_pm_cb_end(dss_log, dss_get_first_suspend_log_idx(),
- dss_get_last_suspend_log_idx(), dev);
-
- if (!ret)
+#if IS_ENABLED(CONFIG_PIXEL_SUSPEND_DIAG)
+ if (!pixel_suspend_diag_dev_pm_cb_end(dss_log, dss_get_first_suspend_log_idx(),
+ dss_get_last_suspend_log_idx(), dev))
+#endif
dbg_snapshot_suspend(NULL, dev, error, DSS_FLAG_OUT);
}
-static void dbg_snapshot_task(int cpu, struct task_struct *v_task)
-{
- unsigned long i;
-
- if (!dbg_snapshot_is_log_item_enabled(DSS_LOG_TASK_ID))
- return;
-
- i = atomic_fetch_inc(&dss_log_misc.task_log_idx[cpu]) %
- ARRAY_SIZE(dss_log->task[0]);
- dss_log->task[cpu][i].time = cpu_clock(cpu);
- dss_log->task[cpu][i].task = v_task;
- dss_log->task[cpu][i].pid = v_task->pid;
- dss_log->task[cpu][i].se_exec_start = v_task->se.exec_start;
- strncpy(dss_log->task[cpu][i].task_comm, v_task->comm, TASK_COMM_LEN - 1);
-}
-
-static void dbg_snapshot_sched_switch(void *ignore, bool preempt,
- struct task_struct *prev,
- struct task_struct *next)
-{
- dbg_snapshot_task(raw_smp_processor_id(), next);
-}
-
-void dbg_snapshot_work(work_func_t fn, int en)
-{
- int cpu = raw_smp_processor_id();
- unsigned long i;
-
- if (!dbg_snapshot_is_log_item_enabled(DSS_LOG_WORK_ID))
- return;
-
- i = atomic_fetch_inc(&dss_log_misc.work_log_idx[cpu]) %
- ARRAY_SIZE(dss_log->work[0]);
- dss_log->work[cpu][i].time = cpu_clock(cpu);
- dss_log->work[cpu][i].fn = fn;
- dss_log->work[cpu][i].en = en;
-}
-
-static void dbg_snapshot_wq_start(void *ignore, struct work_struct *work)
-{
- dbg_snapshot_work(work->func, DSS_FLAG_IN);
-}
-
-static void dbg_snapshot_wq_end(void *ignore, struct work_struct *work,
- work_func_t func)
-{
- dbg_snapshot_work(func, DSS_FLAG_OUT);
-}
-
void dbg_snapshot_cpuidle_mod(char *modes, unsigned int state, s64 diff, int en)
{
int cpu = raw_smp_processor_id();
@@ -354,8 +300,8 @@ void dbg_snapshot_cpuidle_mod(char *modes, unsigned int state, s64 diff, int en)
if (!dbg_snapshot_is_log_item_enabled(DSS_LOG_CPUIDLE_ID))
return;
- i = atomic_fetch_inc(&dss_log_misc.cpuidle_log_idx[cpu]) %
- ARRAY_SIZE(dss_log->cpuidle[0]);
+ i = atomic_fetch_inc(&dss_log_misc.cpuidle_log_idx[cpu]) &
+ (ARRAY_SIZE(dss_log->cpuidle[0]) - 1);
dss_log->cpuidle[cpu][i].time = local_clock();
dss_log->cpuidle[cpu][i].modes = modes;
dss_log->cpuidle[cpu][i].state = state;
@@ -365,85 +311,23 @@ void dbg_snapshot_cpuidle_mod(char *modes, unsigned int state, s64 diff, int en)
}
EXPORT_SYMBOL_GPL(dbg_snapshot_cpuidle_mod);
-void dbg_snapshot_irq(int irq, void *fn, int en)
-{
- unsigned long flags, i;
- int cpu = raw_smp_processor_id();
-
- if (!dbg_snapshot_is_log_item_enabled(DSS_LOG_IRQ_ID))
- return;
-
- i = atomic_fetch_inc(&dss_log_misc.irq_log_idx[cpu]) %
- ARRAY_SIZE(dss_log->irq[0]);
-
- flags = arch_local_irq_save();
- dss_log->irq[cpu][i].time = cpu_clock(cpu);
- dss_log->irq[cpu][i].irq = irq;
- dss_log->irq[cpu][i].fn = fn;
- dss_log->irq[cpu][i].desc = irq_to_desc(irq);
- dss_log->irq[cpu][i].en = en;
- arch_local_irq_restore(flags);
-}
-
-static void dbg_snapshot_irq_entry(void *ignore, int irq,
- struct irqaction *action)
-{
- dbg_snapshot_irq(irq, action->handler, DSS_FLAG_IN);
-}
-
-static void dbg_snapshot_irq_exit(void *ignore, int irq,
- struct irqaction *action, int ret)
-{
- dbg_snapshot_irq(irq, action->handler, DSS_FLAG_OUT);
-}
-
-void dbg_snapshot_hrtimer(void *timer, s64 now, void *fn, int en)
-{
- int cpu = raw_smp_processor_id();
- unsigned long i;
-
- if (!dbg_snapshot_is_log_item_enabled(DSS_LOG_HRTIMER_ID))
- return;
-
- i = atomic_fetch_inc(&dss_log_misc.hrtimer_log_idx[cpu]) %
- ARRAY_SIZE(dss_log->hrtimer[0]);
- dss_log->hrtimer[cpu][i].time = cpu_clock(cpu);
- dss_log->hrtimer[cpu][i].now = now;
- dss_log->hrtimer[cpu][i].timer = (struct hrtimer *)timer;
- dss_log->hrtimer[cpu][i].fn = fn;
- dss_log->hrtimer[cpu][i].en = en;
-}
-
-static void dbg_snapshot_hrtimer_entry(void *ignore, struct hrtimer *timer,
- ktime_t *now)
-{
- dbg_snapshot_hrtimer(timer, *now, timer->function, DSS_FLAG_IN);
-}
-
-static void dbg_snapshot_hrtimer_exit(void *ignore, struct hrtimer *timer)
-{
- dbg_snapshot_hrtimer(timer, 0, timer->function, DSS_FLAG_OUT);
-}
-
void dbg_snapshot_regulator(unsigned long long timestamp, char *f_name,
unsigned int addr, unsigned int volt,
unsigned int rvolt, int en)
{
unsigned long i;
- int ret = 0;
if (!dbg_snapshot_is_log_item_enabled(DSS_LOG_REGULATOR_ID))
return;
- i = atomic_fetch_inc(&dss_log_misc.regulator_log_idx) %
- ARRAY_SIZE(dss_log->regulator);
+ i = atomic_fetch_inc(&dss_log_misc.regulator_log_idx) &
+ (ARRAY_SIZE(dss_log->regulator) - 1);
dss_log->regulator[i].time = local_clock();
dss_log->regulator[i].cpu = raw_smp_processor_id();
dss_log->regulator[i].acpm_time = timestamp;
- ret = strscpy(dss_log->regulator[i].name, f_name, sizeof(dss_log->regulator[i].name));
- if (ret)
- dss_log->regulator[i].name[sizeof(dss_log->regulator[i].name) - 1] = '\0';
+ strncpy(dss_log->regulator[i].name, f_name,
+ min_t(int, strlen(f_name), SZ_16 - 1));
dss_log->regulator[i].reg = addr;
dss_log->regulator[i].en = en;
dss_log->regulator[i].voltage = volt;
@@ -459,8 +343,8 @@ void dbg_snapshot_thermal(struct exynos_tmu_data *data, unsigned int temp,
if (!dbg_snapshot_is_log_item_enabled(DSS_LOG_THERMAL_ID))
return;
- i = atomic_fetch_inc(&dss_log_misc.thermal_log_idx) %
- ARRAY_SIZE(dss_log->thermal);
+ i = atomic_fetch_inc(&dss_log_misc.thermal_log_idx) &
+ (ARRAY_SIZE(dss_log->thermal) - 1);
dss_log->thermal[i].time = local_clock();
dss_log->thermal[i].cpu = raw_smp_processor_id();
@@ -480,8 +364,8 @@ void dbg_snapshot_clk(struct clk_hw *clock, const char *func_name,
if (!dbg_snapshot_is_log_item_enabled(DSS_LOG_CLK_ID))
return;
- i = atomic_fetch_inc(&dss_log_misc.clk_log_idx) %
- ARRAY_SIZE(dss_log->clk);
+ i = atomic_fetch_inc(&dss_log_misc.clk_log_idx) &
+ (ARRAY_SIZE(dss_log->clk) - 1);
dss_log->clk[i].time = local_clock();
dss_log->clk[i].mode = mode;
@@ -498,8 +382,8 @@ void dbg_snapshot_pmu(int id, const char *func_name, int mode)
if (!dbg_snapshot_is_log_item_enabled(DSS_LOG_PMU_ID))
return;
- i = atomic_fetch_inc(&dss_log_misc.pmu_log_idx) %
- ARRAY_SIZE(dss_log->pmu);
+ i = atomic_fetch_inc(&dss_log_misc.pmu_log_idx) &
+ (ARRAY_SIZE(dss_log->pmu) - 1);
dss_log->pmu[i].time = local_clock();
dss_log->pmu[i].mode = mode;
@@ -519,8 +403,8 @@ void dbg_snapshot_freq(int type, unsigned long old_freq,
if (!dbg_snapshot_is_log_item_enabled(DSS_LOG_FREQ_ID))
return;
- i = atomic_fetch_inc(&dss_log_misc.freq_log_idx[type]) %
- ARRAY_SIZE(dss_log->freq[0]);
+ i = atomic_fetch_inc(&dss_log_misc.freq_log_idx[type]) &
+ (ARRAY_SIZE(dss_log->freq[0]) - 1);
dss_log->freq[type][i].time = local_clock();
dss_log->freq[type][i].cpu = raw_smp_processor_id();
@@ -539,8 +423,8 @@ void dbg_snapshot_dm(int type, unsigned long min, unsigned long max,
if (!dbg_snapshot_is_log_item_enabled(DSS_LOG_DM_ID))
return;
- i = atomic_fetch_inc(&dss_log_misc.dm_log_idx) %
- ARRAY_SIZE(dss_log->dm);
+ i = atomic_fetch_inc(&dss_log_misc.dm_log_idx) &
+ (ARRAY_SIZE(dss_log->dm) - 1);
dss_log->dm[i].time = local_clock();
dss_log->dm[i].cpu = raw_smp_processor_id();
@@ -561,8 +445,8 @@ void dbg_snapshot_acpm(unsigned long long timestamp, const char *log,
if (!dbg_snapshot_is_log_item_enabled(DSS_LOG_ACPM_ID))
return;
- i = atomic_fetch_inc(&dss_log_misc.acpm_log_idx) %
- ARRAY_SIZE(dss_log->acpm);
+ i = atomic_fetch_inc(&dss_log_misc.acpm_log_idx) &
+ (ARRAY_SIZE(dss_log->acpm) - 1);
dss_log->acpm[i].time = local_clock();
dss_log->acpm[i].acpm_time = timestamp;
@@ -581,8 +465,8 @@ void dbg_snapshot_printk(const char *fmt, ...)
if (!dbg_snapshot_is_log_item_enabled(DSS_LOG_PRINTK_ID))
return;
- i = atomic_fetch_inc(&dss_log_misc.print_log_idx) %
- ARRAY_SIZE(dss_log->print);
+ i = atomic_fetch_inc(&dss_log_misc.print_log_idx) &
+ (ARRAY_SIZE(dss_log->print) - 1);
va_start(args, fmt);
vsnprintf(dss_log->print[i].log, sizeof(dss_log->print[i].log),
@@ -840,36 +724,6 @@ void dbg_snapshot_init_log(void)
log_item_set_filed(PRINTK, print);
}
-void dbg_snapshot_register_vh_log(void)
-{
- if (dss_log_items[DSS_LOG_TASK_ID].entry.enabled) {
- if (register_trace_sched_switch(dbg_snapshot_sched_switch, NULL))
- pr_err("dss task log VH register failed\n");
- }
-
- if (dss_log_items[DSS_LOG_WORK_ID].entry.enabled) {
- if (register_trace_workqueue_execute_start(dbg_snapshot_wq_start, NULL))
- pr_err("dss wq start log VH register failed\n");
-
- if (register_trace_workqueue_execute_end(dbg_snapshot_wq_end, NULL))
- pr_err("dss wq end log VH register failed\n");
- }
-
- if (dss_log_items[DSS_LOG_IRQ_ID].entry.enabled) {
- if (register_trace_irq_handler_entry(dbg_snapshot_irq_entry, NULL))
- pr_err("dss irq handler start log VH register failed\n");
- if (register_trace_irq_handler_exit(dbg_snapshot_irq_exit, NULL))
- pr_err("dss irq handler end log VH register failed\n");
- }
-
- if (dss_log_items[DSS_LOG_HRTIMER_ID].entry.enabled) {
- if (register_trace_hrtimer_expire_entry(dbg_snapshot_hrtimer_entry, NULL))
- pr_err("dss hrtimer entry log VH register failed\n");
- if (register_trace_hrtimer_expire_exit(dbg_snapshot_hrtimer_exit, NULL))
- pr_err("dss hrtimer exit log VH register failed\n");
- }
-}
-
void dbg_snapshot_start_log(void)
{
struct property *prop;
diff --git a/drivers/soc/google/debug/debug-snapshot.c b/drivers/soc/google/debug/debug-snapshot.c
index 924857f95..96f9faf3f 100644
--- a/drivers/soc/google/debug/debug-snapshot.c
+++ b/drivers/soc/google/debug/debug-snapshot.c
@@ -623,8 +623,6 @@ static int dbg_snapshot_probe(struct platform_device *pdev)
dbg_snapshot_init_utils();
dbg_snapshot_init_dpm();
- dbg_snapshot_register_vh_log();
-
dbg_snapshot_set_slcdump_status();
dbg_snapshot_set_enable(true);
diff --git a/include/soc/google/debug-snapshot-log.h b/include/soc/google/debug-snapshot-log.h
index 599ede624..552876901 100644
--- a/include/soc/google/debug-snapshot-log.h
+++ b/include/soc/google/debug-snapshot-log.h
@@ -41,7 +41,9 @@ struct task_log {
struct work_log {
unsigned long long time;
+ struct worker *worker;
work_func_t fn;
+ char task_comm[TASK_COMM_LEN];
int en;
};
@@ -74,6 +76,7 @@ struct irq_log {
int irq;
void *fn;
struct irq_desc *desc;
+ unsigned long long latency;
int en;
};
@@ -113,7 +116,7 @@ struct dm_log {
struct hrtimer_log {
unsigned long long time;
- s64 now;
+ unsigned long long now;
struct hrtimer *timer;
void *fn;
int en;
diff --git a/include/soc/google/debug-snapshot.h b/include/soc/google/debug-snapshot.h
index 2361859e7..590026c57 100644
--- a/include/soc/google/debug-snapshot.h
+++ b/include/soc/google/debug-snapshot.h
@@ -82,8 +82,12 @@ extern unsigned int dbg_snapshot_get_freq_size(void);
extern void *dbg_snapshot_get_suspend_diag(void);
#define dbg_snapshot_get_timestamp() local_clock()
+extern void dbg_snapshot_task(int cpu, void *v_task);
+extern void dbg_snapshot_work(void *worker, void *v_task, work_func_t fn, int en);
extern void dbg_snapshot_cpuidle(char *modes, unsigned int state, s64 diff, int en);
extern void dbg_snapshot_cpuidle_mod(char *modes, unsigned int state, s64 diff, int en);
+extern void dbg_snapshot_irq(int irq, void *fn, void *val, unsigned long long time,
+ int en);
extern void dbg_snapshot_clk(struct clk_hw *clock, const char *func_name,
unsigned long arg, int mode);
extern void dbg_snapshot_regulator(unsigned long long timestamp, char *f_name,
@@ -93,6 +97,7 @@ extern void dbg_snapshot_acpm(unsigned long long timestamp, const char *log,
unsigned int data);
extern void dbg_snapshot_thermal(struct exynos_tmu_data *data, unsigned int temp,
char *name, unsigned long long max_cooling);
+extern void dbg_snapshot_hrtimer(void *timer, s64 *now, void *fn, int en);
extern void dbg_snapshot_pmu(int id, const char *func_name, int mode);
extern void dbg_snapshot_freq(int type, unsigned long old_freq,
unsigned long target_freq, int en);
diff --git a/include/soc/google/pixel-suspend-diag.h b/include/soc/google/pixel-suspend-diag.h
index 163a1246a..d3ddbcb90 100644
--- a/include/soc/google/pixel-suspend-diag.h
+++ b/include/soc/google/pixel-suspend-diag.h
@@ -8,15 +8,10 @@
#ifndef SUSPEND_DIAG_H
#define SUSPEND_DIAG_H
-#if IS_ENABLED(CONFIG_PIXEL_SUSPEND_DIAG)
void *pixel_suspend_diag_get_info(void);
void pixel_suspend_diag_suspend_resume(void *dbg_snapshot_log, const char *action, bool start,
uint64_t curr_index);
bool pixel_suspend_diag_dev_pm_cb_end(void *dbg_snapshot_log, uint64_t first_log_idx,
uint64_t last_log_idx, struct device *dev);
-#else
-#define pixel_suspend_diag_get_info() (0)
-#define pixel_suspend_diag_suspend_resume(a, b, c, d) do { } while (0)
-#define pixel_suspend_diag_dev_pm_cb_end(a, b, c, d) (0)
-#endif
+
#endif /* SUSPEND_DIAG_H */