[PATCH v2] powernv/opal: Handle OPAL_WRONG_STATE error from OPAL fails

Michael Ellerman mpe at ellerman.id.au
Wed Mar 1 17:10:13 AEDT 2017


Stewart Smith <stewart at linux.vnet.ibm.com> writes:

> Vipin K Parashar <vipin at linux.vnet.ibm.com> writes:
>> Added check for OPAL_WRONG_STATE error code returned from OPAL.
>> Currently Linux flashes "unexpected error" over console for this
>> error. This will avoid throwing such message and return I/O error
>> for such OPAL failures.
>>
>> Signed-off-by: Vipin K Parashar <vipin at linux.vnet.ibm.com>
>> ---
>> Changes in v2:
>>  - Added log message indicating sleeping/offline core
>>    for OPAL_WRONG_STATE
>>
>>  arch/powerpc/platforms/powernv/opal.c | 5 ++++-
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c
>> index 86d9fde..8af230e 100644
>> --- a/arch/powerpc/platforms/powernv/opal.c
>> +++ b/arch/powerpc/platforms/powernv/opal.c
>> @@ -869,8 +869,11 @@ int opal_error_code(int rc)
>>  	case OPAL_UNSUPPORTED:		return -EIO;
>>  	case OPAL_HARDWARE:		return -EIO;
>>  	case OPAL_INTERNAL_ERROR:	return -EIO;
>> +	case OPAL_WRONG_STATE:
>> +		pr_notice("%s: Core sleeping/offline\n", __func__);
>> +		return -EIO;
>
> Since this is part of opal_error_code() though, this will be printed for
> any OPAL call that returns that.
>
> Why not have the sensor code do this:
>
> rc = opal_sensor_read(foo)
> if (rc == OPAL_WRONG_STATE)
>    return -EIO;
> else
>    return oal_error_code(rc);
>
> ?

Yeah, that's exactly what I said to do, though perhaps I didn't say it
clearly enough?

   ... changing just opal_get_sensor_data() to handle
   OPAL_WRONG_STATE would be OK, with a comment explaining that we might be
   asked to read a sensor on an offline CPU and we aren't able to detect
   that.

cheers


More information about the Linuxppc-dev mailing list