All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nishanth Menon <nm@ti.com>
To: Kevin Hilman <khilman@deeprootsystems.com>
Cc: "me@felipebalbi.com" <me@felipebalbi.com>,
	Linux-Omap <linux-omap@vger.kernel.org>,
	"K, Ambresh" <ambresh@ti.com>,
	"Cousson, Benoit" <b-cousson@ti.com>,
	Eduardo Valentin <eduardo.valentin@nokia.com>,
	Phil Carmody <ext-phil.2.carmody@nokia.com>,
	"Premi, Sanjeev" <premi@ti.com>,
	Tero Kristo <tero.kristo@nokia.com>,
	"Gopinath, Thara" <thara@ti.com>
Subject: Re: [PM-WIP-OPP][PATCH 1/4] omap3: pm: cpufreq: BUG_ON cleanup
Date: Fri, 19 Mar 2010 16:53:57 -0500	[thread overview]
Message-ID: <4BA3F275.3010101@ti.com> (raw)
In-Reply-To: <87pr30ujdv.fsf@deeprootsystems.com>

Kevin Hilman had written, on 03/19/2010 03:49 PM, the following:
> Nishanth Menon <nm@ti.com> writes:
> 
>> Kevin Hilman had written, on 03/19/2010 01:42 PM, the following:
>>> Felipe Balbi <me@felipebalbi.com> writes:
>>>
>>>> On Fri, Mar 19, 2010 at 10:46:54AM -0700, Kevin Hilman wrote:
>>>>> IMO, Using BUG* macros usually indicates improper or incomplete error
>>>>> handling rather than a real catastrophic system failure.
>>>> on the other hand a kernel oops and system hang will always get
>>>> noted. Rather than a WARN() which simply sits in the log buffer.
>>> Of course, but what I'm trying to avoid is making other people deal
>>> with a BUG inserted by a developer when proper error checking and
>>> recovery is what is really needed.
>>>
>> I respect your views. but a few moments of thoughts:
>> how would the recovery look like? I can think of 2 options here.. do
>> share your views:
>>
>> Option 1:
>> if (opp_init_list(OPP_MPU, omap3_opp_def_list[0])) {
>> 	WARN("dsp OPP table registration failed");
>> 	return;
>> }
>> if (opp_init_list(OPP_L3, omap3_opp_def_list[1])) {
>> 	WARN("dsp OPP table registration failed");
>> 	return;
>> }
>> if (opp_init_list(OPP_DSP, omap3_opp_def_list[2])) {
>> 	WARN("dsp OPP table registration failed");
>> 	return;
>> }
>>
>> Option 2:
>> 	if (opp_init_list(OPP_MPU, omap3_opp_def_list[0]))
>> 		return;
>> 	if (opp_init_list(OPP_L3, omap3_opp_def_list[1]))
>> 		goto mpu_disable;
>> 	if (opp_init_list(OPP_DSP, omap3_opp_def_list[2]))
>> 		goto l3_disable;
>> 	return;
>>
>> l3_disable:
>> 	freq = 0;
>> 	while (!IS_ERR(opp = opp_find_freq_ceil(OPP_L3, &freq)) {
>> 		opp_disable(opp);
>> 		freq++;
>> 	}
>> mpu_disable:
>> 	freq = 0;
>> 	while (!IS_ERR(opp = opp_find_freq_ceil(OPP_MPU, &freq)) {
>> 		opp_disable(opp);
>> 		freq++;
>> 	}
>> 	WARN("Registration of OPP tables failed!!");
>> 	return;
>>
>> Option 1 is a bad idea as it leaves the system in an invalid state
>> Option 2 is the better idea as we dont have a opp_delete option(not
>> required usually).
> 
> I'm OK with either actually, as either is better than BUG_ON()
> instead of error checking.
> 
> With option 1, the system is not really in an invalid state, just and
> untested state.  What will happen is users of the OPP API will error
> codes when trying to get OPPs and they should fail gracefully as well.
except if L3/DSP reg fails, you allow MPU freqs configured by no DSP or 
L3 freq.. prefer the option 2 in that respect.. it is binary - you get 
all the configurations done right OR you dont.
> 
> Once again, this is about proper error checking, and robustness, not
> about causing a panic() when something (relatively) minor happens.
> 
>> All that code for something that will almost never happen?	
> 
> Yes.  That's what error checking is all about.
> 
> Kevin
> 
> P.S. I can't find the ref atm, but I mentioned not liking the BUG_ON
>      early in the review of the OPP layer, and it would need to be
>      cleaned up before upstream merge.
alrite alrite.. i am black and blue with the beatings ;). I am going 
with option 2 if there are no other objections.. will send out the patch 
after collating other comments.

-- 
Regards,
Nishanth Menon

      reply	other threads:[~2010-03-19 21:54 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-18 18:44 [PM-WIP-OPP][PATCH 0/4] few opp layer cleanups Nishanth Menon
2010-03-18 18:44 ` [PM-WIP-OPP][PATCH 1/4] omap3: pm: cpufreq: BUG_ON cleanup Nishanth Menon
2010-03-18 18:44   ` [PM-WIP-OPP][PATCH 2/4] omap: pm: opp: twl: use DIV_ROUND_UP Nishanth Menon
2010-03-18 18:44     ` [PM-WIP-OPP][PATCH 3/4] omap: pm: opp: add ability to store data per opp Nishanth Menon
2010-03-18 18:44       ` [PM-WIP-OPP][PATCH 4/4] omap3: srf: remove hardcoded opp dependency Nishanth Menon
2010-03-19 14:47         ` Felipe Balbi
2010-03-19 15:36           ` Nishanth Menon
2010-03-19 10:14       ` [PM-WIP-OPP][PATCH 3/4] omap: pm: opp: add ability to store data per opp Cousson, Benoit
2010-03-19 14:27         ` Nishanth Menon
2010-03-19 14:43       ` Felipe Balbi
2010-03-19 15:25         ` Nishanth Menon
2010-03-19 17:47           ` Felipe Balbi
2010-03-19 18:10             ` Nishanth Menon
2010-03-21 21:50           ` Cousson, Benoit
2010-03-22 13:29             ` Nishanth Menon
2010-03-22 17:46               ` Cousson, Benoit
2010-03-22 18:25                 ` Nishanth Menon
2010-03-23  5:06                   ` Gopinath, Thara
2010-03-23 13:00                     ` Nishanth Menon
2010-03-23 16:12                       ` Cousson, Benoit
2010-03-23 20:04                         ` Nishanth Menon
2010-03-18 22:49   ` [PM-WIP-OPP][PATCH 1/4] omap3: pm: cpufreq: BUG_ON cleanup Kevin Hilman
2010-03-19 14:21     ` Nishanth Menon
2010-03-19 14:50       ` Felipe Balbi
2010-03-19 17:46       ` Kevin Hilman
2010-03-19 17:52         ` Felipe Balbi
2010-03-19 18:42           ` Kevin Hilman
2010-03-19 19:56             ` Nishanth Menon
2010-03-19 20:49               ` Kevin Hilman
2010-03-19 21:53                 ` Nishanth Menon [this message]

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=4BA3F275.3010101@ti.com \
    --to=nm@ti.com \
    --cc=ambresh@ti.com \
    --cc=b-cousson@ti.com \
    --cc=eduardo.valentin@nokia.com \
    --cc=ext-phil.2.carmody@nokia.com \
    --cc=khilman@deeprootsystems.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=me@felipebalbi.com \
    --cc=premi@ti.com \
    --cc=tero.kristo@nokia.com \
    --cc=thara@ti.com \
    /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.