summaryrefslogtreecommitdiffstats
path: root/src/htm.c
diff options
context:
space:
mode:
authorCyril Bur <cyrilbur@gmail.com>2018-04-12 16:01:57 +1000
committerAlistair Popple <alistair@popple.id.au>2018-04-26 16:37:29 +1000
commit983ae86905cdbda5a15117f88a48f75f05e1851a (patch)
treefe87c4001b28c9476373a0c78c5f60454842a54e /src/htm.c
parent542e653b5555cd389347786b54ebceb995d30aca (diff)
downloadpdbg-983ae86905cdbda5a15117f88a48f75f05e1851a.tar.gz
pdbg-983ae86905cdbda5a15117f88a48f75f05e1851a.zip
libpdbg: Lazy probing
When libpdbg runs though the device tree and calls probe() on all the targets it marks any node (and all its children) which fails to probe as "disabled". When pdbg recieves arguments to specifiy a pib, core or thread (-p -c -t) it runs though the device tree and marks nodes which do not match the specified -p -c or -t as "disabled". These two scenarios are related - that is we don't want to be operating on any disabled nodes. However, they are not the same. Consider HTM wanting to know if the machine has powersave disabled. A simple way would be to loop through all the threads and if any of them are not in "active" state then powersave must be enabled. In this scenario HTM want to be able to get the status of every thread on the machine regardless of -p -c -t flags but if the machine isn't fully speced out and has cores which didn't probe, HTM wants to know to ignore those threads. This patch introduces a "nonexistant" pdbg target status which is set during libpdbg probe() time. Later pdbg can mark nodes to targets that do 'exist' but it would like to avoid as "disabled". Attempting to solve the above problem with only a "nonexistant" flag would also require everything to be probed before selecting out chips and threads that the user is not interested in. This would be highly inefficient. This patch probes the system lazily. Signed-off-by: Alistair Popple <alistair@popple.id.au> Signed-off-by: Cyril Bur <cyrilbur@gmail.com>
Diffstat (limited to 'src/htm.c')
-rw-r--r--src/htm.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/htm.c b/src/htm.c
index 8c25a18..ab63108 100644
--- a/src/htm.c
+++ b/src/htm.c
@@ -80,6 +80,7 @@ static int run_start(enum htm_type type, int optind, int argc, char *argv[])
int rc = 0;
pdbg_for_each_class_target(HTM_ENUM_TO_STRING(type), target) {
+ pdbg_target_probe(target);
if (target_is_disabled(target))
continue;
@@ -101,6 +102,7 @@ static int run_stop(enum htm_type type, int optind, int argc, char *argv[])
int rc = 0;
pdbg_for_each_class_target(HTM_ENUM_TO_STRING(type), target) {
+ pdbg_target_probe(target);
if (target_is_disabled(target))
continue;
@@ -122,6 +124,7 @@ static int run_status(enum htm_type type, int optind, int argc, char *argv[])
int rc = 0;
pdbg_for_each_class_target(HTM_ENUM_TO_STRING(type), target) {
+ pdbg_target_probe(target);
if (target_is_disabled(target))
continue;
@@ -145,6 +148,7 @@ static int run_reset(enum htm_type type, int optind, int argc, char *argv[])
int rc = 0;
pdbg_for_each_class_target(HTM_ENUM_TO_STRING(type), target) {
+ pdbg_target_probe(target);
if (target_is_disabled(target))
continue;
@@ -181,6 +185,7 @@ static int run_dump(enum htm_type type, int optind, int argc, char *argv[])
/* size = 0 will dump everything */
printf("Dumping HTM trace to file [chip].[#]%s\n", filename);
pdbg_for_each_class_target(HTM_ENUM_TO_STRING(type), target) {
+ pdbg_target_probe(target);
if (target_is_disabled(target))
continue;
OpenPOWER on IntegriCloud