From 7ad53e38defba80f4cadbca3bd58fdcac92a4d62 Mon Sep 17 00:00:00 2001 From: Balaji Subramaniam Date: Mon, 12 Dec 2016 11:26:15 -0800 Subject: [PATCH] Clean-up RDT helper programs. --- rdt-discovery/l2-allocation-discovery.c | 7 ++----- rdt-discovery/l3-allocation-discovery.c | 8 ++------ rdt-discovery/monitoring-discovery.c | 7 ++----- 3 files changed, 6 insertions(+), 16 deletions(-) diff --git a/rdt-discovery/l2-allocation-discovery.c b/rdt-discovery/l2-allocation-discovery.c index cfa7c0a18..839b8dab3 100644 --- a/rdt-discovery/l2-allocation-discovery.c +++ b/rdt-discovery/l2-allocation-discovery.c @@ -3,23 +3,20 @@ #include "machine.h" int main(int argc, char *argv[]) { - int ret, det=1; struct cpuid_out res; // Logic below from https://github.com/01org/intel-cmt-cat/blob/master/lib/host_cap.c lcpuid(0x7, 0x0, &res); if (!(res.ebx & (1 << 15))) { - det = 0; return EXIT_FAILURE; } else { lcpuid(0x10, 0x0, &res); if (!(res.ebx & (1 << 2))) { - det = 0; return EXIT_FAILURE; } } - if (det) - return EXIT_SUCCESS; + // If we are here, then L2 cache allocation capability is available. + return EXIT_SUCCESS; } diff --git a/rdt-discovery/l3-allocation-discovery.c b/rdt-discovery/l3-allocation-discovery.c index 298088e58..ef984a62d 100644 --- a/rdt-discovery/l3-allocation-discovery.c +++ b/rdt-discovery/l3-allocation-discovery.c @@ -3,26 +3,22 @@ #include "machine.h" int main(int argc, char *argv[]) { - int ret, det=1; struct cpuid_out res; // Logic below from https://github.com/01org/intel-cmt-cat/blob/master/lib/host_cap.c // TODO(balajismaniam): Implement L3 CAT detection using brand string and MSR probing if // not detected using cpuid - lcpuid(0x7, 0x0, &res); if (!(res.ebx & (1 << 15))) { - det = 0; return EXIT_FAILURE; } else { lcpuid(0x10, 0x0, &res); if (!(res.ebx & (1 << 1))) { - det = 0; return EXIT_FAILURE; } } - if (det) - return EXIT_SUCCESS; + // If we are here, then L3 cache allocation capability is available. + return EXIT_SUCCESS; } diff --git a/rdt-discovery/monitoring-discovery.c b/rdt-discovery/monitoring-discovery.c index 789845cb2..c700b01d1 100644 --- a/rdt-discovery/monitoring-discovery.c +++ b/rdt-discovery/monitoring-discovery.c @@ -3,23 +3,20 @@ #include "machine.h" int main(int argc, char *argv[]) { - int ret, det=1; struct cpuid_out res; // Logic below from https://github.com/01org/intel-cmt-cat/blob/master/lib/host_cap.c lcpuid(0x7, 0x0, &res); if (!(res.ebx & (1 << 12))) { - det = 0; return EXIT_FAILURE; } else { lcpuid(0xf, 0x0, &res); if (!(res.edx & (1 << 1))) { - det=0; return EXIT_FAILURE; } } - if (det) - return EXIT_SUCCESS; + // If we are here, then cache monitoring capability is available. + return EXIT_SUCCESS; }