mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
chpstat: Add support for full CMCB
Newer kernels provide the full, unfiltered Channel-Measurements Characteristics Block (CMCB) via a new sysfs attribute named "measurement_chars_full". Add support for reading the full CMCB data if available in preparation of new tool functions that will make use of this data. 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
40846bce49
commit
026ecbafea
@@ -702,16 +702,29 @@ err:
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Read the channel-measurements characteristics block for CHPID @chpid to
|
* Read the channel-measurements characteristics block for CHPID @chpid to
|
||||||
* @cmcb.
|
* @cmcb. Return %true if full CMCB was read, %false otherwise.
|
||||||
*/
|
*/
|
||||||
static void read_cmcb(int chpid, cmcb_t *cmcb)
|
static bool read_cmcb(int chpid, cmcb_t *cmcb)
|
||||||
{
|
{
|
||||||
|
bool full = false;
|
||||||
char *path;
|
char *path;
|
||||||
|
|
||||||
memset(cmcb, 0, sizeof(*cmcb));
|
memset(cmcb, 0, sizeof(*cmcb));
|
||||||
path = get_chpid_path(chpid, "measurement_chars");
|
path = get_chpid_path(chpid, "measurement_chars_full");
|
||||||
read_bin(path, cmcb, sizeof(*cmcb), false);
|
if (util_path_exists(path)) {
|
||||||
|
/* Full CMCB starts at offset 0. */
|
||||||
|
read_bin(path, cmcb, CMCB_SIZE, false);
|
||||||
|
full = true;
|
||||||
|
} else {
|
||||||
|
free(path);
|
||||||
|
path = get_chpid_path(chpid, "measurement_chars");
|
||||||
|
/* Partial CMCB contains data starting at word 3. */
|
||||||
|
read_bin(path, &cmcb[PARTIAL_CMCB_OFFSET],
|
||||||
|
PARTIAL_CMCB_SIZE, false);
|
||||||
|
}
|
||||||
free(path);
|
free(path);
|
||||||
|
|
||||||
|
return full;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -828,7 +841,7 @@ static bool select_chpid(int chpid, bool try)
|
|||||||
c->shared = read_chpid_attr_as_int(chpid, "shared", 10);
|
c->shared = read_chpid_attr_as_int(chpid, "shared", 10);
|
||||||
c->speed = read_speed(chpid);
|
c->speed = read_speed(chpid);
|
||||||
if (cmg_t->has_cmcb)
|
if (cmg_t->has_cmcb)
|
||||||
read_cmcb(chpid, &c->data.cmcb);
|
c->data.full_cmcb = read_cmcb(chpid, &c->data.cmcb);
|
||||||
read_util(chpid, cmg, &c->data.util_a);
|
read_util(chpid, cmg, &c->data.util_a);
|
||||||
c->data.util_b = c->data.util_a;
|
c->data.util_b = c->data.util_a;
|
||||||
c->selected = true;
|
c->selected = true;
|
||||||
|
|||||||
@@ -16,7 +16,9 @@
|
|||||||
#include "lib/util_list.h"
|
#include "lib/util_list.h"
|
||||||
#include "column.h"
|
#include "column.h"
|
||||||
|
|
||||||
#define CMCB_SIZE (5 * sizeof(u32))
|
#define CMCB_SIZE (8 * sizeof(u32))
|
||||||
|
#define PARTIAL_CMCB_OFFSET 3
|
||||||
|
#define PARTIAL_CMCB_SIZE (CMCB_SIZE - PARTIAL_CMCB_OFFSET * sizeof(u32))
|
||||||
#define CUE_SIZE (8 * sizeof(u32))
|
#define CUE_SIZE (8 * sizeof(u32))
|
||||||
#define EXT_CUE_SIZE (16 * sizeof(u32))
|
#define EXT_CUE_SIZE (16 * sizeof(u32))
|
||||||
#define METRICS_SIZE (17 * sizeof(double))
|
#define METRICS_SIZE (17 * sizeof(double))
|
||||||
@@ -44,6 +46,7 @@ struct util_t {
|
|||||||
/* CMG-specific CHPID data. */
|
/* CMG-specific CHPID data. */
|
||||||
struct cmg_data_t {
|
struct cmg_data_t {
|
||||||
cmcb_t cmcb;
|
cmcb_t cmcb;
|
||||||
|
bool full_cmcb;
|
||||||
struct util_t util_a;
|
struct util_t util_a;
|
||||||
struct util_t util_b;
|
struct util_t util_b;
|
||||||
metrics_t metrics;
|
metrics_t metrics;
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
/* CMG 2 format Channel-Measurement-Characteristics Block (CMCB). */
|
/* CMG 2 format Channel-Measurement-Characteristics Block (CMCB). */
|
||||||
struct cmcb2_t {
|
struct cmcb2_t {
|
||||||
|
u32 reserved[3];
|
||||||
u32 max_bus_cycles;
|
u32 max_bus_cycles;
|
||||||
u32 max_channel_work_units;
|
u32 max_channel_work_units;
|
||||||
u32 max_write_data_units;
|
u32 max_write_data_units;
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
/* CMG 3 format Channel-Measurement-Characteristics Block (CMCB). */
|
/* CMG 3 format Channel-Measurement-Characteristics Block (CMCB). */
|
||||||
struct cmcb3_t {
|
struct cmcb3_t {
|
||||||
|
u32 reserved[3];
|
||||||
u32 data_unit_size;
|
u32 data_unit_size;
|
||||||
u32 data_unit_size_cpc;
|
u32 data_unit_size_cpc;
|
||||||
u32 msg_unit_size;
|
u32 msg_unit_size;
|
||||||
|
|||||||
Reference in New Issue
Block a user