mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
chpstat: Fix invalid utilization data on older kernels
On kernels without support for the new "measurement_chars_full" CHPID
sysfs attribute, chpstat displays invalid utilization numbers (nan/inf).
This is due to an invalid buffer address calculation when reading the
old "measurement_chars" attribute.
Fix this by using the correct buffer address calculation.
Fixes: 026ecbafea ("chpstat: Add support for full CMCB")
Signed-off-by: Peter Oberparleiter <oberpar@linux.ibm.com>
Reviewed-by: Vineeth Vijayan <vneethv@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
committed by
Jan Höppner
parent
3b8fdcc892
commit
6520070a46
@@ -719,7 +719,7 @@ static bool read_cmcb(int chpid, cmcb_t *cmcb)
|
||||
free(path);
|
||||
path = get_chpid_path(chpid, "measurement_chars");
|
||||
/* Partial CMCB contains data starting at word 3. */
|
||||
read_bin(path, &cmcb[PARTIAL_CMCB_OFFSET],
|
||||
read_bin(path, (char *)cmcb + PARTIAL_CMCB_OFFSET,
|
||||
PARTIAL_CMCB_SIZE, false);
|
||||
}
|
||||
free(path);
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
#include "column.h"
|
||||
|
||||
#define CMCB_SIZE (8 * sizeof(u32))
|
||||
#define PARTIAL_CMCB_OFFSET 3
|
||||
#define PARTIAL_CMCB_SIZE (CMCB_SIZE - PARTIAL_CMCB_OFFSET * sizeof(u32))
|
||||
#define PARTIAL_CMCB_OFFSET (3 * sizeof(u32))
|
||||
#define PARTIAL_CMCB_SIZE (CMCB_SIZE - PARTIAL_CMCB_OFFSET)
|
||||
#define CUE_SIZE (8 * sizeof(u32))
|
||||
#define EXT_CUE_SIZE (16 * sizeof(u32))
|
||||
#define METRICS_SIZE (18 * sizeof(double))
|
||||
|
||||
Reference in New Issue
Block a user