util: Remove the "pin" command from the m5 utility.

This command did not use any m5 ops, does the same thing as the
"taskset" command under Linux:

https://linux.die.net/man/1/taskset

and might even have introduced a build error if compiled for any other
OS since that would have left a trailing comma in the mainfuncs array.

While the last problem would be easy to correct, this is not related to
the purpose of this utility (giving access to m5 ops), and is redundant
with an existing standard utility provided with Linux.

Change-Id: Ie72b9310f5e6264f6035013f47ebe74a27464abb
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/27226
Reviewed-by: Ciro Santilli <ciro.santilli@arm.com>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Gabe Black
2020-03-25 16:06:39 -07:00
parent 8fd4d147b6
commit f64c8ce5bb

View File

@@ -38,12 +38,6 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifdef linux
#define _GNU_SOURCE
#include <sched.h>
#endif
#include <err.h>
#include <fcntl.h>
#include <inttypes.h>
@@ -303,31 +297,6 @@ do_sw99param(int argc, char *argv[])
(param >> 12) & 0xfff, (param >> 0) & 0xfff);
}
#ifdef linux
void
do_pin(int argc, char *argv[])
{
if (argc < 2)
usage();
cpu_set_t mask;
CPU_ZERO(&mask);
const char *sep = ",";
char *target = strtok(argv[0], sep);
while (target) {
CPU_SET(atoi(target), &mask);
target = strtok(NULL, sep);
}
if (sched_setaffinity(0, sizeof(cpu_set_t), &mask) < 0)
err(1, "setaffinity");
execvp(argv[1], &argv[1]);
err(1, "execvp failed!");
}
#endif
struct MainFunc
{
char *name;
@@ -349,10 +318,7 @@ struct MainFunc mainfuncs[] = {
{ "loadsymbol", do_loadsymbol, "" },
{ "initparam", do_initparam, "[key] // key must be shorter"
" than 16 chars" },
{ "sw99param", do_sw99param, "" },
#ifdef linux
{ "pin", do_pin, "<cpu> <program> [args ...]" }
#endif
{ "sw99param", do_sw99param, "" }
};
int numfuncs = sizeof(mainfuncs) / sizeof(mainfuncs[0]);