All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sudeep Holla <sudeep.holla@arm.com>
To: Viresh Kumar <viresh.kumar@linaro.org>,
	"Rafael J . Wysocki" <rjw@rjwysocki.net>
Cc: Sudeep Holla <sudeep.holla@arm.com>,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [RFC PATCH] cpufreq: mark duplicate frequencies as invalid and continue as normal
Date: Tue, 22 Oct 2019 18:32:15 +0100	[thread overview]
Message-ID: <20191022173215.13350-1-sudeep.holla@arm.com> (raw)

Currently if we encounter duplicate frequency table entries, we abort
the validation and return error immediately. Instead of failing, we
can mark the entry as invalid and continue to function normal.

Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
---
 drivers/cpufreq/freq_table.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Hi Viresh,

Since commit da0c6dc00c69 ("cpufreq: Handle sorted frequency tables more
efficiently"), I seem to have modified the firmware entry on my TC2 to
drop 500MHz and had not seen the issue with duplicate entries and had
totally forgotten about it.

Recently I reverted back to original setting as I corrupted it and
started seeing this issues. I don't know the background for raising
duplicates as fatal error but we did allow it when we add arm_big_little.c
and hence this RFC. If there are known issues with this approach, I can
continue with changed firmware config.

With switcher, we have:
(little cluster)
Virt: 175 MHz, 200 MHz, 250 MHz, 300 MHz, 350 MHz, 400 MHz, 450 MHz, 500 MHz
Actu: 350 MHz, 400 MHz, 500 MHz, 600 MHz, 700 MHz, 800 MHz, 900 MHz, 1000 MHz
(big cluster)
500 MHz, 600 MHz, 700 MHz, 800 MHz, 900 MHz, 1000 MHz, 1.10 GHz, 1.20 GHz

with 500 MHz duplicate in merged table.

Regards,
Sudeep

diff --git a/drivers/cpufreq/freq_table.c b/drivers/cpufreq/freq_table.c
index ded427e0a488..e9bf287846d6 100644
--- a/drivers/cpufreq/freq_table.c
+++ b/drivers/cpufreq/freq_table.c
@@ -305,9 +305,10 @@ static int set_freq_table_sorted(struct cpufreq_policy *policy)
 		}
 
 		if (pos->frequency == prev->frequency) {
-			pr_warn("Duplicate freq-table entries: %u\n",
+			pr_warn("Duplicate freq-table entries: %u marking it invalid\n,",
 				pos->frequency);
-			return -EINVAL;
+			pos->frequency = CPUFREQ_ENTRY_INVALID;
+			continue;
 		}
 
 		/* Frequency increased from prev to pos */
-- 
2.17.1


             reply	other threads:[~2019-10-22 17:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-22 17:32 Sudeep Holla [this message]
2019-10-23  3:26 ` [RFC PATCH] cpufreq: mark duplicate frequencies as invalid and continue as normal Viresh Kumar
2019-10-23  9:06   ` Sudeep Holla
2019-10-23  9:14     ` Viresh Kumar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191022173215.13350-1-sudeep.holla@arm.com \
    --to=sudeep.holla@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=viresh.kumar@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.