powerpc/perf/hv-24x7: add missing RTAS retry status handling
[ Upstream commit cc4b26eab1859fa1a70711872caaf6414809973f ]
The ibm,get-system-parameter RTAS function may return -2 or 990x,
which indicate that the caller should try again. read_24x7_sys_info()
ignores this, allowing transient failures in reporting processor
module information.
Move the RTAS call into a coventional rtas_busy_delay()-based loop,
along with the parsing of results on success.
Signed-off-by: Nathan Lynch <nathanl@linux.ibm.com>
Fixes: 8ba2142673
("powerpc/hv-24x7: Add rtas call in hv-24x7 driver to get processor details")
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20230125-b4-powerpc-rtas-queue-v3-2-26929c8cce78@linux.ibm.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
831a2d8de1
commit
9626f83a6e
@@ -79,9 +79,8 @@ static u32 phys_coresperchip; /* Physical cores per chip */
|
|||||||
*/
|
*/
|
||||||
void read_24x7_sys_info(void)
|
void read_24x7_sys_info(void)
|
||||||
{
|
{
|
||||||
int call_status, len, ntypes;
|
const s32 token = rtas_token("ibm,get-system-parameter");
|
||||||
|
int call_status;
|
||||||
spin_lock(&rtas_data_buf_lock);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Making system parameter: chips and sockets and cores per chip
|
* Making system parameter: chips and sockets and cores per chip
|
||||||
@@ -91,32 +90,27 @@ void read_24x7_sys_info(void)
|
|||||||
phys_chipspersocket = 1;
|
phys_chipspersocket = 1;
|
||||||
phys_coresperchip = 1;
|
phys_coresperchip = 1;
|
||||||
|
|
||||||
call_status = rtas_call(rtas_token("ibm,get-system-parameter"), 3, 1,
|
do {
|
||||||
NULL,
|
spin_lock(&rtas_data_buf_lock);
|
||||||
PROCESSOR_MODULE_INFO,
|
call_status = rtas_call(token, 3, 1, NULL, PROCESSOR_MODULE_INFO,
|
||||||
__pa(rtas_data_buf),
|
__pa(rtas_data_buf), RTAS_DATA_BUF_SIZE);
|
||||||
RTAS_DATA_BUF_SIZE);
|
if (call_status == 0) {
|
||||||
|
int ntypes = be16_to_cpup((__be16 *)&rtas_data_buf[2]);
|
||||||
|
int len = be16_to_cpup((__be16 *)&rtas_data_buf[0]);
|
||||||
|
|
||||||
|
if (len >= 8 && ntypes != 0) {
|
||||||
|
phys_sockets = be16_to_cpup((__be16 *)&rtas_data_buf[4]);
|
||||||
|
phys_chipspersocket = be16_to_cpup((__be16 *)&rtas_data_buf[6]);
|
||||||
|
phys_coresperchip = be16_to_cpup((__be16 *)&rtas_data_buf[8]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
spin_unlock(&rtas_data_buf_lock);
|
||||||
|
} while (rtas_busy_delay(call_status));
|
||||||
|
|
||||||
if (call_status != 0) {
|
if (call_status != 0) {
|
||||||
pr_err("Error calling get-system-parameter %d\n",
|
pr_err("Error calling get-system-parameter %d\n",
|
||||||
call_status);
|
call_status);
|
||||||
} else {
|
|
||||||
len = be16_to_cpup((__be16 *)&rtas_data_buf[0]);
|
|
||||||
if (len < 8)
|
|
||||||
goto out;
|
|
||||||
|
|
||||||
ntypes = be16_to_cpup((__be16 *)&rtas_data_buf[2]);
|
|
||||||
|
|
||||||
if (!ntypes)
|
|
||||||
goto out;
|
|
||||||
|
|
||||||
phys_sockets = be16_to_cpup((__be16 *)&rtas_data_buf[4]);
|
|
||||||
phys_chipspersocket = be16_to_cpup((__be16 *)&rtas_data_buf[6]);
|
|
||||||
phys_coresperchip = be16_to_cpup((__be16 *)&rtas_data_buf[8]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
|
||||||
spin_unlock(&rtas_data_buf_lock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Domains for which more than one result element are returned for each event. */
|
/* Domains for which more than one result element are returned for each event. */
|
||||||
|
Reference in New Issue
Block a user