From b0dfbcd1e9aa2a56666175d7b6e2dbfb67924d1f Mon Sep 17 00:00:00 2001 From: Hanumath Prasad Date: Wed, 16 Jan 2019 18:31:57 -0800 Subject: [PATCH] PM / devfreq: bimc-bwmon: set a floor_mbps for irq threshold Interrupt storm happens when bwmon is enabled for GPU. This is mainly due to constant low traffic observed with GPU while doing memory read/write. So as the data rates read from counters are low and so the threshold set for triggering the interrupt also set as low, which in turn causes huge number of interrupts. Avoid this by setting a minimum floor for the irq threshold. Change-Id: I190fad5108bc24afcb67bec5809485380ee3662e Signed-off-by: Hanumath Prasad --- drivers/devfreq/bimc-bwmon.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/devfreq/bimc-bwmon.c b/drivers/devfreq/bimc-bwmon.c index cbe35fb6e97b..68d31ca738a9 100644 --- a/drivers/devfreq/bimc-bwmon.c +++ b/drivers/devfreq/bimc-bwmon.c @@ -32,6 +32,13 @@ #define MON_MASK(m) ((m)->base + 0x298) #define MON_MATCH(m) ((m)->base + 0x29C) +/* + * Don't set the threshold lower than this value. This helps avoid + * threshold IRQs when the traffic is close to zero and even small + * changes can exceed the threshold percentage. + */ +#define FLOOR_MBPS 100UL + struct bwmon_spec { bool wrap_on_thres; bool overflow; @@ -195,7 +202,7 @@ static unsigned long meas_bw_and_set_irq(struct bw_hwmon *hw, * multiple times before the IRQ is processed. */ if (likely(!m->spec->wrap_on_thres)) - limit = mbps_to_bytes(mbps, sample_ms, tol); + limit = mbps_to_bytes(max(mbps, FLOOR_MBPS), sample_ms, tol); else limit = mbps_to_bytes(max(mbps, 400UL), sample_ms, tol);