You can subscribe to this list here.
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(14) |
Aug
(8) |
Sep
(14) |
Oct
(7) |
Nov
(9) |
Dec
(7) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2010 |
Jan
(11) |
Feb
(4) |
Mar
(6) |
Apr
(3) |
May
(7) |
Jun
(12) |
Jul
(4) |
Aug
(6) |
Sep
(1) |
Oct
(4) |
Nov
(2) |
Dec
(2) |
2011 |
Jan
(2) |
Feb
(3) |
Mar
(10) |
Apr
(7) |
May
(5) |
Jun
(3) |
Jul
(7) |
Aug
(6) |
Sep
(1) |
Oct
(1) |
Nov
(4) |
Dec
(6) |
2012 |
Jan
|
Feb
(4) |
Mar
(1) |
Apr
(2) |
May
(21) |
Jun
(6) |
Jul
(3) |
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
(10) |
2013 |
Jan
(10) |
Feb
(8) |
Mar
|
Apr
(9) |
May
(33) |
Jun
(11) |
Jul
(16) |
Aug
(3) |
Sep
(8) |
Oct
(1) |
Nov
(16) |
Dec
(7) |
2014 |
Jan
(19) |
Feb
(71) |
Mar
(46) |
Apr
(16) |
May
(1) |
Jun
(18) |
Jul
(6) |
Aug
(12) |
Sep
(7) |
Oct
(4) |
Nov
(9) |
Dec
(7) |
2015 |
Jan
(15) |
Feb
(6) |
Mar
(10) |
Apr
(7) |
May
(16) |
Jun
(21) |
Jul
(6) |
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
(1) |
2016 |
Jan
(1) |
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2017 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
2018 |
Jan
(2) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Nathan F. <nf...@li...> - 2014-11-18 20:00:48
|
To further update the hotplug capabilities of the PowerVM and PowerKVM platforms, the hotplug infrastructure is being updated to provide an in-kernel implementation. In order to take advantage of this on the PowerVM platforms the kernel will provide a new /sys/kernel/dlpar file that we can use to initiate hotplug events in the kernel. Additionally, the new in-kernel infrastructure uses rtas hotplug events to communicate hotplug actions. This patch provides a common routine to create these rtas hotplug events and write them to the sysfs file. The patch also provides the infrastructure to do memory hotplug in the kernel in conjunction with the in-kernel memory implementation submitted upstream. Signed-off-by: Nathan Fontenot <nf...@li...> --- src/drmgr/common.c | 132 +++++++++++++++++++++++++++++++++++++++++++ src/drmgr/dr.h | 14 +++++ src/drmgr/drslot_chrp_mem.c | 54 +++++++++++++++--- 3 files changed, 192 insertions(+), 8 deletions(-) diff --git a/src/drmgr/common.c b/src/drmgr/common.c index 0cb621d..78a1c0f 100644 --- a/src/drmgr/common.c +++ b/src/drmgr/common.c @@ -28,6 +28,7 @@ char *remove_slot_fname = REMOVE_SLOT_FNAME; #define DR_LOG_PATH0 "/var/log/drmgr.0" #define LPARCFG_PATH "/proc/ppc64/lparcfg" +#define RTAS_HP_PATH "/sys/kernel/dlpar" static int dr_lock_fd = 0; static long dr_timeout; @@ -1372,3 +1373,134 @@ int ams_balloon_active(void) return !is_inactive; } + +/** + * kernel_hotplug_rtas_exists + * @brief Determine if kernel interface to do hotplug via RTAS events exists + * + * @returns 1 if it exists, 0 otherwise + */ +int kernel_hotplug_rtas_exists(void) +{ + struct stat sbuf; + + if (!stat(RTAS_HP_PATH, &sbuf)) + return 1; + + return 0; +} + +/** + * send_rtas_event + * @brief Write the supplied rtas event to /proc to initiatye a hotplug event + * + * @param + * + */ +int send_rtas_event(struct hp_rtas_event *hp_event) +{ + struct rtas_event_hdr_raw *hdr = &hp_event->hdr; + int rc = -1; + int fd, length; + + fd = open(RTAS_HP_PATH, O_WRONLY); + if (fd <= 0) { + say(ERROR, "Could not open \"%s\"\n%s\n", RTAS_HP_PATH, + strerror(errno)); + return -1; + } + + length = be32toh(hdr->ext_log_length) + sizeof(*hdr); + say(DEBUG, "Writing hotplug rtas event to %s...", RTAS_HP_PATH); + rc = write(fd, hp_event, length); + close(fd); + + if (rc != length) { + say(DEBUG, "%s:\n%s\n", "fail", strerror(errno)); + } else { + say(DEBUG, "Success\n"); + rc = 0; + } + + return rc; +} + +struct hp_rtas_event *alloc_hp_rtas_event(struct options *opts, int type) +{ + struct hp_rtas_event *hp_event; + struct rtas_event_hdr_raw *hdr; + struct rtas_event_exthdr_raw *exthdr; + struct rtas_priv_hdr_scn_raw *privhdr; + struct rtas_usr_hdr_scn_raw *usrhdr; + struct rtas_hotplug_scn_raw *hpscn; + int event_size; + + event_size = sizeof(*hp_event); + if (opts->usr_drc_name) + event_size += strlen(opts->usr_drc_name); + + hp_event = zalloc(event_size); + if (!hp_event) + return NULL; + + hdr = &hp_event->hdr; + hdr->version = 6; + hdr->data1 = (RTAS_HDR_SEV_EVENT << 5) + || (RTAS_HDR_DISP_NOT_RECOVERED << 3) || 1; + + hdr->data2 = RTAS_HDR_INIT_HOT_PLUG << 4; + hdr->type = RTAS_HDR_TYPE_HOTPLUG; + hdr->ext_log_length = htobe32(event_size - sizeof(*hdr)); + + exthdr = &hp_event->exthdr; + /* Set valid, newlog, and bigendian bits */ + exthdr->data1 = 0x86; + + /* Set power_pc bit and format (14) bits */ + exthdr->data3 = 0x8e; + + hp_event->ibm = htobe32((('I' << 24) | ('B' << 16) | ('M' << 8))); + /* exthdr->format_type = HP? */ + /* TODO: Fill in rtas date/time */ + + privhdr = &hp_event->privhdr; + privhdr->v6hdr.id[0] = 'P'; + privhdr->v6hdr.id[1] = 'H'; + privhdr->v6hdr.length = htobe16(sizeof(*privhdr)); + privhdr->v6hdr.version = 1; + /* TODO: Fille in rtas date/time */ + privhdr->scn_count = 1; + + usrhdr = &hp_event->usrhdr; + usrhdr->v6hdr.id[0] = 'U'; + usrhdr->v6hdr.id[1] = 'H'; + usrhdr->v6hdr.length = htobe16(sizeof(*usrhdr)); + + hpscn = &hp_event->hpscn; + hpscn->v6hdr.id[0] = 'H'; + hpscn->v6hdr.id[1] = 'P'; + hpscn->type = type; + + if (opts->action == ADD) + hpscn->action = RTAS_HP_ACTION_ADD; + else + hpscn->action = RTAS_HP_ACTION_REMOVE; + + if (opts->usr_drc_index) { + hpscn->v6hdr.length = htobe16(sizeof(*hpscn)); + hpscn->identifier = RTAS_HP_ID_DRC_INDEX; + hpscn->u1.drc_index = htobe32(opts->usr_drc_index); + } else if (opts->usr_drc_name) { + hpscn->v6hdr.length = htobe16(sizeof(*hpscn) + + strlen(opts->usr_drc_name)); + hpscn->identifier = RTAS_HP_ID_DRC_NAME; + memcpy(hpscn->u1.drc_name, opts->usr_drc_name, + strlen(opts->usr_drc_name)); + } else { + hpscn->v6hdr.length = htobe16(sizeof(*hpscn)); + hpscn->identifier = RTAS_HP_ID_DRC_COUNT; + hpscn->u1.count = htobe32(opts->quantity); + } + + return hp_event; +} diff --git a/src/drmgr/dr.h b/src/drmgr/dr.h index 9ae7a82..dfd46fc 100644 --- a/src/drmgr/dr.h +++ b/src/drmgr/dr.h @@ -12,6 +12,7 @@ #include <nl_types.h> #include <unistd.h> #include <stdarg.h> +#include <librtasevent.h> #include "rtas_calls.h" #include "drpci.h" @@ -68,6 +69,16 @@ struct options { enum say_level { ERROR = 1, WARN, INFO, DEBUG}; +/* Skeleton hotplug RTAS Event */ +struct hp_rtas_event { + struct rtas_event_hdr_raw hdr; + struct rtas_event_exthdr_raw exthdr; + uint32_t ibm; + struct rtas_priv_hdr_scn_raw privhdr; + struct rtas_usr_hdr_scn_raw usrhdr; + struct rtas_hotplug_scn_raw hpscn; +}; + /* The follwing are defined in common.c */ int say(enum say_level, char *, ...); void report_unknown_error(char *, int); @@ -78,6 +89,9 @@ int drmgr_timed_out(void); int dr_lock(void); int dr_unlock(void); int valid_platform(const char *); +int kernel_hotplug_rtas_exists(void); +int send_rtas_event(struct hp_rtas_event *); +struct hp_rtas_event *alloc_hp_rtas_event(struct options *, int); void free_of_node(struct of_node *); int add_device_tree_nodes(char *, struct of_node *); diff --git a/src/drmgr/drslot_chrp_mem.c b/src/drmgr/drslot_chrp_mem.c index d6ece97..062a10d 100644 --- a/src/drmgr/drslot_chrp_mem.c +++ b/src/drmgr/drslot_chrp_mem.c @@ -1015,6 +1015,41 @@ mem_add(struct options *opts) } /** + * mem_add_rtas + * @brief Add memory via the kernel rtas event interface + * + * @param opts user options + * @returns 0 on success, !0 otherwise + */ +static int mem_hp_rtas(struct options *opts) +{ + struct hp_rtas_event *hp_event; + int rc; + + hp_event = alloc_hp_rtas_event(opts, RTAS_HP_TYPE_MEMORY); + if (!hp_event) + return -1; + + rc = send_rtas_event(hp_event); + if (rc) { + say(ERROR, "Hotplug Failed\n"); + printf("DR_TOTAL_RESOURCES=0\n"); + } else { + int lmbs; + + if (opts->usr_drc_index) + lmbs = 1; + else + lmbs = opts->quantity; + + printf("DR_TOTAL_RESOURCES=%d\n", lmbs); + } + + free(hp_event); + return rc; +} + +/** * remove_lmbs * * @param nr_lmbs @@ -1251,14 +1286,17 @@ drslot_chrp_mem(struct options *opts) if (opts->usr_drc_name) opts->quantity = 1; - switch (opts->action) { - case ADD: - rc = mem_add(opts); - break; - - case REMOVE: - rc = mem_remove(opts); - break; + if (kernel_hotplug_rtas_exists()) { + rc = mem_hp_rtas(opts); + } else { + switch (opts->action) { + case ADD: + rc = mem_add(opts); + break; + case REMOVE: + rc = mem_remove(opts); + break; + } } return rc; |
From: Nathan F. <nf...@li...> - 2014-11-18 19:57:56
|
In response to my earlier patch that attempted to correct the -s option handling for drmgr I introduced a bug in which the usr_drc_name could be NULL causing a segfault when attempting to use it. This patch adds a check to make sure it is not NULL. Signed-off-by: Nathan Fontenot <nf...@li...> --- src/drmgr/drslot_chrp_cpu.c | 2 +- src/drmgr/drslot_chrp_mem.c | 2 +- src/drmgr/drslot_chrp_pci.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/drmgr/drslot_chrp_cpu.c b/src/drmgr/drslot_chrp_cpu.c index f45b9ed..e6f185d 100644 --- a/src/drmgr/drslot_chrp_cpu.c +++ b/src/drmgr/drslot_chrp_cpu.c @@ -312,7 +312,7 @@ valid_cpu_options(struct options *opts) } /* The -s option can specify a drc name or drc index */ - if (!strncmp(opts->usr_drc_name, "0x", 2)) { + if (opts->usr_drc_name && !strncmp(opts->usr_drc_name, "0x", 2)) { opts->usr_drc_index = strtoul(opts->usr_drc_name, NULL, 16); opts->usr_drc_name = NULL; } diff --git a/src/drmgr/drslot_chrp_mem.c b/src/drmgr/drslot_chrp_mem.c index a867894..d6ece97 100644 --- a/src/drmgr/drslot_chrp_mem.c +++ b/src/drmgr/drslot_chrp_mem.c @@ -1221,7 +1221,7 @@ valid_mem_options(struct options *opts) } /* The -s option can specify a drc name or drc index */ - if (!strncmp(opts->usr_drc_name, "0x", 2)) { + if (opts->usr_drc_name && !strncmp(opts->usr_drc_name, "0x", 2)) { opts->usr_drc_index = strtoul(opts->usr_drc_name, NULL, 16); opts->usr_drc_name = NULL; } diff --git a/src/drmgr/drslot_chrp_pci.c b/src/drmgr/drslot_chrp_pci.c index 2164363..0c8de2f 100644 --- a/src/drmgr/drslot_chrp_pci.c +++ b/src/drmgr/drslot_chrp_pci.c @@ -844,7 +844,7 @@ valid_pci_options(struct options *opts) } /* The -s option can specify a drc name or drc index */ - if (!strncmp(opts->usr_drc_name, "0x", 2)) { + if (opts->usr_drc_name && !strncmp(opts->usr_drc_name, "0x", 2)) { opts->usr_drc_index = strtoul(opts->usr_drc_name, NULL, 16); opts->usr_drc_name = NULL; } |
From: Thomas F. <tlf...@li...> - 2014-11-17 23:26:14
|
The lparstat man page specifies "if there are two SMT threads, the row is displayed as 'on.' However, if there are more than two SMT threads, the number of SMT threads is displayed." The actual SMT output would be Dedicated, which I think is because of a bug. I sent a patch for that earlier today, but the documentation does not match the new output. For example, the machine that I tested on gave an output of "on" when SMT was set to four and "2" when SMT was set to two. # ppc64_cpu --smt=4 # ./lparstat System Configuration type=Shared mode=Capped smt=On lcpu=4 mem=3899904 kB cpus=16 ent=2.00 %user %sys %wait %idle physc %entc lbusy vcsw phint ----- ----- ----- ----- ----- ----- ----- ----- ----- 0.00 0.01 0.00 99.99 0.00 0.00 0.01 9744131 0 ltcbrazos2-lp08:~/powerpc-utils/src # ppc ppc ppc32 ppc64 ppc64_cpu # ppc64_cpu --smt=2 # ./lparstat System Configuration type=Shared mode=Capped smt=2 lcpu=4 mem=3899904 kB cpus=16 ent=2.00 %user %sys %wait %idle physc %entc lbusy vcsw phint ----- ----- ----- ----- ----- ----- ----- ----- ----- 0.00 0.00 0.00 99.99 0.00 0.00 0.00 9749696 0 After some testing, it looks to me that the output is "on" when using the maximum possible SMT value. I created a patch to change the documentation, but I wanted to be sure that I was correct before sending it. |
From: Thomas F. <tlf...@li...> - 2014-11-17 20:15:48
|
get_smt_state is used in the system_data structure to display both the shared_processor_mode and the smt_state members. After reviewing code and documentation, it seems that the information in smt_state is meant to be acquired from ppc64_cpu instead of lparcfg. With this change, the SMT listing will be determined by the output of ppc64_cpu --smt. Signed-off-by: Thomas Falcon <tlf...@li...> --- Sorry, I forgot to sign off the first time. --- src/lparstat.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lparstat.h b/src/lparstat.h index 5a5b0f5..dd487c1 100644 --- a/src/lparstat.h +++ b/src/lparstat.h @@ -168,7 +168,7 @@ struct sysentry system_data[] = { /* ppc64_cpu --smt */ {.name = "smt_state", .descr = "SMT", - .get = &get_smt_state}, + .get = &get_smt_mode}, /* /proc/stat */ {.name = "cpu_total", -- 2.1.2 |
From: Thomas F. <tlf...@li...> - 2014-11-17 19:54:51
|
get_smt_state is used in the system_data structure to display both the shared_processor_mode and the smt_state members. After reviewing code and documentation, it seems that the information in smt_state is meant to be acquired from ppc64_cpu instead of lparcfg. With this change, the SMT listing will be determined by the output of ppc64_cpu --smt. --- src/lparstat.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lparstat.h b/src/lparstat.h index 5a5b0f5..dd487c1 100644 --- a/src/lparstat.h +++ b/src/lparstat.h @@ -168,7 +168,7 @@ struct sysentry system_data[] = { /* ppc64_cpu --smt */ {.name = "smt_state", .descr = "SMT", - .get = &get_smt_state}, + .get = &get_smt_mode}, /* /proc/stat */ {.name = "cpu_total", -- 2.1.2 |
From: Jeremy K. <jk...@oz...> - 2014-10-29 05:39:11
|
Currently, --without-librtas disables ppc64_cpu. However, we only need librtas for the run-mode determination; other functions will work fine without it. This change allows ppc64_cpu to be built without librtas, by conditionally enabling run-mode, and restoring ppc64_cpu to be built when --without-librtas is given. We need to re-work src/Makefile.am a little here - we use the += operator to include rtas-specific functionality, which means the with-librtas cases need to be listed before the without ones. We also need to #include stdint.h, as ppc64_cpu.c uses inttypes from here. Signed-off-by: Jeremy Kerr <jk...@oz...> --- v2: rebase to current git tree & update autotools changes --- Makefile.am | 30 +++++++++++++++--------------- configure.ac | 5 ++++- src/ppc64_cpu.c | 22 ++++++++++++++++++++-- 3 files changed, 39 insertions(+), 18 deletions(-) diff --git a/Makefile.am b/Makefile.am index 01b258e..9cb3212 100644 --- a/Makefile.am +++ b/Makefile.am @@ -49,12 +49,23 @@ EXTRA_DIST += COPYRIGHT Changelog powerpc-utils.spec.in doc/activate_firmware.do doc/nvram.doxycfg doc/rtas_ibm_get_vpd.doxycfg doc/serv_config.doxycfg \ doc/set_poweron_time.doxycfg doc/uesensor.doxycfg -sbin_PROGRAMS += src/nvram src/lsprop src/lparstat +sbin_PROGRAMS += src/nvram src/lsprop src/lparstat src/ppc64_cpu pseries_platform_SOURCES = src/common/pseries_platform.c src/common/pseries_platform.h librtas_error_SOURCES = src/common/librtas_error.c src/common/librtas_error.h +src_nvram_SOURCES = src/nvram.c src/nvram.h $(pseries_platform_SOURCES) +src_nvram_LDADD = -ldl -lz + +src_lsprop_SOURCES = src/lsprop.c $(pseries_platform_SOURCES) + +src_lparstat_SOURCES = src/lparstat.c src/lparstat.h $(pseries_platform_SOURCES) + +src_ppc64_cpu_SOURCES = src/ppc64_cpu.c $(pseries_platform_SOURCES) +src_ppc64_cpu_LDADD = -lpthread + + AM_CFLAGS = -Wall -g -I $(top_srcdir)/src/common/ if WITH_LIBRTAS @@ -65,8 +76,7 @@ sbin_PROGRAMS += \ src/serv_config \ src/uesensor \ src/rtas_event_decode \ - src/sys_ident \ - src/ppc64_cpu + src/sys_ident src_activate_firmware_SOURCES = src/activate_fw.c $(pseries_platform_SOURCES) src_activate_firmware_LDADD = -lrtas @@ -89,19 +99,9 @@ src_rtas_event_decode_LDADD = -lrtasevent src_sys_ident_SOURCES = src/sys_ident.c $(pseries_platform_SOURCES) src_sys_ident_LDADD = -lrtas -src_ppc64_cpu_SOURCES = src/ppc64_cpu.c $(librtas_error_SOURCES) $(pseries_platform_SOURCES) -src_ppc64_cpu_LDADD = -lrtas -lpthread +src_ppc64_cpu_SOURCES += $(librtas_error_SOURCES) $(pseries_platform_SOURCES) +src_ppc64_cpu_LDADD += -lrtas -endif - -src_nvram_SOURCES = src/nvram.c src/nvram.h $(pseries_platform_SOURCES) -src_nvram_LDADD = -ldl -lz - -src_lsprop_SOURCES = src/lsprop.c $(pseries_platform_SOURCES) - -src_lparstat_SOURCES = src/lparstat.c src/lparstat.h $(pseries_platform_SOURCES) - -if WITH_LIBRTAS sbin_PROGRAMS += src/drmgr/drmgr src/drmgr/lsslot endif diff --git a/configure.ac b/configure.ac index 988b3e5..2eb8b26 100644 --- a/configure.ac +++ b/configure.ac @@ -47,7 +47,10 @@ AC_ARG_WITH([librtas], AS_IF([test "x$with_librtas" != "xno"], [AC_CHECK_HEADER([librtas.h], - [with_libtras=yes], + [ + with_libtras=yes + AC_DEFINE(WITH_LIBRTAS) + ], [AC_MSG_FAILURE( [librtas test failed (--without-librtas to disable)])] )] diff --git a/src/ppc64_cpu.c b/src/ppc64_cpu.c index 4df4cdc..28b9b20 100644 --- a/src/ppc64_cpu.c +++ b/src/ppc64_cpu.c @@ -10,10 +10,10 @@ #define _GNU_SOURCE #include <stdio.h> #include <stdlib.h> +#include <stdint.h> #include <unistd.h> #include <string.h> #include <dirent.h> -#include <librtas.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> @@ -25,10 +25,16 @@ #include <sys/ptrace.h> #include <sys/wait.h> #include <sys/resource.h> + +#ifdef WITH_LIBRTAS +#include <librtas.h> +#include "librtas_error.h" +#endif + #ifdef HAVE_LINUX_PERF_EVENT_H #include <linux/perf_event.h> #endif -#include "librtas_error.h" + #include <errno.h> #define PPC64_CPU_VERSION "1.2" @@ -682,6 +688,8 @@ static int do_smt_snooze_delay(char *state) return rc; } +#ifdef WITH_LIBRTAS + static int do_run_mode(char *run_mode) { char mode[3]; @@ -744,6 +752,16 @@ static int do_run_mode(char *run_mode) return rc; } +#else + +static int do_run_mode(char *run_mode) +{ + printf("Run mode determination is not supported on this platfom.\n"); + return -1; +} + +#endif + #ifdef HAVE_LINUX_PERF_EVENT_H static int setup_counters(void) |
From: Jan L. <jl...@su...> - 2014-10-28 10:25:15
|
Hi, I attached a patch/workaround for CVE-2014-4040. CVE is about: snap in powerpc-utils 1.2.20 produces an archive with fstab and yaboot.conf files potentially containing cleartext passwords, and lacks a warning about reviewing this archive to detect included passwords, which might allow remote attackers to obtain sensitive information by leveraging access to a technical-support data stream. Solution: print a warning that confidential data may be collected via snap Regards, Jan Löser -- -- Jan Loeser, SLE Core „May the Force.. POWER be with you“ SUSE Linux Products GmbH - GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer Maxfeldstraße 5, 90409 Nuernberg, Germany - HRB 16746 (AG Nuernberg) Key Fingerprint = 3186 7823 9926 EC1D D47C B7C3 5EA6 ADAB 261C EF76 |
From: Jeremy K. <jk...@oz...> - 2014-10-26 07:33:39
|
Currently, --without-librtas disables ppc64_cpu. However, we only need librtas for the run-mode determination; other functions will work fine without it. This change allows ppc64_cpu to be built without librtas, by conditionally enabling run-mode, and restoring ppc64_cpu to be built when --without-librtas is given. We need to re-work src/Makefile.am a little here - we use the += operator to include rtas-specific functionality, which means the with-librtas cases need to be listed before the without ones. We also need to #include stdint.h, as ppc64_cpu.c uses inttypes from here. Signed-off-by: Jeremy Kerr <jk...@oz...> --- configure.ac | 5 ++++- src/Makefile.am | 23 ++++++++++++++--------- src/ppc64_cpu.c | 22 ++++++++++++++++++++-- 3 files changed, 38 insertions(+), 12 deletions(-) diff --git a/configure.ac b/configure.ac index 51a5158..ffdf359 100644 --- a/configure.ac +++ b/configure.ac @@ -44,7 +44,10 @@ AC_ARG_WITH([librtas], AS_IF([test "x$with_librtas" != "xno"], [AC_CHECK_HEADER([librtas.h], - [with_libtras=yes], + [ + with_libtras=yes + AC_DEFINE(WITH_LIBRTAS) + ], [AC_MSG_FAILURE( [librtas test failed (--without-librtas to disable)])] )] diff --git a/src/Makefile.am b/src/Makefile.am index 18403b8..6b29353 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -5,9 +5,20 @@ AM_LDFLAGS = SUBDIRS = drmgr -sbin_PROGRAMS = nvram lsprop lparstat +sbin_PROGRAMS = nvram lsprop lparstat ppc64_cpu pseries_platform_SOURCES = common/pseries_platform.c common/pseries_platform.h + +nvram_SOURCES = nvram.c nvram.h $(pseries_platform_SOURCES) +nvram_LDADD = -ldl -lz + +lsprop_SOURCES = lsprop.c $(pseries_platform_SOURCES) + +lparstat_SOURCES = lparstat.c lparstat.h $(pseries_platform_SOURCES) + +ppc64_cpu_SOURCES = ppc64_cpu.c $(pseries_platform_SOURCES) +ppc64_cpu_LDADD = -lpthread + if WITH_LIBRTAS activate_firmware_SOURCES = activate_fw.c $(pseries_platform_SOURCES) activate_firmware_LDADD = -lrtas @@ -30,16 +41,10 @@ rtas_event_decode_LDADD = -lrtasevent sys_ident_SOURCES = sys_ident.c $(pseries_platform_SOURCES) sys_ident_LDADD = -lrtas -ppc64_cpu_SOURCES = ppc64_cpu.c librtas_error.c librtas_error.h $(pseries_platform_SOURCES) -ppc64_cpu_LDADD = -lrtas -lpthread +ppc64_cpu_SOURCES += librtas_error.c librtas_error.h +ppc64_cpu_LDADD += -lrtas sbin_PROGRAMS += activate_firmware set_poweron_time rtas_ibm_get_vpd \ serv_config uesensor rtas_event_decode sys_ident ppc64_cpu endif -nvram_SOURCES = nvram.c nvram.h $(pseries_platform_SOURCES) -nvram_LDADD = -ldl -lz - -lsprop_SOURCES = lsprop.c $(pseries_platform_SOURCES) - -lparstat_SOURCES = lparstat.c lparstat.h $(pseries_platform_SOURCES) diff --git a/src/ppc64_cpu.c b/src/ppc64_cpu.c index 739b289..ea21cc3 100644 --- a/src/ppc64_cpu.c +++ b/src/ppc64_cpu.c @@ -10,10 +10,10 @@ #define _GNU_SOURCE #include <stdio.h> #include <stdlib.h> +#include <stdint.h> #include <unistd.h> #include <string.h> #include <dirent.h> -#include <librtas.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> @@ -25,10 +25,16 @@ #include <sys/ptrace.h> #include <sys/wait.h> #include <sys/resource.h> + +#ifdef WITH_LIBRTAS +#include <librtas.h> +#include "librtas_error.h" +#endif + #ifdef HAVE_LINUX_PERF_EVENT_H #include <linux/perf_event.h> #endif -#include "librtas_error.h" + #include <errno.h> #define PPC64_CPU_VERSION "1.1" @@ -702,6 +708,8 @@ static int do_smt_snooze_delay(char *state) return rc; } +#ifdef WITH_LIBRTAS + static int do_run_mode(char *run_mode) { char mode[3]; @@ -764,6 +772,16 @@ static int do_run_mode(char *run_mode) return rc; } +#else + +static int do_run_mode(char *run_mode) +{ + printf("Run mode determination is not supported on this platfom.\n"); + return -1; +} + +#endif + #ifdef HAVE_LINUX_PERF_EVENT_H static int setup_counters(void) |
From: Nathan F. <nf...@li...> - 2014-10-13 18:27:42
|
The drmgr command should not attempt to remove the last cpu from the system. Normally this would not be an issue as cpu remove operations are initiated from the HMC and the HMC will not allow the last cpu to be removed. This issue does arise when handling PRRN events and trying to update the affinity on a partition that only has one cpu. Signed-off-by: Nathan Fontenot <nf...@li...> --- src/drmgr/drslot_chrp_cpu.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/drmgr/drslot_chrp_cpu.c b/src/drmgr/drslot_chrp_cpu.c index af4e283..7cbc9b0 100644 --- a/src/drmgr/drslot_chrp_cpu.c +++ b/src/drmgr/drslot_chrp_cpu.c @@ -60,6 +60,28 @@ get_cpu_by_name(struct dr_info *drinfo, const char *name) } /** + * cpu_count + * + * Count the number of CPUs currently on the system + * + * @param dr_info cpu drc information + * @return number of cpus + */ +static int cpu_count(struct dr_info *dr_info) +{ + struct dr_node *cpu; + int cpu_count = 0; + + for (cpu = dr_info->all_cpus; cpu; cpu = cpu->next) { + if (cpu->is_owned) + cpu_count++; + } + + say(DEBUG, "Number of CPUs = %d\n", cpu_count); + return cpu_count; +} + +/** * get_available_cpu * * Find an available cpu to that we can add or remove, depending @@ -197,6 +219,12 @@ remove_cpus(struct options *opts, struct dr_info *dr_info) while (count < opts->quantity) { if (drmgr_timed_out()) break; + + if (cpu_count(dr_info) == 1) { + say(WARN, "Cannot remove the last CPU\n"); + rc = -1; + break; + } cpu = get_available_cpu(opts, dr_info); if (!cpu) |
From: Thomas F. <tlf...@li...> - 2014-09-30 21:16:23
|
Due to security concerns, data to be sent over the network will be serialized via json instead of pickle. The socket file interface will also be removed as it did not play nice with the json load method. Data transfers will be implemented with the socket send, sendall, and recv methods. These implementations along with json serialization are contained within the functions send_json_message and receive_json_message, which allow the client and server to transfer json messages of variable size. Signed-off-by: Thomas Falcon <tlf...@li...> --- scripts/amsvis/powerpcAMS/amsnet.py | 46 ++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/scripts/amsvis/powerpcAMS/amsnet.py b/scripts/amsvis/powerpcAMS/amsnet.py index 0e721df..ed460f9 100644 --- a/scripts/amsvis/powerpcAMS/amsnet.py +++ b/scripts/amsvis/powerpcAMS/amsnet.py @@ -1,4 +1,4 @@ -"""Network client/server for transmitting pickled data. +"""Network client/server for transmitting json data. """ __author__ = "Robert Jennings rc...@li..." @@ -8,7 +8,7 @@ __license__ = "Common Public License v1.0" import socket import types import logging -import cPickle as pickle +import json from powerpcAMS.amsdata import gather_all_data, gather_system_data @@ -23,9 +23,22 @@ DATA_METHODS = (gather_all_data, gather_system_data) # backwards compatibility is broken. CMDVERS = 1.0000000 +def send_json_message(socket, message): + json_message = json.dumps(message) + socket.send("%d\n" % len(json_message)) + socket.sendall(json_message) + +def receive_json_message(socket): + len_str = '' + while True: + c = socket.recv(1) + if c == '\n': break + len_str += c + mesg_len = int(len_str) + return json.loads(socket.recv(mesg_len)) def send_data_loop(port): - """Send pickled data to any client that connects to a given network port. + """Send json data to any client that connects to a given network port. Keyword arguments: port -- network port number to use for this server @@ -40,7 +53,6 @@ def send_data_loop(port): logging.error("Network error: (%d) " % errno + errstr) return 1 - sockfile = None conn = None try: @@ -48,7 +60,6 @@ def send_data_loop(port): sock.listen(1) (conn, addr) = sock.accept() logging.debug("Client connected from " + repr(addr)) - sockfile = conn.makefile('rwb', 0) result = "success" data = None @@ -58,7 +69,7 @@ def send_data_loop(port): # request data version we can change what the server will # send in the future. try: - client_data = pickle.Unpickler(sockfile).load() + client_data = receive_json_message(conn) except: logging.debug("Unable to parse client request.") logging.info("Bad client request, ignoring.") @@ -87,7 +98,7 @@ def send_data_loop(port): if result is not "error": data_method = DATA_METHODS[client_data["command"]] - # Gather system data and send pickled objects to the client + # Gather system data and send json objects to the client data = data_method() if data is None: result = "error" @@ -95,19 +106,14 @@ def send_data_loop(port): logging.debug("Sending %d data objects to client.", len(data)) response = {"result": result, "data": data} - sockfile.writelines(pickle.dumps(response, -1)) + send_json_message(conn, response) # Clean up - sockfile.close() - sockfile = None - conn.close() conn = None # Catch a keyboard interrupt by cleaning up the socket except KeyboardInterrupt: - if sockfile: - sockfile.close() if conn: conn.close() sock.close() @@ -116,8 +122,6 @@ def send_data_loop(port): # Catch a network error and clean up, return 1 to indicate an error except socket.error, msg: - if sockfile: - sockfile.close() if conn: conn.close() sock.close() @@ -127,8 +131,6 @@ def send_data_loop(port): # Give the user something slightly helpful for any other error except: - if sockfile: - sockfile.close() if conn: conn.close() sock.close() @@ -138,7 +140,7 @@ def send_data_loop(port): # Client def net_get_data(host="localhost", port=50000, cmd=CMD_GET_ALL_DATA): - """Get pickled data from a simple network server. + """Get json data from a simple network server. Keywork arguments: host -- server host name (default localhost) @@ -161,8 +163,6 @@ def net_get_data(host="localhost", port=50000, cmd=CMD_GET_ALL_DATA): "data": "Client: Is the server still running?", } - sockfile = sock.makefile('rwb', 0) # read/write, unbuffered - # By sending a request to the server, including a version for the data # request, we can change the data sent by the server in the future. if type(cmd) is types.IntType and cmd >= 0 and cmd <= CMD_MAX: @@ -179,15 +179,13 @@ def net_get_data(host="localhost", port=50000, cmd=CMD_GET_ALL_DATA): "data": "Client: Bad request.", } - sockfile.writelines(pickle.dumps(client_request, -1)) + send_json_message(sock, client_request) # Get server response - pickler = pickle.Unpickler(sockfile) try: - data = pickler.load() + data = receive_json_message(sock) except EOFError: pass - sockfile.close() sock.close() if type(data) is not types.DictType or "result" not in data: -- 1.8.5.2 |
From: Nathan F. <nf...@li...> - 2014-09-17 20:39:41
|
To further update the hotoplug capabilities of the PowerVM and PowerKVM platforms, the hotplug infrastructure is being updated to provide an in-kernel implementation. In order to take advantage of this on the PowerVM platforms the kernel will provide a new /proc/powerpc/dlpar file that we can use to initiate hotplug events in the kernel. Additionally, the new in-kernel infrastructure uses rtas hotplug events to communicate hotplug actions. This patch provides a common routine to create these rtas hotplug events and write them to the /proc file. The patch also provides the infrastructure to do memory hotplug in the kernel in conjunction with the in-kernel memory implementation submitted upstream here; https://lists.ozlabs.org/pipermail/linuxppc-dev/2014-September/120940.html There will be a v2 of the kernel patches that will require a small update to this patch set but I wanted to send it out for comments. Signed-off-by: Nathan Fontenot <nf...@li...> --- src/drmgr/common.c | 132 +++++++++++++++++++++++++++++++++++++++++++ src/drmgr/dr.h | 14 +++++ src/drmgr/drslot_chrp_mem.c | 44 ++++++++++++-- 3 files changed, 182 insertions(+), 8 deletions(-) diff --git a/src/drmgr/common.c b/src/drmgr/common.c index 0cb621d..6e4561d 100644 --- a/src/drmgr/common.c +++ b/src/drmgr/common.c @@ -28,6 +28,7 @@ char *remove_slot_fname = REMOVE_SLOT_FNAME; #define DR_LOG_PATH0 "/var/log/drmgr.0" #define LPARCFG_PATH "/proc/ppc64/lparcfg" +#define PROC_RTAS_PATH "/proc/powerpc/dlpar" static int dr_lock_fd = 0; static long dr_timeout; @@ -1372,3 +1373,134 @@ int ams_balloon_active(void) return !is_inactive; } + +/** + * kernel_hotplug_rtas_exists + * @brief Determine if kernel interface to do hotplug via RTAS events exists + * + * @returns 1 if it exists, 0 otherwise + */ +int kernel_hotplug_rtas_exists(void) +{ + struct stat sbuf; + + if (!stat(PROC_RTAS_PATH, &sbuf)) + return 1; + + return 0; +} + +/** + * send_rtas_event + * @brief Write the supplied rtas event to /proc to initiatye a hotplug event + * + * @param + * + */ +int send_rtas_event(struct hp_rtas_event *hp_event) +{ + struct rtas_event_hdr_raw *hdr = &hp_event->hdr; + int rc = -1; + int fd, length; + + fd = open(PROC_RTAS_PATH, O_WRONLY); + if (fd <= 0) { + say(ERROR, "Could not open \"%s\"\n%s\n", PROC_RTAS_PATH, + strerror(errno)); + return -1; + } + + length = be32toh(hdr->ext_log_length) + sizeof(*hdr); + say(DEBUG, "Writing hotplug rtas event to %s...", PROC_RTAS_PATH); + rc = write(fd, hp_event, length); + close(fd); + + if (rc <= 0) { + say(DEBUG, "%s:\n%s\n", "fail", strerror(errno)); + } else { + say(DEBUG, "Success\n"); + rc = 0; + } + + return rc; +} + +struct hp_rtas_event *alloc_hp_rtas_event(struct options *opts, int type) +{ + struct hp_rtas_event *hp_event; + struct rtas_event_hdr_raw *hdr; + struct rtas_event_exthdr_raw *exthdr; + struct rtas_priv_hdr_scn_raw *privhdr; + struct rtas_usr_hdr_scn_raw *usrhdr; + struct rtas_hotplug_scn_raw *hpscn; + int event_size; + + event_size = sizeof(*hp_event); + if (opts->usr_drc_name) + event_size += strlen(opts->usr_drc_name); + + hp_event = zalloc(event_size); + if (!hp_event) + return NULL; + + hdr = &hp_event->hdr; + hdr->version = 6; + hdr->data1 = (RTAS_HDR_SEV_EVENT << 5) + || (RTAS_HDR_DISP_NOT_RECOVERED << 3) || 1; + + hdr->data2 = RTAS_HDR_INIT_HOT_PLUG << 4; + hdr->type = RTAS_HDR_TYPE_HOTPLUG; + hdr->ext_log_length = htobe32(event_size - sizeof(*hdr)); + + exthdr = &hp_event->exthdr; + /* Set valid, newlog, and bigendian bits */ + exthdr->data1 = 0x86; + + /* Set power_pc bit and format (14) bits */ + exthdr->data3 = 0x8e; + + hp_event->ibm = htobe32((('I' << 24) | ('B' << 16) | ('M' << 8))); + /* exthdr->format_type = HP? */ + /* TODO: Fill in rtas date/time */ + + privhdr = &hp_event->privhdr; + privhdr->v6hdr.id[0] = 'P'; + privhdr->v6hdr.id[1] = 'H'; + privhdr->v6hdr.length = htobe16(sizeof(*privhdr)); + privhdr->v6hdr.version = 1; + /* TODO: Fille in rtas date/time */ + privhdr->scn_count = 1; + + usrhdr = &hp_event->usrhdr; + usrhdr->v6hdr.id[0] = 'U'; + usrhdr->v6hdr.id[1] = 'H'; + usrhdr->v6hdr.length = htobe16(sizeof(*usrhdr)); + + hpscn = &hp_event->hpscn; + hpscn->v6hdr.id[0] = 'H'; + hpscn->v6hdr.id[1] = 'P'; + hpscn->type = type; + + if (opts->action == ADD) + hpscn->action = RTAS_HP_ACTION_ADD; + else + hpscn->action = RTAS_HP_ACTION_REMOVE; + + if (opts->usr_drc_index) { + hpscn->v6hdr.length = htobe16(sizeof(*hpscn)); + hpscn->identifier = RTAS_HP_ID_DRC_INDEX; + hpscn->u1.drc_index = htobe32(opts->usr_drc_index); + } else if (opts->usr_drc_name) { + hpscn->v6hdr.length = htobe16(sizeof(*hpscn) + + strlen(opts->usr_drc_name)); + hpscn->identifier = RTAS_HP_ID_DRC_NAME; + memcpy(hpscn->u1.drc_name, opts->usr_drc_name, + strlen(opts->usr_drc_name)); + } else { + hpscn->v6hdr.length = htobe16(sizeof(*hpscn)); + hpscn->identifier = RTAS_HP_ID_DRC_COUNT; + hpscn->u1.count = htobe32(opts->quantity); + } + + return hp_event; +} diff --git a/src/drmgr/dr.h b/src/drmgr/dr.h index 9ae7a82..dfd46fc 100644 --- a/src/drmgr/dr.h +++ b/src/drmgr/dr.h @@ -12,6 +12,7 @@ #include <nl_types.h> #include <unistd.h> #include <stdarg.h> +#include <librtasevent.h> #include "rtas_calls.h" #include "drpci.h" @@ -68,6 +69,16 @@ struct options { enum say_level { ERROR = 1, WARN, INFO, DEBUG}; +/* Skeleton hotplug RTAS Event */ +struct hp_rtas_event { + struct rtas_event_hdr_raw hdr; + struct rtas_event_exthdr_raw exthdr; + uint32_t ibm; + struct rtas_priv_hdr_scn_raw privhdr; + struct rtas_usr_hdr_scn_raw usrhdr; + struct rtas_hotplug_scn_raw hpscn; +}; + /* The follwing are defined in common.c */ int say(enum say_level, char *, ...); void report_unknown_error(char *, int); @@ -78,6 +89,9 @@ int drmgr_timed_out(void); int dr_lock(void); int dr_unlock(void); int valid_platform(const char *); +int kernel_hotplug_rtas_exists(void); +int send_rtas_event(struct hp_rtas_event *); +struct hp_rtas_event *alloc_hp_rtas_event(struct options *, int); void free_of_node(struct of_node *); int add_device_tree_nodes(char *, struct of_node *); diff --git a/src/drmgr/drslot_chrp_mem.c b/src/drmgr/drslot_chrp_mem.c index 8560f88..fff9632 100644 --- a/src/drmgr/drslot_chrp_mem.c +++ b/src/drmgr/drslot_chrp_mem.c @@ -1015,6 +1015,31 @@ mem_add(struct options *opts) } /** + * mem_add_rtas + * @brief Add memory via the kernel rtas event interface + * + * @param opts user options + * @returns 0 on success, !0 otherwise + */ +static int mem_hp_rtas(struct options *opts) +{ + struct hp_rtas_event *hp_event; + int rc; + + hp_event = alloc_hp_rtas_event(opts, RTAS_HP_TYPE_MEMORY); + if (!hp_event) + return -1; + + /* Write to /proc */ + rc = send_rtas_event(hp_event); + if (rc) + say(ERROR, "Hotplug Failed\n"); + + free(hp_event); + return rc; +} + +/** * remove_lmbs * * @param nr_lmbs @@ -1251,14 +1276,17 @@ drslot_chrp_mem(struct options *opts) if (opts->usr_drc_name) opts->quantity = 1; - switch (opts->action) { - case ADD: - rc = mem_add(opts); - break; - - case REMOVE: - rc = mem_remove(opts); - break; + if (kernel_hotplug_rtas_exists()) { + rc = mem_hp_rtas(opts); + } else { + switch (opts->action) { + case ADD: + rc = mem_add(opts); + break; + case REMOVE: + rc = mem_remove(opts); + break; + } } return rc; |
From: Nathan F. <nf...@li...> - 2014-09-17 20:38:41
|
The usage statement for drmgr claims that we can add/remove memory and cpus by drc name or drc index. The current code though assumes that any use of the -s flag to specify this defaults to drc name. This patch updates the option checking for memory and cpu operations to allow users to specify a drc index with the -s option. This will be handled the same way the -s option for pci devices is handled, assume it is a drc name unless it starts with '0x', indicating the string is really a hex value, and switching it to a drc index. Signed-off-by: Nathan Fontenot <nf...@li...> --- src/drmgr/drslot_chrp_cpu.c | 6 ++++++ src/drmgr/drslot_chrp_mem.c | 11 ++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/drmgr/drslot_chrp_cpu.c b/src/drmgr/drslot_chrp_cpu.c index af4e283..25eb813 100644 --- a/src/drmgr/drslot_chrp_cpu.c +++ b/src/drmgr/drslot_chrp_cpu.c @@ -283,6 +283,12 @@ valid_cpu_options(struct options *opts) return -1; } + /* The -s option can specify a drc name or drc index */ + if (!strncmp(opts->usr_drc_name, "0x", 2)) { + opts->usr_drc_index = strtoul(opts->usr_drc_name, NULL, 16); + opts->usr_drc_name = NULL; + } + return 0; } diff --git a/src/drmgr/drslot_chrp_mem.c b/src/drmgr/drslot_chrp_mem.c index ac3e29a..8560f88 100644 --- a/src/drmgr/drslot_chrp_mem.c +++ b/src/drmgr/drslot_chrp_mem.c @@ -1214,9 +1214,18 @@ valid_mem_options(struct options *opts) if ((opts->quantity == 0) && (opts->usr_drc_name == NULL)) opts->quantity = 1; - if ((opts->action != ADD) && (opts->action != REMOVE)) + if ((opts->action != ADD) && (opts->action != REMOVE)) { say(ERROR, "The '-r' or '-a' option must be specified for " "memory operations\n"); + return -1; + } + + /* The -s option can specify a drc name or drc index */ + if (!strncmp(opts->usr_drc_name, "0x", 2)) { + opts->usr_drc_index = strtoul(opts->usr_drc_name, NULL, 16); + opts->usr_drc_name = NULL; + } + return 0; } |
From: Nathan F. <nf...@li...> - 2014-09-17 20:37:13
|
We can't de-reference NULL pointers, it's not a nice thing to do. I found these during some debugging, correcting to avoid future bugs. Signed-off-by: Nathan Fontenot <nf...@li...> --- src/drmgr/drslot_chrp_mem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/drmgr/drslot_chrp_mem.c b/src/drmgr/drslot_chrp_mem.c index 8b8b251..ac3e29a 100644 --- a/src/drmgr/drslot_chrp_mem.c +++ b/src/drmgr/drslot_chrp_mem.c @@ -205,7 +205,7 @@ get_mem_node_lmbs(struct lmb_list_head *lmb_list) if (lmb == NULL) { say(DEBUG, "Could not find LMB with drc-index of %x\n", - lmb->drc_index); + my_drc_index); rc = -1; break; } @@ -310,7 +310,7 @@ get_dynamic_reconfig_lmbs(struct lmb_list_head *lmb_list) if (lmb == NULL) { say(DEBUG, "Could not find LMB with drc-index of %x\n", - lmb->drc_index); + drmem->drc_index); rc = -1; break; } |
From: Aruna B. <ar...@li...> - 2014-09-17 06:36:02
|
Fix checking for hbtl in of2l_scsi (). Signed-off-by: Aruna Balakrishnaiah <ar...@li...> --- scripts/ofpathname | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ofpathname b/scripts/ofpathname index 31000a6..97032bb 100755 --- a/scripts/ofpathname +++ b/scripts/ofpathname @@ -1173,7 +1173,7 @@ of2l_scsi() local devspec=`$CAT ./devspec 2>/dev/null` # Handle virtio block devices - if [[ !$hbtl && $devspec = $DEVNAME ]]; then + if [[ $hbtl = 0 && $devspec = $DEVNAME ]]; then LOGICAL_DEVNAME="${dir##*/}" return fi |
From: Aruna B. <ar...@li...> - 2014-09-16 06:55:04
|
Add support to convert a Open Firmware device path to logical device path for virtio scsi device. Signed-off-by: Aruna Balakrishnaiah <ar...@li...> --- scripts/ofpathname | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/scripts/ofpathname b/scripts/ofpathname index f7baef7..31000a6 100755 --- a/scripts/ofpathname +++ b/scripts/ofpathname @@ -873,6 +873,14 @@ ofpathname_to_logical() DEVTYPE=${DEVICE%:*} fi + if [[ $DEVTYPE = "disk" && $FC = "v-scsi" ]]; then + DEVTYPE="v-scsi" + fi + + if [[ $DEVTYPE = "disk" && $FC = "scsi" ]]; then + DEVTYPE="scsi" + fi + if [[ $DEVTYPE = "disk" && $SAS = "sas" ]]; then DEVTYPE="sas" fi @@ -1123,6 +1131,7 @@ of2l_vscsi() # of2l_scsi() { + DEV_HBTL_NO=${DEVICE##*\@} DEV_TARGET=${DEVICE##*\@} DEV_TARGET=${DEV_TARGET%%,*} DEV_LUN=${DEVICE##*,} @@ -1147,16 +1156,19 @@ of2l_scsi() fi local hbtl=`is_hbtl $link` + local diskno # Do not call get_hbtl for virtio block devices if [[ $hbtl = 1 ]]; then get_hbtl $link + diskno=`get_scsi_disk_no $link` fi cd $link # save the name of the current directory, we may need it later... local device_dir=${PWD##/*/} - if [[ !$hbtl || ($ID = $DEV_TARGET && $LUN = $DEV_LUN) ]]; then + if [[ $hbtl = 0 || $diskno = $DEV_HBTL_NO || + ($ID = $DEV_TARGET && $LUN = $DEV_LUN) ]]; then goto_dir $PWD "devspec" local devspec=`$CAT ./devspec 2>/dev/null` |
From: Aruna B. <ar...@li...> - 2014-09-16 06:54:58
|
Add support to convert logical device path to Open firmware device path for virtio-scsi devices. Signed-off-by: Aruna Balakrishnaiah <ar...@li...> --- scripts/ofpathname | 47 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/scripts/ofpathname b/scripts/ofpathname index 52df06c..f7baef7 100755 --- a/scripts/ofpathname +++ b/scripts/ofpathname @@ -139,6 +139,39 @@ get_hbtl() } # +# get_scsi_disk_no +# Given a path that ends in an HBTL, convert the HBTL values into a +# virtual disk number (not sure what the real terminology is for it). +# To do the conversion, the HBTL (A:B:C:D) is split apart and +# calculated as; +# no = (0x1000000 | C << 16 | D) +# +# $1 path ending in HBTL +get_scsi_disk_no() +{ + get_hbtl $1 + + local C D + + C=$((0x$ID << 16)) + D=$((0x$LUN)) + + local vdiskno vdisk + typeset -i vdiskno + vdiskno=$((0x1000000 | $C | $D )) + vdisk=${vdiskno##-} + + vdisk=`echo \`bc << END +ibase=10 +obase=16 +$vdisk +END\`` + + local extrazeroes="00000000" + echo $vdisk$extrazeroes +} + +# # get_vdisk_no # Given a path that ends in an HBTL, convert the HBTL values into a # virtual disk number (not sure what the real terminology is for it). @@ -804,7 +837,19 @@ l2of_scsi() OF_PATH=$OF_PATH/$scsi_name fi - OF_PATH=$OF_PATH/sd@$ID,$LUN + local modalias="" + goto_dir $device_path "device" + if [ $? -eq 0 ]; then + modalias=`$CAT $PWD/modalias` + fi + + if [[ $modalias =~ "virtio" ]]; then + local diskno + diskno=`get_scsi_disk_no $device_dir` + OF_PATH=$OF_PATH/disk\@$diskno + else + OF_PATH=$OF_PATH/sd@$ID,$LUN + fi fi } |
From: Thomas F. <tlf...@li...> - 2014-08-19 21:14:00
|
This patch adds some support for memory slot listing and memory hotplugging on little endian systems. Signed-off-by: Thomas Falcon <tlf...@li...> --- src/drmgr/drslot_chrp_mem.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/src/drmgr/drslot_chrp_mem.c b/src/drmgr/drslot_chrp_mem.c index 7b3fb5e..3ac327b 100644 --- a/src/drmgr/drslot_chrp_mem.c +++ b/src/drmgr/drslot_chrp_mem.c @@ -48,12 +48,10 @@ get_phandle(char *path, int *phandle) int rc1,rc2; /* get "linux,phandle" property */ - rc1 = get_property(path, "linux,phandle", phandle, - sizeof(*phandle)); + rc1 = get_ofdt_uint_property(path, "linux,phandle", phandle); /* overwrite with "ibm,handle" if it exists */ - rc2 = get_property(path, "ibm,phandle", phandle, - sizeof(*phandle)); + rc2 = get_ofdt_uint_property(path, "ibm,phandle", phandle); /* return bad if both gets failed */ if (rc1 && rc2) @@ -158,7 +156,7 @@ get_lmb_size(struct dr_node *lmb) return rc; } - lmb->lmb_size = regs[3]; + lmb->lmb_size = be32toh(regs[3]); return 0; } @@ -263,6 +261,10 @@ get_dynamic_reconfig_lmbs(struct lmb_list_head *lmb_list) rc = get_property(DYNAMIC_RECONFIG_MEM, "ibm,lmb-size", &lmb_sz, sizeof(lmb_sz)); + + /* convert for LE systems */ + lmb_sz = be64toh(lmb_sz); + if (rc) { say(DEBUG, "Could not retrieve drconf LMB size\n"); return rc; @@ -288,6 +290,9 @@ get_dynamic_reconfig_lmbs(struct lmb_list_head *lmb_list) /* The first integer of the buffer is the number of entries */ num_entries = *(int *)lmb_list->drconf_buf; + /* convert for LE systems */ + num_entries = be32toh(num_entries); + /* Followed by the actual entries */ drmem = (struct drconf_mem *) (lmb_list->drconf_buf + sizeof(num_entries)); @@ -295,7 +300,7 @@ get_dynamic_reconfig_lmbs(struct lmb_list_head *lmb_list) struct dr_node *lmb; for (lmb = lmb_list->lmbs; lmb; lmb = lmb->next) { - if (lmb->drc_index == drmem->drc_index) + if (lmb->drc_index == be32toh(drmem->drc_index)) break; } @@ -308,9 +313,9 @@ get_dynamic_reconfig_lmbs(struct lmb_list_head *lmb_list) sprintf(lmb->ofdt_path, DYNAMIC_RECONFIG_MEM); lmb->lmb_size = lmb_sz; - lmb->lmb_address = drmem->address; + lmb->lmb_address = be64toh(drmem->address); - if (drmem->flags & DRMEM_ASSIGNED) { + if (be32toh(drmem->flags) & DRMEM_ASSIGNED) { found++; lmb->is_owned = 1; @@ -560,18 +565,21 @@ update_drconf_node(struct dr_node *lmb, struct lmb_list_head *lmb_list, /* The first int of the buffer is the number of entries */ entries = *(int *)lmb_list->drconf_buf; + /* convert for LE systems */ + entries = be32toh(entries); + drmem = (struct drconf_mem *)(lmb_list->drconf_buf + sizeof(entries)); for (i = 0; i < entries; i++) { - if (drmem->drc_index != lmb->drc_index) { + if (be32toh(drmem->drc_index) != lmb->drc_index) { drmem++; continue; } if (action == ADD) - drmem->flags |= DRMEM_ASSIGNED; + drmem->flags |= be32toh(DRMEM_ASSIGNED); else - drmem->flags &= ~DRMEM_ASSIGNED; + drmem->flags &= be32toh(~DRMEM_ASSIGNED); break; } -- 1.8.5.2 |
From: Joel S. <jo...@jm...> - 2014-08-17 07:31:02
|
On Wed, Aug 13, 2014 at 11:22 PM, Nathan Fontenot <nf...@li...> wrote: > I am getting pushed to get a new release out in the next couple of days so I am > planning on pulling in v2 of Joel's patches. We can continue discussing and > get a patch in for the next release. Sounds good. I'm all for improving the error messages and the usability of the smt, cores and split core flags. Joel |
From: Vasant H. <heg...@li...> - 2014-08-14 11:04:10
|
On 08/14/2014 03:10 PM, Aruna Balakrishnaiah wrote: > snap is not supported on the Ubuntu platform hence display > a suitable messsage. Ubuntu users can use log collection tool (apport-collect) > provided by distro. > > Signed-off-by: Aruna Balakrishnaiah <ar...@li...> Acked-by: Vasant Hegde <heg...@li...> -Vasant > --- > scripts/snap | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/scripts/snap b/scripts/snap > index 8f7d9e5..3e547e6 100755 > --- a/scripts/snap > +++ b/scripts/snap > @@ -34,6 +34,7 @@ my $outfile = "snap.tar.gz"; # in the working dir. > my $cmddir = "snap_commands"; # cmd output dir. > my $cmdoutdir = "$outdir/$cmddir"; # in outdir dir. > my $rsxx_exists = 0; # Does an IBM Flash Adapter exist? > +my $distro_file = "/etc/issue" > > our($opt_a, $opt_d, $opt_h, $opt_o, $opt_t, $opt_v); > > @@ -321,6 +322,13 @@ eval '%ENV=('.$1.')' if `bash -c " > $perldumpenv"` > =~ /^\s*\{(.*)\}\s*$/mxs; > > +open(my $input, "<", $distro_file); > + > +if (<$input> =~ /Ubuntu/) { > + print "snap: is not supported on the Ubuntu platform\n"; > + exit 1; > +} > + > if ($ENV{'platform'} == $ENV{'PLATFORM_UNKNOWN'} || $ENV{'platform'} == $ENV{'PLATFORM_POWERKVM_HOST'}) { > print "snap: is not supported on the $ENV{'platform_name'} platform\n"; > exit 1; > > > ------------------------------------------------------------------------------ > _______________________________________________ > Powerpc-utils-devel mailing list > Pow...@li... > https://lists.sourceforge.net/lists/listinfo/powerpc-utils-devel > |
From: Aruna B. <ar...@li...> - 2014-08-14 09:40:21
|
snap is not supported on the Ubuntu platform hence display a suitable messsage. Ubuntu users can use log collection tool (apport-collect) provided by distro. Signed-off-by: Aruna Balakrishnaiah <ar...@li...> --- scripts/snap | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scripts/snap b/scripts/snap index 8f7d9e5..3e547e6 100755 --- a/scripts/snap +++ b/scripts/snap @@ -34,6 +34,7 @@ my $outfile = "snap.tar.gz"; # in the working dir. my $cmddir = "snap_commands"; # cmd output dir. my $cmdoutdir = "$outdir/$cmddir"; # in outdir dir. my $rsxx_exists = 0; # Does an IBM Flash Adapter exist? +my $distro_file = "/etc/issue" our($opt_a, $opt_d, $opt_h, $opt_o, $opt_t, $opt_v); @@ -321,6 +322,13 @@ eval '%ENV=('.$1.')' if `bash -c " $perldumpenv"` =~ /^\s*\{(.*)\}\s*$/mxs; +open(my $input, "<", $distro_file); + +if (<$input> =~ /Ubuntu/) { + print "snap: is not supported on the Ubuntu platform\n"; + exit 1; +} + if ($ENV{'platform'} == $ENV{'PLATFORM_UNKNOWN'} || $ENV{'platform'} == $ENV{'PLATFORM_POWERKVM_HOST'}) { print "snap: is not supported on the $ENV{'platform_name'} platform\n"; exit 1; |
From: Nathan F. <nf...@li...> - 2014-08-13 13:53:05
|
On 08/11/2014 01:22 PM, Paul Clarke wrote: > On 08/09/2014 06:27 AM, Joel Stanley wrote: >> On Sat, Aug 9, 2014 at 6:05 AM, Paul Clarke <pc...@us...> wrote: >>> This patch doesn't "display what the online state of all our CPUs is". >> >> Apologies for my grammar. Also, I should have included an example of >> the output with the patch applied. It looks like this: > > Actually, it wasn't a grammar problem. It was me not understanding that > the "do_info" function existed, and you just added a call to it. Good > stuff. Ignore my incorrect statement in the earlier note. > >> $ sudo ppc64_cpu --smt=off >> $ sudo sh -c "echo 1 > /sys/devices/system/cpu/cpu5/online" >> $ ppc64_cpu --cores-on >> Bad or inconsistent SMT state: use ppc64_cpu --smt=on|off to set all >> cores to have the same number of online threads to continue. >> Core 0: 0* 1 2 3 4 5* 6 7 >> Core 1: 8* 9 10 11 12 13 14 15 >> Core 2: 16* 17 18 19 20 21 22 23 >> Core 3: 24* 25 26 27 28 29 30 31 >> >> The * means that the cpu (thread) is online. > >>> Note, ironically, that a patch I submitted about a year ago actually did >>> display the SMT state for all of the cores, but it was not incorporated. >>> It also enabled setting the SMT state for individual cores. >> >> If you have some code that makes ppc64_cpu easier to use then I'm >> happy to ack it. > > The patch I submitted last year produced the following output (note the > per-core functionality): > -- > # ppc64_cpu --smt=4 > # ppc64_cpu --smt > SMT is on > # ppc64_cpu --smt -c 0 > SMT is on > # ppc64_cpu --smt=2 -c 0 > # ppc64_cpu --smt -c 0 > SMT=2 > # ppc64_cpu --smt=1 -c 2 > # ppc64_cpu --smt > SMT=1: 2 > SMT=2: 0 > SMT=4: 1-15 I think I had a reason for not pulling these patches in when you submitted them, I think it was something to do with split-core handling, but I can't remember now. I do like the option of being able to set the smt mode for a specific core. > -- > > I'm not convinced this is better output than what's there now. do_info > was added after I submitted my patches. > I think the current output and the output from your previous patches Paul provide a helpful way to see the current state of the system. > I would argue that there may still be cause to allow easily setting the > SMT mode on a per-core basis, rather than having to resort to > onlining/offlining individual threads via the > /sys/devices/system/cpu/cpu<n>/online files. That part is a subset of > my patches. > >>>> + printf("Bad or inconsistent SMT state: use ppc64_cpu --smt to set all cores have\n" >>>> + "the same number of online threads to continue.\n"); >>>> + do_info(); >>> >>> Would it be more accurate to say "Inconsistent SMT state (not all cores >>> are in the same SMT state). Use "ppc64_cpu --smt=X" to set a consistent >>> SMT state". >> >> Did you see the v2 of this patch that I posted? It looks similar to >> what you propose (the text is in the example I pasted above). I'm fine >> with your text if you think it's clearer. > > Here's what you have in v2: > > + printf("Bad or inconsistent SMT state: use ppc64_cpu --smt=on|off > to set all\n" > > + "cores to have the same number of online > threads to continue.\n"); > > I'm suggesting that this is an opportunity to improve that message: > - reporting the system in a "bad" state is probably a bad idea > - it does say "inconsistent", but doesn't explain what that means, thus > my parenthetical > - "on|off" are not the only choices, although certainly valid, I was > just taking a cue from the help text, as you did, but "smt=X" at least > covers all of the choices > Yep, I also think the message needs an update. I am getting pushed to get a new release out in the next couple of days so I am planning on pulling in v2 of Joel's patches. We can continue discussing and get a patch in for the next release. -Nathan |
From: Paul C. <pc...@us...> - 2014-08-11 18:22:26
|
On 08/09/2014 06:27 AM, Joel Stanley wrote: > On Sat, Aug 9, 2014 at 6:05 AM, Paul Clarke <pc...@us...> wrote: >> This patch doesn't "display what the online state of all our CPUs is". > > Apologies for my grammar. Also, I should have included an example of > the output with the patch applied. It looks like this: Actually, it wasn't a grammar problem. It was me not understanding that the "do_info" function existed, and you just added a call to it. Good stuff. Ignore my incorrect statement in the earlier note. > $ sudo ppc64_cpu --smt=off > $ sudo sh -c "echo 1 > /sys/devices/system/cpu/cpu5/online" > $ ppc64_cpu --cores-on > Bad or inconsistent SMT state: use ppc64_cpu --smt=on|off to set all > cores to have the same number of online threads to continue. > Core 0: 0* 1 2 3 4 5* 6 7 > Core 1: 8* 9 10 11 12 13 14 15 > Core 2: 16* 17 18 19 20 21 22 23 > Core 3: 24* 25 26 27 28 29 30 31 > > The * means that the cpu (thread) is online. >> Note, ironically, that a patch I submitted about a year ago actually did >> display the SMT state for all of the cores, but it was not incorporated. >> It also enabled setting the SMT state for individual cores. > > If you have some code that makes ppc64_cpu easier to use then I'm > happy to ack it. The patch I submitted last year produced the following output (note the per-core functionality): -- # ppc64_cpu --smt=4 # ppc64_cpu --smt SMT is on # ppc64_cpu --smt -c 0 SMT is on # ppc64_cpu --smt=2 -c 0 # ppc64_cpu --smt -c 0 SMT=2 # ppc64_cpu --smt=1 -c 2 # ppc64_cpu --smt SMT=1: 2 SMT=2: 0 SMT=4: 1-15 -- I'm not convinced this is better output than what's there now. do_info was added after I submitted my patches. I would argue that there may still be cause to allow easily setting the SMT mode on a per-core basis, rather than having to resort to onlining/offlining individual threads via the /sys/devices/system/cpu/cpu<n>/online files. That part is a subset of my patches. >>> + printf("Bad or inconsistent SMT state: use ppc64_cpu --smt to set all cores have\n" >>> + "the same number of online threads to continue.\n"); >>> + do_info(); >> >> Would it be more accurate to say "Inconsistent SMT state (not all cores >> are in the same SMT state). Use "ppc64_cpu --smt=X" to set a consistent >> SMT state". > > Did you see the v2 of this patch that I posted? It looks similar to > what you propose (the text is in the example I pasted above). I'm fine > with your text if you think it's clearer. Here's what you have in v2: > + printf("Bad or inconsistent SMT state: use ppc64_cpu --smt=on|off to set all\n" > + "cores to have the same number of online threads to continue.\n"); I'm suggesting that this is an opportunity to improve that message: - reporting the system in a "bad" state is probably a bad idea - it does say "inconsistent", but doesn't explain what that means, thus my parenthetical - "on|off" are not the only choices, although certainly valid, I was just taking a cue from the help text, as you did, but "smt=X" at least covers all of the choices -- Regards, PC |
From: Joel S. <jo...@jm...> - 2014-08-09 11:27:40
|
Hi Paul, Thanks for the review. On Sat, Aug 9, 2014 at 6:05 AM, Paul Clarke <pc...@us...> wrote: > This patch doesn't "display what the online state of all our CPUs is". Apologies for my grammar. Also, I should have included an example of the output with the patch applied. It looks like this: $ sudo ppc64_cpu --smt=off $ sudo sh -c "echo 1 > /sys/devices/system/cpu/cpu5/online" $ ppc64_cpu --cores-on Bad or inconsistent SMT state: use ppc64_cpu --smt=on|off to set all cores to have the same number of online threads to continue. Core 0: 0* 1 2 3 4 5* 6 7 Core 1: 8* 9 10 11 12 13 14 15 Core 2: 16* 17 18 19 20 21 22 23 Core 3: 24* 25 26 27 28 29 30 31 The * means that the cpu (thread) is online. > > Note, ironically, that a patch I submitted about a year ago actually did > display the SMT state for all of the cores, but it was not incorporated. > It also enabled setting the SMT state for individual cores. If you have some code that makes ppc64_cpu easier to use then I'm happy to ack it. >> + printf("Bad or inconsistent SMT state: use ppc64_cpu --smt to set all cores have\n" >> + "the same number of online threads to continue.\n"); >> + do_info(); > > Would it be more accurate to say "Inconsistent SMT state (not all cores > are in the same SMT state). Use "ppc64_cpu --smt=X" to set a consistent > SMT state". Did you see the v2 of this patch that I posted? It looks similar to what you propose (the text is in the example I pasted above). I'm fine with your text if you think it's clearer. Joel |
From: Paul C. <pc...@us...> - 2014-08-08 20:05:56
|
On 08/05/2014 01:40 AM, Joel Stanley wrote: > With the use of splitcore, users are more likely to end up in a strange > SMT state. Be kind and display what the online state of all our CPUs is, > and explain how to get out of this hole. This patch doesn't "display what the online state of all our CPUs is". Note, ironically, that a patch I submitted about a year ago actually did display the SMT state for all of the cores, but it was not incorporated. It also enabled setting the SMT state for individual cores. > Signed-off-by: Joel Stanley <jo...@jm...> > --- > src/ppc64_cpu.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/src/ppc64_cpu.c b/src/ppc64_cpu.c > index ddd6c0e..c6b9a19 100644 > --- a/src/ppc64_cpu.c > +++ b/src/ppc64_cpu.c > @@ -1070,7 +1070,9 @@ static int do_cores_online(char *state) > > smt_state = get_smt_state(); > if (smt_state == -1) { > - printf("Bad or inconsistent SMT state\n"); > + printf("Bad or inconsistent SMT state: use ppc64_cpu --smt to set all cores have\n" > + "the same number of online threads to continue.\n"); > + do_info(); Would it be more accurate to say "Inconsistent SMT state (not all cores are in the same SMT state). Use "ppc64_cpu --smt=X" to set a consistent SMT state". > return -1; > } > -- PC |
From: Joel S. <jo...@jm...> - 2014-08-07 00:58:45
|
With the use of splitcore, users are more likely to end up in a strange SMT state. Be kind and display what the online state of all our CPUs is, and explain how to get out of this hole. Signed-off-by: Joel Stanley <jo...@jm...> --- v2: - fix a typo - specify that smt should be passed a flag src/ppc64_cpu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ppc64_cpu.c b/src/ppc64_cpu.c index ddd6c0e..4df4cdc 100644 --- a/src/ppc64_cpu.c +++ b/src/ppc64_cpu.c @@ -1070,7 +1070,9 @@ static int do_cores_online(char *state) smt_state = get_smt_state(); if (smt_state == -1) { - printf("Bad or inconsistent SMT state\n"); + printf("Bad or inconsistent SMT state: use ppc64_cpu --smt=on|off to set all\n" + "cores to have the same number of online threads to continue.\n"); + do_info(); return -1; } -- 2.0.1 |