All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nathan Lynch <nathanl@linux.ibm.com>
To: Tyrel Datwyler <tyreld@linux.ibm.com>,
	Mahesh Salgaonkar <mahesh@linux.ibm.com>,
	linuxppc-dev <linuxppc-dev@ozlabs.org>
Cc: lxie@us.ibm.com, Oliver O'Halloran <oohall@gmail.com>
Subject: Re: [PATCH] powerpc/rtas: Introduce rtas_get_sensor_nonblocking() for pci hotplug driver.
Date: Mon, 29 Nov 2021 19:06:29 -0600	[thread overview]
Message-ID: <87sfveo3je.fsf@linux.ibm.com> (raw)
In-Reply-To: <2083eff5-a00e-5a2b-4e83-20deb302a756@linux.ibm.com>

Tyrel Datwyler <tyreld@linux.ibm.com> writes:
> On 11/29/21 12:58 AM, Mahesh Salgaonkar wrote:
>> -int rtas_get_sensor_fast(int sensor, int index, int *state)
>> +static int
>> +__rtas_get_sensor(int sensor, int index, int *state, bool warn_on)
>>  {
>>  	int token = rtas_token("get-sensor-state");
>>  	int rc;
>> @@ -618,14 +619,26 @@ int rtas_get_sensor_fast(int sensor, int index, int *state)
>>  		return -ENOENT;
>> 
>>  	rc = rtas_call(token, 2, 2, state, sensor, index);
>> -	WARN_ON(rc == RTAS_BUSY || (rc >= RTAS_EXTENDED_DELAY_MIN &&
>> -				    rc <= RTAS_EXTENDED_DELAY_MAX));
>> +	WARN_ON(warn_on &&
>> +		(rc == RTAS_BUSY || (rc >= RTAS_EXTENDED_DELAY_MIN &&
>> +				    rc <= RTAS_EXTENDED_DELAY_MAX)));
>
> The whole point of rtas_get_sensor_fast() is that on busy we will just let it
> error out because we don't want to wait. I'm not sure I see the point of the
> spurious WARN_ONs anytime we hit a BUSY or DELAY return code. Maybe converting
> that to a pr_debug() might be better and save expanding the API with a _fast and
> _nonblocking variant that do the same thing minus one surpressing a
> WARN_ON splat.

There is a subset of sensors that are specified to not ever return busy
or delay statuses. rtas_get_sensor_fast() is meant to be used with
those, and it would be an error to use it on a sensor not in that set.
So the WARN_ON() is appropriate IMO; if it triggers it indicates either
a misuse of the API or a firmware bug. See commit 1c2cb594441d
"powerpc/rtas: Introduce rtas_get_sensor_fast() for IRQ handlers"


  reply	other threads:[~2021-11-30  1:07 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-29  8:58 [PATCH] powerpc/rtas: Introduce rtas_get_sensor_nonblocking() for pci hotplug driver Mahesh Salgaonkar
2021-11-29 22:54 ` Tyrel Datwyler
2021-11-30  1:06   ` Nathan Lynch [this message]
2021-11-30  1:21     ` Tyrel Datwyler
2021-11-30  4:53 ` Nathan Lynch
2021-11-30  9:31   ` Mahesh J Salgaonkar
2021-11-30 12:39     ` Nathan Lynch
2021-12-03 13:42   ` Mahesh J Salgaonkar
2021-12-09 15:03     ` Nathan Lynch

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=87sfveo3je.fsf@linux.ibm.com \
    --to=nathanl@linux.ibm.com \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=lxie@us.ibm.com \
    --cc=mahesh@linux.ibm.com \
    --cc=oohall@gmail.com \
    --cc=tyreld@linux.ibm.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.