ppc64-diag
|
Routines to handle CPU guard RTAS events. More...
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
#include <stdint.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <dirent.h>
#include "utils.h"
#include "rtas_errd.h"
Macros | |
#define | DRMGR_PROGRAM "/usr/sbin/drmgr" |
#define | DRMGR_PROGRAM_NOPATH "drmgr" |
#define | CONVERT_DT_PROPS_PROGRAM "/usr/sbin/convert_dt_node_props" |
#define | RTAS_V6_TYPE_RESOURCE_DEALLOC 0xE3 |
Enumerations | |
enum | resource_dealloc_type { CPU_GUARD, SP_CPU_GUARD, MEM_PAGE, MEM_LMB } |
enum | event_type { CPUTYPE, MEMTYPE } |
Functions | |
void | run_drmgr (enum resource_dealloc_type resource_type, char *drc_name, unsigned int value, int wait) |
build correct options followed by fork and exec drmgr More... | |
static int | can_delete_lmb (void) |
Counts the number of lmb's and returns an appropriate value. More... | |
static int | retrieve_drc_name (enum event_type type, struct event *event, unsigned int id, char *buffer, size_t bufsize) |
retrieve the drc-name of a cpu More... | |
static long | parse_lparcfg (char *param) |
Retrieves the value of the specified parameter from the lparcfg file. More... | |
static void | guard_cpu (struct event *event, int cpu_id) |
Parse RTAS event for CPU guard information. More... | |
static void | guard_spcpu (struct event *event, int ent_loss) |
Parse RTAS event for SP_CPU guard information. More... | |
static void | guard_mempage (struct event *event, uint64_t memory_address) |
Perform mempage guard operation. Currently not supported. More... | |
static void | guard_memlmb (struct event *event, unsigned int drc_index) |
Perform lmb guard operation after proper validation. More... | |
void | handle_resource_dealloc (struct event *event) |
Parse RTAS event for CPU guard information. More... | |
Copyright (C) 2004 IBM Corporation
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#define CONVERT_DT_PROPS_PROGRAM "/usr/sbin/convert_dt_node_props" |
Referenced by retrieve_drc_name().
#define DRMGR_PROGRAM "/usr/sbin/drmgr" |
Referenced by run_drmgr().
#define DRMGR_PROGRAM_NOPATH "drmgr" |
Referenced by run_drmgr().
#define RTAS_V6_TYPE_RESOURCE_DEALLOC 0xE3 |
Referenced by handle_resource_dealloc().
enum event_type |
|
static |
can_delete_lmb This function returns true or false. It counts the lmb's in the system and returns true if there is more than one lmb in the system. Which allows us to call the appropriate delete function.
References log_msg().
Referenced by guard_memlmb().
|
static |
guard_cpu Parses error information to determine if it represents a predictive CPU failure, which should cause a CPU Guard operation. DRMGR_PROGRAM is forked to actually remove the CPU from the system.
event | rtas event |
cpu | id to locate drc_name |
References event::addl_text, ADDL_TEXT_MAX, CPU_GUARD, CPUTYPE, d_cfg, log_msg(), ppc64_diag_config::min_processors, parse_lparcfg(), platform_log_write(), retrieve_drc_name(), and run_drmgr().
Referenced by handle_resource_dealloc().
|
static |
guard_memlmb parses error information to determine the lmb that requires guarding operation. At this time only MEMLMB operations may be guarded. DRMGR_PROGRAM is forked to actually remove the LMB from the system.
event | rtas event |
drc | index to be guarded. |
References event::addl_text, ADDL_TEXT_MAX, can_delete_lmb(), FALSE, log_msg(), MEM_LMB, MEMTYPE, platform_log_write(), retrieve_drc_name(), and run_drmgr().
Referenced by handle_resource_dealloc().
|
static |
guard_mempage A placeholder function. This dealloc type operation is currently not supported. MEMPAGE events cannot be guarded at present.
event | rtas event. |
memory | address page that needs to be de-allocated. |
References log_msg().
Referenced by handle_resource_dealloc().
|
static |
guard_spcpu Parses error information to determine if it represents a predictive SPCPU failure, which should cause a SPCPU Guard operation. DRMGR_PROGRAM is forked to actually remove the virtual cpu from the system.
event | rtas event |
entitiled | shared processor loss. |
References event::addl_text, ADDL_TEXT_MAX, CPU_GUARD, d_cfg, log_msg(), ppc64_diag_config::min_entitled_capacity, parse_lparcfg(), platform_log_write(), run_drmgr(), and SP_CPU_GUARD.
Referenced by handle_resource_dealloc().
void handle_resource_dealloc | ( | struct event * | event | ) |
handle_resource_dealloc Parses error information to determine if it represents a predictive CPU failure, which should cause a CPU Guard operation. DRMGR_PROGRAM is forked to actually remove the CPU from the system.
event | rtas event |
References guard_cpu(), guard_memlmb(), guard_mempage(), guard_spcpu(), log_msg(), event::rtas_event, and RTAS_V6_TYPE_RESOURCE_DEALLOC.
Referenced by handle_rtas_event().
|
static |
parse_lparcfg
param | lparcfg parameter |
References log_msg().
Referenced by guard_cpu(), and guard_spcpu().
|
static |
retrieve_drc_name Retrieves a string containing the drc-name of the CPU specified by the ID passed as a parameter. Returns 1 on success, 0 on failure.
event | rtas event pointer |
id | interrupt server number of the cpu |
buffer | storeage for drc-name |
bufsize | size of buffer |
References CONVERT_DT_PROPS_PROGRAM, CPUTYPE, log_msg(), restore_sigchld_default(), and setup_sigchld_handler().
Referenced by guard_cpu(), and guard_memlmb().
void run_drmgr | ( | enum resource_dealloc_type | resource_type, |
char * | drc_name, | ||
unsigned int | value, | ||
int | wait | ||
) |
run_drmgr
resource | type to deallocate. |
specific | drc_name to be de-allocted. |
either | quatity or capacity to be deallocated. |
wait | do we do a waitpid? |
References CPU_GUARD, dbg, DRMGR_PROGRAM, DRMGR_PROGRAM_NOPATH, log_msg(), MEM_LMB, MEM_PAGE, and SP_CPU_GUARD.
Referenced by guard_cpu(), guard_memlmb(), and guard_spcpu().