From: Nathan F. <nf...@li...> - 2015-04-08 19:46:59
|
This patch adds additional information to the output produced by the lsslot command for dynamic reconfiguration memory. The default output with this patch will add the address, drc index, and associativity for each LMB. #> lsslot -c mem Dynamic Reconfiguration Memory (LMB size 0x10000000) LMB2: DRC Index: 80000001 Removable: Yes Address: 10000000 Associativity: 0 0 1 1 Section(s): 1 -- snip -- Additionally, this patch allows users to specify the -d 4 option to lsslot for memory which will print information about all possible LMBs, not just the LMBs owned by the system. This patch also adds the ability to print the information for a specific LMB by specifyinf its drc index with the -s option. #> lsslot -c mem -s 0x80000011 Dynamic Reconfiguration Memory (LMB size 0x10000000) LMB18: DRC Index: 80000011 Removable: Yes Address: 110000000 Associativity: 0 0 1 1 Section(s): 17 Signed-off-by: Nathan Fontenot <nf...@li...> --- diff --git a/src/drmgr/drslot_chrp_mem.c b/src/drmgr/drslot_chrp_mem.c index ef16e93..9176eeb 100644 --- a/src/drmgr/drslot_chrp_mem.c +++ b/src/drmgr/drslot_chrp_mem.c @@ -313,6 +313,7 @@ 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 = be64toh(drmem->address); + lmb->lmb_aa_index = be32toh(drmem->assoc_index); if (be32toh(drmem->flags) & DRMEM_ASSIGNED) { found++; diff --git a/src/drmgr/lsslot.c b/src/drmgr/lsslot.c index 22d1346..ea46722 100644 --- a/src/drmgr/lsslot.c +++ b/src/drmgr/lsslot.c @@ -699,8 +699,86 @@ lsslot_chrp_phb(struct cmd_opts *opts) return 0; } +int print_drconf_mem(struct cmd_opts *opts, struct lmb_list_head *lmb_list) +{ + struct dr_node *lmb; + struct mem_scn *scn; + int scn_offset = strlen("/sys/devices/system/memory/memory"); + char *aa_buf; + __be32 *aa; + int aa_size, aa_list_sz; + int i, rc; + uint32_t drc_index = 0; + + aa_size = get_property_size(DYNAMIC_RECONFIG_MEM, + "ibm,associativity-lookup-arrays"); + aa_buf = zalloc(aa_size); + rc = get_property(DYNAMIC_RECONFIG_MEM, + "ibm,associativity-lookup-arrays", aa_buf, aa_size); + if (rc) { + say(ERROR, "Could not get associativity information.\n"); + return -1; + } + + aa = (__be32 *)aa_buf; + /* skip past the number of associativity lists */ + aa++; + aa_list_sz = be32toh(*aa++); + + if (opts->s_name) + drc_index = strtol(opts->s_name, NULL, 0); + + printf("Dynamic Reconfiguration Memory (LMB size 0x%x)\n", + lmb_list->lmbs->lmb_size); + + for (lmb = lmb_list->lmbs; lmb; lmb = lmb->next) { + int first = 1; + int aa_start, aa_end; + + if (drc_index && drc_index != lmb->drc_index) + continue; + else if ((output_level < 4) && !lmb->is_owned) + continue; + + printf("%s: %s\n", lmb->drc_name, + lmb->is_owned ? "" : "Not Owned"); + + printf(" DRC Index: %x\n", lmb->drc_index); + printf(" Removable: %s\n", lmb->is_removable ? "Yes" : "No"); + printf(" Address: %lx\n", lmb->lmb_address); + printf(" Associativity: "); + if (lmb->lmb_aa_index == 0xffffffff) { + printf("Not Set\n"); + } else { + aa_start = lmb->lmb_aa_index * aa_list_sz; + aa_end = aa_start + aa_list_sz; + for (i = aa_start; i < aa_end; i++) + printf("%d ", be32toh(aa[i])); + printf("\n"); + } + + if (lmb->is_owned) { + printf(" Section(s): "); + for (scn = lmb->lmb_mem_scns; scn; scn = scn->next) { + if (first) { + printf(" %s", + &scn->sysfs_path[scn_offset]); + first = 0; + } else + printf(", %s", + &scn->sysfs_path[scn_offset]); + } + + printf("\n"); + } + } + + free(aa_buf); + return 0; +} + int -lsslot_chrp_mem(void) +lsslot_chrp_mem(struct cmd_opts *opts) { struct lmb_list_head *lmb_list; struct dr_node *lmb; @@ -712,40 +790,40 @@ lsslot_chrp_mem(void) if (lmb_list == NULL || lmb_list->lmbs == NULL) return -1; - printf("lmb size: 0x%x\n", lmb_list->lmbs->lmb_size); if (lmb_list->drconf_buf) { - printf("ibm,dynamic-reconfiguration-memory\n"); - printf("%-5s %c %s\n", "Name", 'R', "Sections"); - printf("%-5s %c %s\n", "----", '-', "--------"); + print_drconf_mem(opts, lmb_list); } else { + printf("lmb size: 0x%x\n", lmb_list->lmbs->lmb_size); printf("%-20s %-5s %c %s\n", "Memory Node", "Name", 'R', "Sections"); printf("%-20s %-5s %c %s\n", "-----------", "----", '-', "--------"); - } - for (lmb = lmb_list->lmbs; lmb; lmb = lmb->next) { - int first = 1; + for (lmb = lmb_list->lmbs; lmb; lmb = lmb->next) { + int first = 1; - if (!lmb->is_owned) - continue; + if (!lmb->is_owned) + continue; - if (!lmb_list->drconf_buf) - printf("%-20s ", &lmb->ofdt_path[lmb_offset]); + if (!lmb_list->drconf_buf) + printf("%-20s ", &lmb->ofdt_path[lmb_offset]); - printf("%-5s %c ", lmb->drc_name, - lmb->is_removable ? 'Y' : 'N'); + printf("%-5s %c ", lmb->drc_name, + lmb->is_removable ? 'Y' : 'N'); - for (scn = lmb->lmb_mem_scns; scn; scn = scn->next) { - if (first) { - printf(" %s", &scn->sysfs_path[scn_offset]); - first = 0; - } else - printf(", %s", &scn->sysfs_path[scn_offset]); - } + for (scn = lmb->lmb_mem_scns; scn; scn = scn->next) { + if (first) { + printf(" %s", + &scn->sysfs_path[scn_offset]); + first = 0; + } else + printf(", %s", + &scn->sysfs_path[scn_offset]); + } - printf("\n"); + printf("\n"); + } } free_lmbs(lmb_list); @@ -888,7 +966,7 @@ main(int argc, char *argv[]) break; case MEM: - rc = lsslot_chrp_mem(); + rc = lsslot_chrp_mem(&opts); break; case PORT: diff --git a/src/drmgr/ofdt.h b/src/drmgr/ofdt.h index 954377b..c728507 100644 --- a/src/drmgr/ofdt.h +++ b/src/drmgr/ofdt.h @@ -77,12 +77,14 @@ struct dr_node { struct mem_info { uint64_t _address; uint32_t _lmb_size; + uint32_t _lmb_aa_index; struct mem_scn *_mem_scns; struct of_node *_of_node; } _smem; #define lmb_address _node_u._smem._address #define lmb_size _node_u._smem._lmb_size +#define lmb_aa_index _node_u._smem._lmb_aa_index #define lmb_mem_scns _node_u._smem._mem_scns #define lmb_of_node _node_u._smem._of_node |
From: Paul C. <pc...@us...> - 2015-04-08 21:17:16
|
Is there documentation that needs to be updated as well? What is "Associativity", "Section(s)"? (What's "LMB" stand for?) On 04/08/2015 02:46 PM, Nathan Fontenot wrote: > This patch adds additional information to the output produced > by the lsslot command for dynamic reconfiguration memory. The > default output with this patch will add the address, drc index, > and associativity for each LMB. > > #> lsslot -c mem > Dynamic Reconfiguration Memory (LMB size 0x10000000) > LMB2: > DRC Index: 80000001 > Removable: Yes > Address: 10000000 > Associativity: 0 0 1 1 > Section(s): 1 > -- snip -- PC |
From: Nathan F. <nf...@li...> - 2015-04-09 01:25:33
|
On 04/08/2015 04:17 PM, Paul Clarke wrote: > Is there documentation that needs to be updated as well? Ahhh... yes. I should have updated the lsslot man page along with this. Thanks for pointing that out. > > What is "Associativity", "Section(s)"? (What's "LMB" stand for?) The associativity is cpu <=> memory affinity, this tells us which node the memory is on. Section(s) refers to the memory sections in sysfs, i.e. /sys/devices/system/memory/memoryXXX. LMB stands for Logical Memory Block. -Nathan > > On 04/08/2015 02:46 PM, Nathan Fontenot wrote: >> This patch adds additional information to the output produced >> by the lsslot command for dynamic reconfiguration memory. The >> default output with this patch will add the address, drc index, >> and associativity for each LMB. >> >> #> lsslot -c mem >> Dynamic Reconfiguration Memory (LMB size 0x10000000) >> LMB2: >> DRC Index: 80000001 >> Removable: Yes >> Address: 10000000 >> Associativity: 0 0 1 1 >> Section(s): 1 >> -- snip -- > > PC |
From: Nathan F. <nf...@li...> - 2015-05-14 16:31:20
|
This patch adds additional information to the output produced by the lsslot command for dynamic reconfiguration memory. The default output with this patch will add the address, drc index, and associativity for each LMB. #> lsslot -c mem Dynamic Reconfiguration Memory (LMB size 0x10000000) LMB2: DRC Index: 80000001 Address: 10000000 Removable: Yes Associativity: (index: 1) 0 1 2 2 Section(s): 1 -- snip -- Additionally, this patch allows users to specify the -d 4 option to lsslot for memory which will print information about all possible LMBs, not just the LMBs owned by the system. This patch also adds the ability to print the information for a specific LMB by specifyinf its drc index with the -s option. #> lsslot -c mem -s 0x80000011 Dynamic Reconfiguration Memory (LMB size 0x10000000) LMB191: DRC Index: 800000be Address: be0000000 Removable: No Associativity: (index: 1) 0 1 2 2 Section(s): 190 Signed-off-by: Nathan Fontenot <nf...@li...> --- Updates for v2: - Added documentation updates to man page and lsslot usage. - Reduced the lines per lmb output man/lsslot.8 | 8 ++- src/drmgr/drslot_chrp_mem.c | 1 src/drmgr/lsslot.c | 136 +++++++++++++++++++++++++++++++++++-------- src/drmgr/ofdt.h | 2 + 4 files changed, 118 insertions(+), 29 deletions(-) diff --git a/man/lsslot.8 b/man/lsslot.8 index 7e87bf1..684d4fe 100644 --- a/man/lsslot.8 +++ b/man/lsslot.8 @@ -35,8 +35,9 @@ Display occupied slots, valid for "pci" slots only. .B \-p Display caches, valid for "cpu" slots only. .TP -.B \-s <slot> -Display characteristics of the specified slot. +.B \-s [<slot> | <drc index>] +Display characteristics of the specified slot or the LMB with the specified +drc index. .TP .B \-F <delimiter> Specified a single character to delimit the output. The @@ -44,7 +45,8 @@ heading is not displayed and the columns are delimited by the specified character. .TP .B \-d -Enable debugging output. +Enable debugging output. When displaying memory information this flag will +also enable printing information about LMBs not currently owned by the system. .TP .B \-w <timeout> Specify a timeout when attempting to acquire locks. diff --git a/src/drmgr/drslot_chrp_mem.c b/src/drmgr/drslot_chrp_mem.c index 02ca978..0a5b84e 100644 --- a/src/drmgr/drslot_chrp_mem.c +++ b/src/drmgr/drslot_chrp_mem.c @@ -313,6 +313,7 @@ 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 = be64toh(drmem->address); + lmb->lmb_aa_index = be32toh(drmem->assoc_index); if (be32toh(drmem->flags) & DRMEM_ASSIGNED) { found++; diff --git a/src/drmgr/lsslot.c b/src/drmgr/lsslot.c index 22d1346..629a230 100644 --- a/src/drmgr/lsslot.c +++ b/src/drmgr/lsslot.c @@ -64,16 +64,20 @@ usage(void) "\"pci\" slots only.\n"); fprintf(stderr, " -p Display caches, valid for \"cpu\" " "slots only.\n"); - fprintf(stderr, " -s <slot>\n"); + fprintf(stderr, " -s [<slot> | <drc index>]\n"); fprintf(stderr, " Display characteristics of the " - "specified slot.\n"); + "specified slot or the LMB\n"); + fprintf(stderr, " associated with drc index.\n"); fprintf(stderr, " -F <delimiter>\n"); fprintf(stderr, " Specified a single character to " "delimit the output. The \n"); fprintf(stderr, " heading is not displayed and the " "columns are delimited by the\n"); fprintf(stderr, " specified character.\n"); - fprintf(stderr, " -d Enable debugging output.\n"); + fprintf(stderr, " -d Enable debugging output. When " + "displaying LMB information\n"); + fprintf(stderr, " this will enable printing of LMBs " + "not owned by the system.\n"); fprintf(stderr, " -w <timeout>\n"); fprintf(stderr, " Specify a timeout when attempting to " "acquire locks.\n"); @@ -699,8 +703,88 @@ lsslot_chrp_phb(struct cmd_opts *opts) return 0; } +int print_drconf_mem(struct cmd_opts *opts, struct lmb_list_head *lmb_list) +{ + struct dr_node *lmb; + struct mem_scn *scn; + int scn_offset = strlen("/sys/devices/system/memory/memory"); + char *aa_buf; + __be32 *aa; + int aa_size, aa_list_sz; + int i, rc; + uint32_t drc_index = 0; + + aa_size = get_property_size(DYNAMIC_RECONFIG_MEM, + "ibm,associativity-lookup-arrays"); + aa_buf = zalloc(aa_size); + rc = get_property(DYNAMIC_RECONFIG_MEM, + "ibm,associativity-lookup-arrays", aa_buf, aa_size); + if (rc) { + say(ERROR, "Could not get associativity information.\n"); + return -1; + } + + aa = (__be32 *)aa_buf; + /* skip past the number of associativity lists */ + aa++; + aa_list_sz = be32toh(*aa++); + + if (opts->s_name) + drc_index = strtol(opts->s_name, NULL, 0); + + printf("Dynamic Reconfiguration Memory (LMB size 0x%x)\n", + lmb_list->lmbs->lmb_size); + + for (lmb = lmb_list->lmbs; lmb; lmb = lmb->next) { + int first = 1; + int aa_start, aa_end; + + if (drc_index && drc_index != lmb->drc_index) + continue; + else if ((output_level < 4) && !lmb->is_owned) + continue; + + printf("%s: %s\n", lmb->drc_name, + lmb->is_owned ? "" : "Not Owned"); + + printf(" DRC Index: %x Address: %lx\n", + lmb->drc_index, lmb->lmb_address); + printf(" Removable: %s Associativity: ", + lmb->is_removable ? "Yes" : "No "); + + if (lmb->lmb_aa_index == 0xffffffff) { + printf("Not Set\n"); + } else { + printf("(index: %d) ", lmb->lmb_aa_index); + aa_start = lmb->lmb_aa_index * aa_list_sz; + aa_end = aa_start + aa_list_sz; + for (i = aa_start; i < aa_end; i++) + printf("%d ", be32toh(aa[i])); + printf("\n"); + } + + if (lmb->is_owned) { + printf(" Section(s):"); + for (scn = lmb->lmb_mem_scns; scn; scn = scn->next) { + if (first) { + printf(" %s", + &scn->sysfs_path[scn_offset]); + first = 0; + } else + printf(", %s", + &scn->sysfs_path[scn_offset]); + } + + printf("\n"); + } + } + + free(aa_buf); + return 0; +} + int -lsslot_chrp_mem(void) +lsslot_chrp_mem(struct cmd_opts *opts) { struct lmb_list_head *lmb_list; struct dr_node *lmb; @@ -712,40 +796,40 @@ lsslot_chrp_mem(void) if (lmb_list == NULL || lmb_list->lmbs == NULL) return -1; - printf("lmb size: 0x%x\n", lmb_list->lmbs->lmb_size); if (lmb_list->drconf_buf) { - printf("ibm,dynamic-reconfiguration-memory\n"); - printf("%-5s %c %s\n", "Name", 'R', "Sections"); - printf("%-5s %c %s\n", "----", '-', "--------"); + print_drconf_mem(opts, lmb_list); } else { + printf("lmb size: 0x%x\n", lmb_list->lmbs->lmb_size); printf("%-20s %-5s %c %s\n", "Memory Node", "Name", 'R', "Sections"); printf("%-20s %-5s %c %s\n", "-----------", "----", '-', "--------"); - } - for (lmb = lmb_list->lmbs; lmb; lmb = lmb->next) { - int first = 1; + for (lmb = lmb_list->lmbs; lmb; lmb = lmb->next) { + int first = 1; - if (!lmb->is_owned) - continue; + if (!lmb->is_owned) + continue; - if (!lmb_list->drconf_buf) - printf("%-20s ", &lmb->ofdt_path[lmb_offset]); + if (!lmb_list->drconf_buf) + printf("%-20s ", &lmb->ofdt_path[lmb_offset]); - printf("%-5s %c ", lmb->drc_name, - lmb->is_removable ? 'Y' : 'N'); + printf("%-5s %c ", lmb->drc_name, + lmb->is_removable ? 'Y' : 'N'); - for (scn = lmb->lmb_mem_scns; scn; scn = scn->next) { - if (first) { - printf(" %s", &scn->sysfs_path[scn_offset]); - first = 0; - } else - printf(", %s", &scn->sysfs_path[scn_offset]); - } + for (scn = lmb->lmb_mem_scns; scn; scn = scn->next) { + if (first) { + printf(" %s", + &scn->sysfs_path[scn_offset]); + first = 0; + } else + printf(", %s", + &scn->sysfs_path[scn_offset]); + } - printf("\n"); + printf("\n"); + } } free_lmbs(lmb_list); @@ -888,7 +972,7 @@ main(int argc, char *argv[]) break; case MEM: - rc = lsslot_chrp_mem(); + rc = lsslot_chrp_mem(&opts); break; case PORT: diff --git a/src/drmgr/ofdt.h b/src/drmgr/ofdt.h index 954377b..c728507 100644 --- a/src/drmgr/ofdt.h +++ b/src/drmgr/ofdt.h @@ -77,12 +77,14 @@ struct dr_node { struct mem_info { uint64_t _address; uint32_t _lmb_size; + uint32_t _lmb_aa_index; struct mem_scn *_mem_scns; struct of_node *_of_node; } _smem; #define lmb_address _node_u._smem._address #define lmb_size _node_u._smem._lmb_size +#define lmb_aa_index _node_u._smem._lmb_aa_index #define lmb_mem_scns _node_u._smem._mem_scns #define lmb_of_node _node_u._smem._of_node |
From: Paul C. <pc...@us...> - 2015-05-14 19:33:39
|
On 05/14/2015 11:31 AM, Nathan Fontenot wrote: > This patch adds additional information to the output produced > by the lsslot command for dynamic reconfiguration memory. The > default output with this patch will add the address, drc index, > and associativity for each LMB. > > #> lsslot -c mem > Dynamic Reconfiguration Memory (LMB size 0x10000000) > LMB2: > DRC Index: 80000001 Address: 10000000 > Removable: Yes Associativity: (index: 1) 0 1 2 2 > Section(s): 1 > -- snip -- > > Additionally, this patch allows users to specify the -d 4 option > to lsslot for memory which will print information about all possible > LMBs, not just the LMBs owned by the system. Is this supposed to read "print information about all LMBs installed in the system, not just the LMBs visible to the operating system" ? PC |
From: Nathan F. <nf...@li...> - 2015-05-15 14:00:14
|
On 05/14/2015 02:33 PM, Paul Clarke wrote: > > > On 05/14/2015 11:31 AM, Nathan Fontenot wrote: >> This patch adds additional information to the output produced >> by the lsslot command for dynamic reconfiguration memory. The >> default output with this patch will add the address, drc index, >> and associativity for each LMB. >> >> #> lsslot -c mem >> Dynamic Reconfiguration Memory (LMB size 0x10000000) >> LMB2: >> DRC Index: 80000001 Address: 10000000 >> Removable: Yes Associativity: (index: 1) 0 1 2 2 >> Section(s): 1 >> -- snip -- >> >> Additionally, this patch allows users to specify the -d 4 option >> to lsslot for memory which will print information about all possible >> LMBs, not just the LMBs owned by the system. > > Is this supposed to read "print information about all LMBs installed in the system, not just the LMBs visible to the operating system" ? > I think we could go with either wording. The number of possible LMBs is the max number of LMBs that can be possibly dlpar added to the lpar. When a partition is booted the device tree has information about all of these possible LMBs, even if they are not currently assigned to the partition. The wording I chose mirrors how I think of them, but am open to change if you think your wording is a better explanation. -Nathan |
From: Paul C. <pc...@us...> - 2015-05-15 15:59:40
|
On 05/15/2015 09:00 AM, Nathan Fontenot wrote: > On 05/14/2015 02:33 PM, Paul Clarke wrote: >> On 05/14/2015 11:31 AM, Nathan Fontenot wrote: >>> This patch adds additional information to the output produced >>> by the lsslot command for dynamic reconfiguration memory. The >>> default output with this patch will add the address, drc index, >>> and associativity for each LMB. >>> >>> #> lsslot -c mem >>> Dynamic Reconfiguration Memory (LMB size 0x10000000) >>> LMB2: >>> DRC Index: 80000001 Address: 10000000 >>> Removable: Yes Associativity: (index: 1) 0 1 2 2 >>> Section(s): 1 >>> -- snip -- >>> >>> Additionally, this patch allows users to specify the -d 4 option >>> to lsslot for memory which will print information about all possible >>> LMBs, not just the LMBs owned by the system. >> >> Is this supposed to read "print information about all LMBs installed in the system, not just the LMBs visible to the operating system" ? > > I think we could go with either wording. The number of possible LMBs is > the max number of LMBs that can be possibly dlpar added to the lpar. > When a partition is booted the device tree has information about all > of these possible LMBs, even if they are not currently assigned to the > partition. > > The wording I chose mirrors how I think of them, but am open to change > if you think your wording is a better explanation. To me, of course, my wording is clearer. :-) I was trying to clarify what "all possible LMBs" meant, and that "LMBs owned by the system" really wasn't for "the system" as a whole, but just for the operating system instance in which the command is executing. (I hope I'm actually getting those respective meanings correct.) PC |