Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 00c73bf5 authored by Govindaraj Rajagopal's avatar Govindaraj Rajagopal
Browse files

msm: vidc: Rate limit frequently occurring error logs



Rate limit frequently occurring error logs to avoid cpu
watchdog timeout.

Change-Id: I9c7c1d22b93125934ff382f9547fe2964b8a2a72
Signed-off-by: default avatarGovindaraj Rajagopal <grajagop@codeaurora.org>
parent c434037e
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -519,3 +519,11 @@ void msm_vidc_debugfs_update(struct msm_vidc_inst *inst,
	}
}

int msm_vidc_check_ratelimit(void)
{
	static DEFINE_RATELIMIT_STATE(_rs,
				VIDC_DBG_SESSION_RATELIMIT_INTERVAL,
				VIDC_DBG_SESSION_RATELIMIT_BURST);
	return __ratelimit(&_rs);
}
+21 −0
Original line number Diff line number Diff line
@@ -15,6 +15,14 @@
#define VIDC_DBG_LABEL "msm_vidc"
#endif

/*
 * This enforces a rate limit: not more than 6 messages
 * in every 1s.
 */

#define VIDC_DBG_SESSION_RATELIMIT_INTERVAL (1 * HZ)
#define VIDC_DBG_SESSION_RATELIMIT_BURST 6

#define VIDC_DBG_TAG VIDC_DBG_LABEL ": %4s: "

/* To enable messages OR these values and
@@ -66,6 +74,18 @@ extern bool msm_vidc_dyn_gov_debug;
		} \
	} while (0)

#define dprintk_ratelimit(__level, __fmt, arg...) \
	do { \
		if (msm_vidc_debug & __level) { \
			if (msm_vidc_debug_out == VIDC_OUT_PRINTK && \
					msm_vidc_check_ratelimit()) { \
				pr_info(VIDC_DBG_TAG __fmt, \
					get_debug_level_str(__level),	\
					## arg); \
			} \
		} \
	} while (0)

#define MSM_VIDC_ERROR(value)					\
	do {	if (value)					\
			dprintk(VIDC_DBG, "BugOn");		\
@@ -81,6 +101,7 @@ struct dentry *msm_vidc_debugfs_init_inst(struct msm_vidc_inst *inst,
void msm_vidc_debugfs_deinit_inst(struct msm_vidc_inst *inst);
void msm_vidc_debugfs_update(struct msm_vidc_inst *inst,
		enum msm_vidc_debugfs_event e);
int msm_vidc_check_ratelimit(void);

static inline char *get_debug_level_str(int level)
{
+1 −1
Original line number Diff line number Diff line
@@ -949,7 +949,7 @@ int msm_vidc_smmu_fault_handler(struct iommu_domain *domain,

	if (core->smmu_fault_handled) {
		if (core->resources.non_fatal_pagefaults) {
			dprintk(VIDC_ERR,
			dprintk_ratelimit(VIDC_ERR,
					"%s: non-fatal pagefault address: %lx\n",
					__func__, iova);
			return 0;