* [LTP] [PATCH 0/2] numa_helper: get nodes with mem/cpu/both
@ 2012-07-20 10:19 Jan Stancek
2012-07-20 10:19 ` [LTP] [PATCH 1/2] numa_helper: add flag to get_allowed_nodes() Jan Stancek
` (2 more replies)
0 siblings, 3 replies; 12+ messages in thread
From: Jan Stancek @ 2012-07-20 10:19 UTC (permalink / raw)
To: ltp-list
[-- Attachment #1: Type: text/plain, Size: 2140 bytes --]
numa_helper has been used for syscalls testcases, which
care about nodes with memory. Based on discussion here:
http://article.gmane.org/gmane.linux.ltp/16325
it was deemed, that 'flag' extension would be useful,
to allow tests to ask for nodes with memory/cpu/both.
This patch series is introducing flag to get_allowed_nodes().
For example, a config like this one:
# numactl -H
available: 3 nodes (2,4-5)
node 2 cpus: 0
node 2 size: 511 MB
node 2 free: 88 MB
node 4 cpus:
node 4 size: 256 MB
node 4 free: 34 MB
node 5 cpus:
node 5 size: 255 MB
node 5 free: 59 MB
would return:
nodes (flag=0): 2 4 5 (any)
nodes (flag=1): 2 4 5 (mem)
nodes (flag=2): 2 (cpus)
nodes (flag=3): 2 (mem and cpus)
Tested with:
numactl-devel-0.9.8-7.el5
numactl-devel-2.0.3-9.el6
numactl-devel-2.0.7-6.el7
numa_node_to_cpus() is broken in older libnuma < 1, so cpumap
is used instead.
Next step (not part of this series) is to move it outside
syscalls area, so it can be used by other testcases.
Jan Stancek (2):
numa_helper: add flag to get_allowed_nodes()
update testcases to use flag for get_allowed_nodes()
.../syscalls/get_mempolicy/get_mempolicy01.c | 5 +-
testcases/kernel/syscalls/mbind/mbind01.c | 5 +-
.../kernel/syscalls/move_pages/move_pages02.c | 5 +-
.../kernel/syscalls/move_pages/move_pages03.c | 5 +-
.../kernel/syscalls/move_pages/move_pages04.c | 5 +-
.../kernel/syscalls/move_pages/move_pages05.c | 5 +-
.../kernel/syscalls/move_pages/move_pages06.c | 5 +-
.../kernel/syscalls/move_pages/move_pages07.c | 5 +-
.../kernel/syscalls/move_pages/move_pages08.c | 5 +-
.../kernel/syscalls/move_pages/move_pages09.c | 5 +-
.../kernel/syscalls/move_pages/move_pages10.c | 5 +-
.../kernel/syscalls/move_pages/move_pages11.c | 5 +-
.../syscalls/move_pages/move_pages_support.c | 8 +-
testcases/kernel/syscalls/numa/lib/numa_helper.c | 211 +++++++++++++++-----
testcases/kernel/syscalls/numa/lib/numa_helper.h | 8 +-
15 files changed, 203 insertions(+), 84 deletions(-)
[-- Attachment #2: Type: text/plain, Size: 395 bytes --]
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
[-- Attachment #3: Type: text/plain, Size: 155 bytes --]
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 12+ messages in thread* [LTP] [PATCH 1/2] numa_helper: add flag to get_allowed_nodes() 2012-07-20 10:19 [LTP] [PATCH 0/2] numa_helper: get nodes with mem/cpu/both Jan Stancek @ 2012-07-20 10:19 ` Jan Stancek 2012-07-20 10:19 ` [LTP] [PATCH 2/2] update testcases to use flag for get_allowed_nodes() Jan Stancek 2012-07-20 11:02 ` [LTP] [PATCH 0/2] numa_helper: get nodes with mem/cpu/both Caspar Zhang 2 siblings, 0 replies; 12+ messages in thread From: Jan Stancek @ 2012-07-20 10:19 UTC (permalink / raw) To: ltp-list [-- Attachment #1: Type: text/plain, Size: 358 bytes --] add flag, so testcases can request nodes with available memory/cpus or both. Also add small debug function. Signed-off-by: Jan Stancek <jstancek@redhat.com> --- testcases/kernel/syscalls/numa/lib/numa_helper.c | 211 ++++++++++++++++------ testcases/kernel/syscalls/numa/lib/numa_helper.h | 8 +- 2 files changed, 162 insertions(+), 57 deletions(-) [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: 0001-numa_helper-add-flag-to-get_allowed_nodes.patch --] [-- Type: text/x-patch; name="0001-numa_helper-add-flag-to-get_allowed_nodes.patch", Size: 7969 bytes --] diff --git a/testcases/kernel/syscalls/numa/lib/numa_helper.c b/testcases/kernel/syscalls/numa/lib/numa_helper.c index d50cb41..aa98522 100644 --- a/testcases/kernel/syscalls/numa/lib/numa_helper.c +++ b/testcases/kernel/syscalls/numa/lib/numa_helper.c @@ -27,6 +27,7 @@ #include <stdarg.h> #include <stdio.h> #include <string.h> +#include <stdlib.h> #include <unistd.h> #include <errno.h> @@ -36,26 +37,10 @@ #include "numa_helper.h" #include "linux_syscall_numbers.h" -/* - * get_allowed_nodes_arr - get number and array of available nodes - * @num_allowed_nodes: pointer where number of available nodes will be stored - * @allowed_nodes: array of available node ids, this is MPOL_F_MEMS_ALLOWED - * node bitmask compacted (without holes), so that each field - * contains node number. If NULL only num_allowed_nodes is - * returned, otherwise it cotains new allocated array, - * which caller is responsible to free. - * RETURNS: - * 0 on success - * -1 on allocation failure - * -2 on get_mempolicy failure - */ -int get_allowed_nodes_arr(int *num_allowed_nodes, int **allowed_nodes) -{ #if HAVE_NUMA_H - int i; - nodemask_t *allowed_nodemask = NULL; - unsigned long max_node; - +static unsigned long get_max_node() +{ + unsigned long max_node = 0; #if !defined(LIBNUMA_API_VERSION) || LIBNUMA_API_VERSION < 2 max_node = NUMA_NUM_NODES; /* @@ -68,61 +53,150 @@ int get_allowed_nodes_arr(int *num_allowed_nodes, int **allowed_nodes) #else max_node = numa_max_possible_node() + 1; #endif -#endif /* HAVE_NUMA_H */ + return max_node; +} - *num_allowed_nodes = 0; - if (allowed_nodes) - *allowed_nodes = NULL; +static void get_nodemask_allnodes(nodemask_t *nodemask, + unsigned long max_node) +{ + unsigned long nodemask_size = max_node/8+1; + int i; + char fn[64]; + struct stat st; -#if HAVE_NUMA_H - allowed_nodemask = malloc(max_node/8+1); - if (allowed_nodemask == NULL) - return -1; - nodemask_zero(allowed_nodemask); - - if (allowed_nodes) { - *allowed_nodes = malloc(sizeof(int)*max_node); - if (*allowed_nodes == NULL) { - free(allowed_nodemask); - return -1; - } + memset(nodemask, 0, nodemask_size); + for (i = 0; i < max_node; i++) { + sprintf(fn, "/sys/devices/system/node/node%d", i); + if (stat(fn, &st) == 0) + nodemask_set(nodemask, i); } +} +static int filter_nodemask_mem(nodemask_t *nodemask, unsigned long max_node) +{ #if MPOL_F_MEMS_ALLOWED + unsigned long nodemask_size = max_node/8+1; + memset(nodemask, 0, nodemask_size); /* * avoid numa_get_mems_allowed(), because of bug in getpol() * utility function in older versions: * http://www.spinics.net/lists/linux-numa/msg00849.html */ - if (syscall(__NR_get_mempolicy, NULL, allowed_nodemask->n, - max_node, 0, MPOL_F_MEMS_ALLOWED) < 0) { - free(allowed_nodemask); - if (allowed_nodes) { - free(*allowed_nodes); - *allowed_nodes = NULL; - } + if (syscall(__NR_get_mempolicy, NULL, nodemask->n, + max_node, 0, MPOL_F_MEMS_ALLOWED) < 0) return -2; - } #else + int i; /* * old libnuma/kernel don't have MPOL_F_MEMS_ALLOWED, so let's assume * that we can use any node with memory > 0 */ - for (i = 0; i < max_node; i++) - if (numa_node_size64(i, NULL) > 0) - nodemask_set(allowed_nodemask, i); - + for (i = 0; i < max_node; i++) { + if (!nodemask_isset(nodemask, i)) + continue; + if (numa_node_size64(i, NULL) <= 0) + nodemask_clr(nodemask, i); + } #endif /* MPOL_F_MEMS_ALLOWED */ + return 0; +} + +static int cpumask_has_cpus(char *cpumask, size_t len) +{ + int j; + for (j = 0; j < len; j++) + if (cpumask[j] == '\0') + return 0; + else if ((cpumask[j] > '0' && cpumask[j] <= '9') || + (cpumask[j] >= 'a' && cpumask[j] <= 'f')) + return 1; + return 0; + +} + +static void filter_nodemask_cpu(nodemask_t *nodemask, unsigned long max_node) +{ + char *cpumask = NULL; + char fn[64]; + FILE *f; + size_t len; + int i, ret; + for (i = 0; i < max_node; i++) { - if (nodemask_isset(allowed_nodemask, i)) { - if (allowed_nodes) - (*allowed_nodes)[*num_allowed_nodes] = i; - (*num_allowed_nodes)++; + if (!nodemask_isset(nodemask, i)) + continue; + sprintf(fn, "/sys/devices/system/node/node%d/cpumap", i); + f = fopen(fn, "r"); + if (f) { + ret = getdelim(&cpumask, &len, '\n', f); + if ((ret > 0) && (!cpumask_has_cpus(cpumask, len))) + nodemask_clr(nodemask, i); + fclose(f); } } - free(allowed_nodemask); + free(cpumask); +} #endif /* HAVE_NUMA_H */ - return 0; + +/* + * get_allowed_nodes_arr - get number and array of available nodes + * @num_nodes: pointer where number of available nodes will be stored + * @nodes: array of available node ids, this is MPOL_F_MEMS_ALLOWED + * node bitmask compacted (without holes), so that each field + * contains node number. If NULL only num_nodes is + * returned, otherwise it cotains new allocated array, + * which caller is responsible to free. + * RETURNS: + * 0 on success + * -1 on allocation failure + * -2 on get_mempolicy failure + */ +int get_allowed_nodes_arr(int flag, int *num_nodes, int **nodes) +{ + int ret = 0; +#if HAVE_NUMA_H + int i; + nodemask_t *nodemask = NULL; +#endif + *num_nodes = 0; + if (nodes) + *nodes = NULL; + +#if HAVE_NUMA_H + unsigned long max_node = get_max_node(); + unsigned long nodemask_size = max_node/8+1; + + nodemask = malloc(nodemask_size); + if (nodes) + *nodes = malloc(sizeof(int)*max_node); + + do { + if (nodemask == NULL || (nodes && (*nodes == NULL))) { + ret = -1; + break; + } + + /* allow all nodes at start, then filter based on flags */ + get_nodemask_allnodes(nodemask, max_node); + if ((flag & NH_MEMS) == NH_MEMS) { + ret = filter_nodemask_mem(nodemask, max_node); + if (ret < 0) + break; + } + if ((flag & NH_CPUS) == NH_CPUS) + filter_nodemask_cpu(nodemask, max_node); + + for (i = 0; i < max_node; i++) { + if (nodemask_isset(nodemask, i)) { + if (nodes) + (*nodes)[*num_nodes] = i; + (*num_nodes)++; + } + } + } while (0); + free(nodemask); +#endif + return ret; } /* @@ -135,7 +209,7 @@ int get_allowed_nodes_arr(int *num_allowed_nodes, int **allowed_nodes) * -2 on get_mempolicy failure * -3 on not enough allowed nodes */ -int get_allowed_nodes(int count, ...) +int get_allowed_nodes(int flag, int count, ...) { int ret; int i, *nodep; @@ -143,7 +217,7 @@ int get_allowed_nodes(int count, ...) int num_nodes = 0; int *nodes = NULL; - ret = get_allowed_nodes_arr(&num_nodes, &nodes); + ret = get_allowed_nodes_arr(flag, &num_nodes, &nodes); if (ret < 0) return ret; @@ -163,3 +237,30 @@ int get_allowed_nodes(int count, ...) return ret; } + +static void print_node_info(int flag) +{ + int *allowed_nodes = NULL; + int i, ret, num_nodes; + + ret = get_allowed_nodes_arr(flag, &num_nodes, &allowed_nodes); + printf("nodes (flag=%d): ", flag); + if (ret == 0) { + for (i = 0; i < num_nodes; i++) + printf("%d ", allowed_nodes[i]); + printf("\n"); + } else + printf("error(%d)\n", ret); + free(allowed_nodes); +} + +/* + * nh_dump_nodes - dump info about nodes to stdout + */ +void nh_dump_nodes() +{ + print_node_info(0); + print_node_info(NH_MEMS); + print_node_info(NH_CPUS); + print_node_info(NH_MEMS | NH_CPUS); +} diff --git a/testcases/kernel/syscalls/numa/lib/numa_helper.h b/testcases/kernel/syscalls/numa/lib/numa_helper.h index 6bfc58e..463019a 100644 --- a/testcases/kernel/syscalls/numa/lib/numa_helper.h +++ b/testcases/kernel/syscalls/numa/lib/numa_helper.h @@ -27,7 +27,11 @@ #include <numaif.h> #endif -int get_allowed_nodes_arr(int *num_allowed_nodes, int **allowed_nodes); -int get_allowed_nodes(int count, ...); +#define NH_MEMS (1 << 0) +#define NH_CPUS (1 << 1) + +int get_allowed_nodes_arr(int flag, int *num_nodes, int **nodes); +int get_allowed_nodes(int flag, int count, ...); +void nh_dump_nodes(); #endif [-- Attachment #3: Type: text/plain, Size: 395 bytes --] ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ [-- Attachment #4: Type: text/plain, Size: 155 bytes --] _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list ^ permalink raw reply related [flat|nested] 12+ messages in thread
* [LTP] [PATCH 2/2] update testcases to use flag for get_allowed_nodes() 2012-07-20 10:19 [LTP] [PATCH 0/2] numa_helper: get nodes with mem/cpu/both Jan Stancek 2012-07-20 10:19 ` [LTP] [PATCH 1/2] numa_helper: add flag to get_allowed_nodes() Jan Stancek @ 2012-07-20 10:19 ` Jan Stancek 2012-07-20 11:02 ` [LTP] [PATCH 0/2] numa_helper: get nodes with mem/cpu/both Caspar Zhang 2 siblings, 0 replies; 12+ messages in thread From: Jan Stancek @ 2012-07-20 10:19 UTC (permalink / raw) To: ltp-list [-- Attachment #1: Type: text/plain, Size: 1090 bytes --] Interface of get_allowed_nodes() now requires a flag, update all testcases using this interface. Also fix some checkpatch warnings. Signed-off-by: Jan Stancek <jstancek@redhat.com> --- .../syscalls/get_mempolicy/get_mempolicy01.c | 5 +++-- testcases/kernel/syscalls/mbind/mbind01.c | 5 +++-- .../kernel/syscalls/move_pages/move_pages02.c | 5 +++-- .../kernel/syscalls/move_pages/move_pages03.c | 5 +++-- .../kernel/syscalls/move_pages/move_pages04.c | 5 +++-- .../kernel/syscalls/move_pages/move_pages05.c | 5 +++-- .../kernel/syscalls/move_pages/move_pages06.c | 5 +++-- .../kernel/syscalls/move_pages/move_pages07.c | 5 +++-- .../kernel/syscalls/move_pages/move_pages08.c | 5 +++-- .../kernel/syscalls/move_pages/move_pages09.c | 5 +++-- .../kernel/syscalls/move_pages/move_pages10.c | 5 +++-- .../kernel/syscalls/move_pages/move_pages11.c | 5 +++-- .../syscalls/move_pages/move_pages_support.c | 8 +++++--- 13 files changed, 41 insertions(+), 27 deletions(-) [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: 0002-update-testcases-to-use-flag-for-get_allowed_nodes.patch --] [-- Type: text/x-patch; name="0002-update-testcases-to-use-flag-for-get_allowed_nodes.patch", Size: 9955 bytes --] diff --git a/testcases/kernel/syscalls/get_mempolicy/get_mempolicy01.c b/testcases/kernel/syscalls/get_mempolicy/get_mempolicy01.c index 9011980..d0e372c 100644 --- a/testcases/kernel/syscalls/get_mempolicy/get_mempolicy01.c +++ b/testcases/kernel/syscalls/get_mempolicy/get_mempolicy01.c @@ -234,8 +234,9 @@ static int do_test(struct test_case *tc) unsigned long len = MEM_LENGTH; int test_node = -1; - if ((ret = get_allowed_nodes(1, &test_node)) < 0) - tst_brkm(TBROK|TERRNO, cleanup, "get_allowed_nodes(): %d", ret); + ret = get_allowed_nodes(NH_MEMS, 1, &test_node); + if (ret < 0) + tst_brkm(TBROK|TERRNO, cleanup, "get_allowed_nodes: %d", ret); #if !defined(LIBNUMA_API_VERSION) || LIBNUMA_API_VERSION < 2 nodemask = malloc(sizeof(nodemask_t)); nodemask_zero(nodemask); diff --git a/testcases/kernel/syscalls/mbind/mbind01.c b/testcases/kernel/syscalls/mbind/mbind01.c index 1148324..2fc6f5a 100644 --- a/testcases/kernel/syscalls/mbind/mbind01.c +++ b/testcases/kernel/syscalls/mbind/mbind01.c @@ -220,8 +220,9 @@ static int do_test(struct test_case *tc) unsigned long *invalid_nodemask; int test_node = -1; - if ((ret = get_allowed_nodes(1, &test_node)) < 0) - tst_brkm(TBROK|TERRNO, cleanup, "get_allowed_nodes(): %d", ret); + ret = get_allowed_nodes(NH_MEMS, 1, &test_node); + if (ret < 0) + tst_brkm(TBROK|TERRNO, cleanup, "get_allowed_nodes: %d", ret); #if !defined(LIBNUMA_API_VERSION) || LIBNUMA_API_VERSION < 2 nodemask = malloc(sizeof(nodemask_t)); diff --git a/testcases/kernel/syscalls/move_pages/move_pages02.c b/testcases/kernel/syscalls/move_pages/move_pages02.c index 410e368..903de0c 100644 --- a/testcases/kernel/syscalls/move_pages/move_pages02.c +++ b/testcases/kernel/syscalls/move_pages/move_pages02.c @@ -87,8 +87,9 @@ int main(int argc, char **argv) unsigned int to_node; int ret; - if ((ret = get_allowed_nodes(2, &from_node, &to_node)) < 0) - tst_brkm(TBROK|TERRNO, cleanup, "get_allowed_nodes(): %d", ret); + ret = get_allowed_nodes(NH_MEMS, 2, &from_node, &to_node); + if (ret < 0) + tst_brkm(TBROK|TERRNO, cleanup, "get_allowed_nodes: %d", ret); /* check for looping state if -i option is given */ for (lc = 0; TEST_LOOPING(lc); lc++) { diff --git a/testcases/kernel/syscalls/move_pages/move_pages03.c b/testcases/kernel/syscalls/move_pages/move_pages03.c index 77de94d..b216803 100644 --- a/testcases/kernel/syscalls/move_pages/move_pages03.c +++ b/testcases/kernel/syscalls/move_pages/move_pages03.c @@ -126,8 +126,9 @@ int main(int argc, char **argv) unsigned int to_node; int ret; - if ((ret = get_allowed_nodes(2, &from_node, &to_node)) < 0) - tst_brkm(TBROK|TERRNO, cleanup, "get_allowed_nodes(): %d", ret); + ret = get_allowed_nodes(NH_MEMS, 2, &from_node, &to_node); + if (ret < 0) + tst_brkm(TBROK|TERRNO, cleanup, "get_allowed_nodes: %d", ret); /* check for looping state if -i option is given */ for (lc = 0; TEST_LOOPING(lc); lc++) { diff --git a/testcases/kernel/syscalls/move_pages/move_pages04.c b/testcases/kernel/syscalls/move_pages/move_pages04.c index acb4c78..5a09943 100644 --- a/testcases/kernel/syscalls/move_pages/move_pages04.c +++ b/testcases/kernel/syscalls/move_pages/move_pages04.c @@ -93,8 +93,9 @@ int main(int argc, char **argv) unsigned int to_node; int ret; - if ((ret = get_allowed_nodes(2, &from_node, &to_node)) < 0) - tst_brkm(TBROK|TERRNO, cleanup, "get_allowed_nodes(): %d", ret); + ret = get_allowed_nodes(NH_MEMS, 2, &from_node, &to_node); + if (ret < 0) + tst_brkm(TBROK|TERRNO, cleanup, "get_allowed_nodes: %d", ret); /* check for looping state if -i option is given */ for (lc = 0; TEST_LOOPING(lc); lc++) { diff --git a/testcases/kernel/syscalls/move_pages/move_pages05.c b/testcases/kernel/syscalls/move_pages/move_pages05.c index d2db475..fca97c3 100644 --- a/testcases/kernel/syscalls/move_pages/move_pages05.c +++ b/testcases/kernel/syscalls/move_pages/move_pages05.c @@ -127,8 +127,9 @@ int main(int argc, char **argv) unsigned int to_node; int ret; - if ((ret = get_allowed_nodes(2, &from_node, &to_node)) < 0) - tst_brkm(TBROK|TERRNO, cleanup, "get_allowed_nodes(): %d", ret); + ret = get_allowed_nodes(NH_MEMS, 2, &from_node, &to_node); + if (ret < 0) + tst_brkm(TBROK|TERRNO, cleanup, "get_allowed_nodes: %d", ret); /* check for looping state if -i option is given */ for (lc = 0; TEST_LOOPING(lc); lc++) { diff --git a/testcases/kernel/syscalls/move_pages/move_pages06.c b/testcases/kernel/syscalls/move_pages/move_pages06.c index 6929f8d..e414e4a 100644 --- a/testcases/kernel/syscalls/move_pages/move_pages06.c +++ b/testcases/kernel/syscalls/move_pages/move_pages06.c @@ -87,8 +87,9 @@ int main(int argc, char **argv) unsigned int to_node; int ret; - if ((ret = get_allowed_nodes(1, &from_node)) < 0) - tst_brkm(TBROK|TERRNO, cleanup, "get_allowed_nodes(): %d", ret); + ret = get_allowed_nodes(NH_MEMS, 1, &from_node); + if (ret < 0) + tst_brkm(TBROK|TERRNO, cleanup, "get_allowed_nodes: %d", ret); /* check for looping state if -i option is given */ for (lc = 0; TEST_LOOPING(lc); lc++) { diff --git a/testcases/kernel/syscalls/move_pages/move_pages07.c b/testcases/kernel/syscalls/move_pages/move_pages07.c index 4a1f96a..0027af6 100644 --- a/testcases/kernel/syscalls/move_pages/move_pages07.c +++ b/testcases/kernel/syscalls/move_pages/move_pages07.c @@ -87,8 +87,9 @@ int main(int argc, char **argv) unsigned int to_node; int ret; - if ((ret = get_allowed_nodes(2, &from_node, &to_node)) < 0) - tst_brkm(TBROK|TERRNO, cleanup, "get_allowed_nodes(): %d", ret); + ret = get_allowed_nodes(NH_MEMS, 2, &from_node, &to_node); + if (ret < 0) + tst_brkm(TBROK|TERRNO, cleanup, "get_allowed_nodes: %d", ret); /* check for looping state if -i option is given */ for (lc = 0; TEST_LOOPING(lc); lc++) { diff --git a/testcases/kernel/syscalls/move_pages/move_pages08.c b/testcases/kernel/syscalls/move_pages/move_pages08.c index 9b36a00..cd84d70 100644 --- a/testcases/kernel/syscalls/move_pages/move_pages08.c +++ b/testcases/kernel/syscalls/move_pages/move_pages08.c @@ -85,8 +85,9 @@ int main(int argc, char **argv) unsigned int to_node; int ret; - if ((ret = get_allowed_nodes(2, &from_node, &to_node)) < 0) - tst_brkm(TBROK|TERRNO, cleanup, "get_allowed_nodes(): %d", ret); + ret = get_allowed_nodes(NH_MEMS, 2, &from_node, &to_node); + if (ret < 0) + tst_brkm(TBROK|TERRNO, cleanup, "get_allowed_nodes: %d", ret); /* check for looping state if -i option is given */ for (lc = 0; TEST_LOOPING(lc); lc++) { diff --git a/testcases/kernel/syscalls/move_pages/move_pages09.c b/testcases/kernel/syscalls/move_pages/move_pages09.c index 8190a26..0d30a9e 100644 --- a/testcases/kernel/syscalls/move_pages/move_pages09.c +++ b/testcases/kernel/syscalls/move_pages/move_pages09.c @@ -84,8 +84,9 @@ int main(int argc, char **argv) unsigned int from_node; int ret; - if ((ret = get_allowed_nodes(1, &from_node)) < 0) - tst_brkm(TBROK|TERRNO, cleanup, "get_allowed_nodes(): %d", ret); + ret = get_allowed_nodes(NH_MEMS, 1, &from_node); + if (ret < 0) + tst_brkm(TBROK|TERRNO, cleanup, "get_allowed_nodes: %d", ret); /* check for looping state if -i option is given */ for (lc = 0; TEST_LOOPING(lc); lc++) { diff --git a/testcases/kernel/syscalls/move_pages/move_pages10.c b/testcases/kernel/syscalls/move_pages/move_pages10.c index cec114c..7ea3900 100644 --- a/testcases/kernel/syscalls/move_pages/move_pages10.c +++ b/testcases/kernel/syscalls/move_pages/move_pages10.c @@ -87,8 +87,9 @@ int main(int argc, char **argv) unsigned int to_node; int ret; - if ((ret = get_allowed_nodes(2, &from_node, &to_node)) < 0) - tst_brkm(TBROK|TERRNO, cleanup, "get_allowed_nodes(): %d", ret); + ret = get_allowed_nodes(NH_MEMS, 2, &from_node, &to_node); + if (ret < 0) + tst_brkm(TBROK|TERRNO, cleanup, "get_allowed_nodes: %d", ret); /* check for looping state if -i option is given */ for (lc = 0; TEST_LOOPING(lc); lc++) { diff --git a/testcases/kernel/syscalls/move_pages/move_pages11.c b/testcases/kernel/syscalls/move_pages/move_pages11.c index 3d82c6f..96006cc 100644 --- a/testcases/kernel/syscalls/move_pages/move_pages11.c +++ b/testcases/kernel/syscalls/move_pages/move_pages11.c @@ -126,8 +126,9 @@ int main(int argc, char **argv) unsigned int to_node; int ret; - if ((ret = get_allowed_nodes(2, &from_node, &to_node)) < 0) - tst_brkm(TBROK|TERRNO, cleanup, "get_allowed_nodes(): %d", ret); + ret = get_allowed_nodes(NH_MEMS, 2, &from_node, &to_node); + if (ret < 0) + tst_brkm(TBROK|TERRNO, cleanup, "get_allowed_nodes: %d", ret); /* check for looping state if -i option is given */ for (lc = 0; TEST_LOOPING(lc); lc++) { diff --git a/testcases/kernel/syscalls/move_pages/move_pages_support.c b/testcases/kernel/syscalls/move_pages/move_pages_support.c index f7e3995..5a869ec 100644 --- a/testcases/kernel/syscalls/move_pages/move_pages_support.c +++ b/testcases/kernel/syscalls/move_pages/move_pages_support.c @@ -120,7 +120,8 @@ int alloc_pages_linear(void **pages, unsigned int num) int *allowed_nodes; int ret; - ret = get_allowed_nodes_arr(&num_allowed_nodes, &allowed_nodes); + ret = get_allowed_nodes_arr(NH_MEMS, &num_allowed_nodes, + &allowed_nodes); if (ret < 0) tst_brkm(TBROK|TERRNO, NULL, "get_allowed_nodes(): %d", ret); @@ -223,7 +224,8 @@ void verify_pages_linear(void **pages, int *status, unsigned int num) int *allowed_nodes; int ret; - ret = get_allowed_nodes_arr(&num_allowed_nodes, &allowed_nodes); + ret = get_allowed_nodes_arr(NH_MEMS, &num_allowed_nodes, + &allowed_nodes); if (ret < 0) tst_brkm(TBROK|TERRNO, NULL, "get_allowed_nodes(): %d", ret); @@ -396,7 +398,7 @@ void check_config(unsigned int min_nodes) int num_allowed_nodes; int ret; - ret = get_allowed_nodes_arr(&num_allowed_nodes, NULL); + ret = get_allowed_nodes_arr(NH_MEMS, &num_allowed_nodes, NULL); if (ret < 0) tst_brkm(TBROK|TERRNO, NULL, "get_allowed_nodes(): %d", ret); [-- Attachment #3: Type: text/plain, Size: 395 bytes --] ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ [-- Attachment #4: Type: text/plain, Size: 155 bytes --] _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [LTP] [PATCH 0/2] numa_helper: get nodes with mem/cpu/both 2012-07-20 10:19 [LTP] [PATCH 0/2] numa_helper: get nodes with mem/cpu/both Jan Stancek 2012-07-20 10:19 ` [LTP] [PATCH 1/2] numa_helper: add flag to get_allowed_nodes() Jan Stancek 2012-07-20 10:19 ` [LTP] [PATCH 2/2] update testcases to use flag for get_allowed_nodes() Jan Stancek @ 2012-07-20 11:02 ` Caspar Zhang 2012-07-20 11:28 ` Jan Stancek 2012-07-26 10:14 ` Jan Stancek 2 siblings, 2 replies; 12+ messages in thread From: Caspar Zhang @ 2012-07-20 11:02 UTC (permalink / raw) To: Jan Stancek; +Cc: ltp-list On 07/20/2012 06:19 PM, Jan Stancek wrote: > numa_helper has been used for syscalls testcases, which > care about nodes with memory. Based on discussion here: > http://article.gmane.org/gmane.linux.ltp/16325 > it was deemed, that 'flag' extension would be useful, > to allow tests to ask for nodes with memory/cpu/both. > > This patch series is introducing flag to get_allowed_nodes(). > > For example, a config like this one: > # numactl -H > available: 3 nodes (2,4-5) > node 2 cpus: 0 > node 2 size: 511 MB > node 2 free: 88 MB > node 4 cpus: > node 4 size: 256 MB > node 4 free: 34 MB > node 5 cpus: > node 5 size: 255 MB > node 5 free: 59 MB > > would return: > nodes (flag=0): 2 4 5 (any) > nodes (flag=1): 2 4 5 (mem) > nodes (flag=2): 2 (cpus) > nodes (flag=3): 2 (mem and cpus) > > Tested with: > numactl-devel-0.9.8-7.el5 > numactl-devel-2.0.3-9.el6 > numactl-devel-2.0.7-6.el7 > > numa_node_to_cpus() is broken in older libnuma < 1, so cpumap > is used instead. > > Next step (not part of this series) is to move it outside > syscalls area, so it can be used by other testcases. > > Jan Stancek (2): > numa_helper: add flag to get_allowed_nodes() > update testcases to use flag for get_allowed_nodes() > > .../syscalls/get_mempolicy/get_mempolicy01.c | 5 +- > testcases/kernel/syscalls/mbind/mbind01.c | 5 +- > .../kernel/syscalls/move_pages/move_pages02.c | 5 +- > .../kernel/syscalls/move_pages/move_pages03.c | 5 +- > .../kernel/syscalls/move_pages/move_pages04.c | 5 +- > .../kernel/syscalls/move_pages/move_pages05.c | 5 +- > .../kernel/syscalls/move_pages/move_pages06.c | 5 +- > .../kernel/syscalls/move_pages/move_pages07.c | 5 +- > .../kernel/syscalls/move_pages/move_pages08.c | 5 +- > .../kernel/syscalls/move_pages/move_pages09.c | 5 +- > .../kernel/syscalls/move_pages/move_pages10.c | 5 +- > .../kernel/syscalls/move_pages/move_pages11.c | 5 +- > .../syscalls/move_pages/move_pages_support.c | 8 +- > testcases/kernel/syscalls/numa/lib/numa_helper.c | 211 +++++++++++++++----- > testcases/kernel/syscalls/numa/lib/numa_helper.h | 8 +- > 15 files changed, 203 insertions(+), 84 deletions(-) > > Thanks Jan for your patches! I want to test the patchset on all arches and on major releases, so would you mind if I hold on pushing until I finish the testing next week? Also during that period, any comments from anyone is welcomed. Thanks, Caspar ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [LTP] [PATCH 0/2] numa_helper: get nodes with mem/cpu/both 2012-07-20 11:02 ` [LTP] [PATCH 0/2] numa_helper: get nodes with mem/cpu/both Caspar Zhang @ 2012-07-20 11:28 ` Jan Stancek 2012-07-26 10:14 ` Jan Stancek 1 sibling, 0 replies; 12+ messages in thread From: Jan Stancek @ 2012-07-20 11:28 UTC (permalink / raw) To: Caspar Zhang; +Cc: ltp-list ----- Original Message ----- > From: "Caspar Zhang" <caspar@casparzhang.com> > To: "Jan Stancek" <jstancek@redhat.com> > Cc: ltp-list@lists.sourceforge.net > Sent: Friday, 20 July, 2012 1:02:47 PM > Subject: Re: [LTP] [PATCH 0/2] numa_helper: get nodes with mem/cpu/both > > On 07/20/2012 06:19 PM, Jan Stancek wrote: > > numa_helper has been used for syscalls testcases, which > > care about nodes with memory. Based on discussion here: > > http://article.gmane.org/gmane.linux.ltp/16325 > > it was deemed, that 'flag' extension would be useful, > > to allow tests to ask for nodes with memory/cpu/both. > > > > This patch series is introducing flag to get_allowed_nodes(). > > > > For example, a config like this one: > > # numactl -H > > available: 3 nodes (2,4-5) > > node 2 cpus: 0 > > node 2 size: 511 MB > > node 2 free: 88 MB > > node 4 cpus: > > node 4 size: 256 MB > > node 4 free: 34 MB > > node 5 cpus: > > node 5 size: 255 MB > > node 5 free: 59 MB > > > > would return: > > nodes (flag=0): 2 4 5 (any) > > nodes (flag=1): 2 4 5 (mem) > > nodes (flag=2): 2 (cpus) > > nodes (flag=3): 2 (mem and cpus) > > > > Tested with: > > numactl-devel-0.9.8-7.el5 > > numactl-devel-2.0.3-9.el6 > > numactl-devel-2.0.7-6.el7 > > > > numa_node_to_cpus() is broken in older libnuma < 1, so cpumap > > is used instead. > > > > Next step (not part of this series) is to move it outside > > syscalls area, so it can be used by other testcases. > > > > Jan Stancek (2): > > numa_helper: add flag to get_allowed_nodes() > > update testcases to use flag for get_allowed_nodes() > > > > .../syscalls/get_mempolicy/get_mempolicy01.c | 5 +- > > testcases/kernel/syscalls/mbind/mbind01.c | 5 +- > > .../kernel/syscalls/move_pages/move_pages02.c | 5 +- > > .../kernel/syscalls/move_pages/move_pages03.c | 5 +- > > .../kernel/syscalls/move_pages/move_pages04.c | 5 +- > > .../kernel/syscalls/move_pages/move_pages05.c | 5 +- > > .../kernel/syscalls/move_pages/move_pages06.c | 5 +- > > .../kernel/syscalls/move_pages/move_pages07.c | 5 +- > > .../kernel/syscalls/move_pages/move_pages08.c | 5 +- > > .../kernel/syscalls/move_pages/move_pages09.c | 5 +- > > .../kernel/syscalls/move_pages/move_pages10.c | 5 +- > > .../kernel/syscalls/move_pages/move_pages11.c | 5 +- > > .../syscalls/move_pages/move_pages_support.c | 8 +- > > testcases/kernel/syscalls/numa/lib/numa_helper.c | 211 > > +++++++++++++++----- > > testcases/kernel/syscalls/numa/lib/numa_helper.h | 8 +- > > 15 files changed, 203 insertions(+), 84 deletions(-) > > > > > > Thanks Jan for your patches! I want to test the patchset on all > arches > and on major releases, so would you mind if I hold on pushing until I > finish the testing next week? Sure, no time pressure here. Thank you, Jan > > Also during that period, any comments from anyone is welcomed. > > Thanks, > Caspar > > ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [LTP] [PATCH 0/2] numa_helper: get nodes with mem/cpu/both 2012-07-20 11:02 ` [LTP] [PATCH 0/2] numa_helper: get nodes with mem/cpu/both Caspar Zhang 2012-07-20 11:28 ` Jan Stancek @ 2012-07-26 10:14 ` Jan Stancek 2012-07-26 11:21 ` Caspar Zhang 2012-07-31 2:53 ` [LTP] [PATCH] syscalls/numa: check syscall availability Caspar Zhang 1 sibling, 2 replies; 12+ messages in thread From: Jan Stancek @ 2012-07-26 10:14 UTC (permalink / raw) To: Caspar Zhang; +Cc: ltp-list ----- Original Message ----- > From: "Caspar Zhang" <caspar@casparzhang.com> > To: "Jan Stancek" <jstancek@redhat.com> > Cc: ltp-list@lists.sourceforge.net > Sent: Friday, 20 July, 2012 1:02:47 PM > Subject: Re: [LTP] [PATCH 0/2] numa_helper: get nodes with mem/cpu/both > > On 07/20/2012 06:19 PM, Jan Stancek wrote: > > numa_helper has been used for syscalls testcases, which > > care about nodes with memory. Based on discussion here: > > http://article.gmane.org/gmane.linux.ltp/16325 > > it was deemed, that 'flag' extension would be useful, > > to allow tests to ask for nodes with memory/cpu/both. > > > > This patch series is introducing flag to get_allowed_nodes(). > > > > For example, a config like this one: > > # numactl -H > > available: 3 nodes (2,4-5) > > node 2 cpus: 0 > > node 2 size: 511 MB > > node 2 free: 88 MB > > node 4 cpus: > > node 4 size: 256 MB > > node 4 free: 34 MB > > node 5 cpus: > > node 5 size: 255 MB > > node 5 free: 59 MB > > > > would return: > > nodes (flag=0): 2 4 5 (any) > > nodes (flag=1): 2 4 5 (mem) > > nodes (flag=2): 2 (cpus) > > nodes (flag=3): 2 (mem and cpus) > > > > Tested with: > > numactl-devel-0.9.8-7.el5 > > numactl-devel-2.0.3-9.el6 > > numactl-devel-2.0.7-6.el7 > > > > numa_node_to_cpus() is broken in older libnuma < 1, so cpumap > > is used instead. > > > > Next step (not part of this series) is to move it outside > > syscalls area, so it can be used by other testcases. > > > > Jan Stancek (2): > > numa_helper: add flag to get_allowed_nodes() > > update testcases to use flag for get_allowed_nodes() > > > > .../syscalls/get_mempolicy/get_mempolicy01.c | 5 +- > > testcases/kernel/syscalls/mbind/mbind01.c | 5 +- > > .../kernel/syscalls/move_pages/move_pages02.c | 5 +- > > .../kernel/syscalls/move_pages/move_pages03.c | 5 +- > > .../kernel/syscalls/move_pages/move_pages04.c | 5 +- > > .../kernel/syscalls/move_pages/move_pages05.c | 5 +- > > .../kernel/syscalls/move_pages/move_pages06.c | 5 +- > > .../kernel/syscalls/move_pages/move_pages07.c | 5 +- > > .../kernel/syscalls/move_pages/move_pages08.c | 5 +- > > .../kernel/syscalls/move_pages/move_pages09.c | 5 +- > > .../kernel/syscalls/move_pages/move_pages10.c | 5 +- > > .../kernel/syscalls/move_pages/move_pages11.c | 5 +- > > .../syscalls/move_pages/move_pages_support.c | 8 +- > > testcases/kernel/syscalls/numa/lib/numa_helper.c | 211 > > +++++++++++++++----- > > testcases/kernel/syscalls/numa/lib/numa_helper.h | 8 +- > > 15 files changed, 203 insertions(+), 84 deletions(-) > > > > > > Thanks Jan for your patches! I want to test the patchset on all > arches > and on major releases, so would you mind if I hold on pushing until I > finish the testing next week? > > Also during that period, any comments from anyone is welcomed. I came across one issue. This happens on some arches, which do not support numa/get_mempolicy. What happens with v1 of this patch is: # ./mbind01 mbind01 0 TINFO : (case00) START mbind01 1 TBROK : get_allowed_nodes(): -3: errno=EINVAL(22): Invalid argument mbind01 2 TBROK : Remaining cases broken which is bad, because it should end with TCONF stating, that numa is not supported. What happens with current HEAD depends on libnuma version. The problem is the same here: we use libnuma functions in numa_helper even when numa is not supported. mbind and get_mempolicy testcases (and numa_helper) check only for HAVE_NUMA_H, etc. but they don't check numa_available(). Regards, Jan > > Thanks, > Caspar > > ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [LTP] [PATCH 0/2] numa_helper: get nodes with mem/cpu/both 2012-07-26 10:14 ` Jan Stancek @ 2012-07-26 11:21 ` Caspar Zhang 2012-07-31 2:53 ` [LTP] [PATCH] syscalls/numa: check syscall availability Caspar Zhang 1 sibling, 0 replies; 12+ messages in thread From: Caspar Zhang @ 2012-07-26 11:21 UTC (permalink / raw) To: Jan Stancek; +Cc: ltp-list [-- Attachment #1.1: Type: text/plain, Size: 4117 bytes --] On Thu, Jul 26, 2012 at 6:14 PM, Jan Stancek <jstancek@redhat.com> wrote: > > > ----- Original Message ----- > > From: "Caspar Zhang" <caspar@casparzhang.com> > > To: "Jan Stancek" <jstancek@redhat.com> > > Cc: ltp-list@lists.sourceforge.net > > Sent: Friday, 20 July, 2012 1:02:47 PM > > Subject: Re: [LTP] [PATCH 0/2] numa_helper: get nodes with mem/cpu/both > > > > On 07/20/2012 06:19 PM, Jan Stancek wrote: > > > numa_helper has been used for syscalls testcases, which > > > care about nodes with memory. Based on discussion here: > > > http://article.gmane.org/gmane.linux.ltp/16325 > > > it was deemed, that 'flag' extension would be useful, > > > to allow tests to ask for nodes with memory/cpu/both. > > > > > > This patch series is introducing flag to get_allowed_nodes(). > > > > > > For example, a config like this one: > > > # numactl -H > > > available: 3 nodes (2,4-5) > > > node 2 cpus: 0 > > > node 2 size: 511 MB > > > node 2 free: 88 MB > > > node 4 cpus: > > > node 4 size: 256 MB > > > node 4 free: 34 MB > > > node 5 cpus: > > > node 5 size: 255 MB > > > node 5 free: 59 MB > > > > > > would return: > > > nodes (flag=0): 2 4 5 (any) > > > nodes (flag=1): 2 4 5 (mem) > > > nodes (flag=2): 2 (cpus) > > > nodes (flag=3): 2 (mem and cpus) > > > > > > Tested with: > > > numactl-devel-0.9.8-7.el5 > > > numactl-devel-2.0.3-9.el6 > > > numactl-devel-2.0.7-6.el7 > > > > > > numa_node_to_cpus() is broken in older libnuma < 1, so cpumap > > > is used instead. > > > > > > Next step (not part of this series) is to move it outside > > > syscalls area, so it can be used by other testcases. > > > > > > Jan Stancek (2): > > > numa_helper: add flag to get_allowed_nodes() > > > update testcases to use flag for get_allowed_nodes() > > > > > > .../syscalls/get_mempolicy/get_mempolicy01.c | 5 +- > > > testcases/kernel/syscalls/mbind/mbind01.c | 5 +- > > > .../kernel/syscalls/move_pages/move_pages02.c | 5 +- > > > .../kernel/syscalls/move_pages/move_pages03.c | 5 +- > > > .../kernel/syscalls/move_pages/move_pages04.c | 5 +- > > > .../kernel/syscalls/move_pages/move_pages05.c | 5 +- > > > .../kernel/syscalls/move_pages/move_pages06.c | 5 +- > > > .../kernel/syscalls/move_pages/move_pages07.c | 5 +- > > > .../kernel/syscalls/move_pages/move_pages08.c | 5 +- > > > .../kernel/syscalls/move_pages/move_pages09.c | 5 +- > > > .../kernel/syscalls/move_pages/move_pages10.c | 5 +- > > > .../kernel/syscalls/move_pages/move_pages11.c | 5 +- > > > .../syscalls/move_pages/move_pages_support.c | 8 +- > > > testcases/kernel/syscalls/numa/lib/numa_helper.c | 211 > > > +++++++++++++++----- > > > testcases/kernel/syscalls/numa/lib/numa_helper.h | 8 +- > > > 15 files changed, 203 insertions(+), 84 deletions(-) > > > > > > > > > > Thanks Jan for your patches! I want to test the patchset on all > > arches > > and on major releases, so would you mind if I hold on pushing until I > > finish the testing next week? > > > > Also during that period, any comments from anyone is welcomed. > > I came across one issue. This happens on some arches, which do not support > numa/get_mempolicy. > > What happens with v1 of this patch is: > # ./mbind01 > mbind01 0 TINFO : (case00) START > mbind01 1 TBROK : get_allowed_nodes(): -3: errno=EINVAL(22): > Invalid argument > mbind01 2 TBROK : Remaining cases broken > which is bad, because it should end with TCONF stating, that numa is not > supported. > ya, I encountered this too. I have a patch for it, and will send it along with other numa related patches. Caspar > > What happens with current HEAD depends on libnuma version. The problem is > the > same here: we use libnuma functions in numa_helper even when numa is not > supported. > > mbind and get_mempolicy testcases (and numa_helper) check only for > HAVE_NUMA_H, etc. > but they don't check numa_available(). > > Regards, > Jan > > > > > Thanks, > > Caspar > > > > > [-- Attachment #1.2: Type: text/html, Size: 5548 bytes --] [-- Attachment #2: Type: text/plain, Size: 395 bytes --] ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ [-- Attachment #3: Type: text/plain, Size: 155 bytes --] _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list ^ permalink raw reply [flat|nested] 12+ messages in thread
* [LTP] [PATCH] syscalls/numa: check syscall availability 2012-07-26 10:14 ` Jan Stancek 2012-07-26 11:21 ` Caspar Zhang @ 2012-07-31 2:53 ` Caspar Zhang 2012-07-31 3:57 ` Garrett Cooper 1 sibling, 1 reply; 12+ messages in thread From: Caspar Zhang @ 2012-07-31 2:53 UTC (permalink / raw) To: Jan Stancek; +Cc: LTP List [-- Attachment #1: Type: text/plain, Size: 564 bytes --] some NUMA related syscalls: mbind, get_mempolicy are not supported on some arches (e.g. i386), I use TEST macro to test the syscall in setup() function, if the syscall is not implemented on the system, a TCONF message will given like this: get_mempolicy01 1 TCONF : syscall __NR_get_mempolicy01 not supported on your arch Signed-off-by: Caspar Zhang <caspar@casparzhang.com> --- .../syscalls/get_mempolicy/get_mempolicy01.c | 3 +++ testcases/kernel/syscalls/mbind/mbind01.c | 3 +++ 2 files changed, 6 insertions(+), 0 deletions(-) [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: 0001-syscalls-numa-check-syscall-availability.patch --] [-- Type: text/x-patch; name="0001-syscalls-numa-check-syscall-availability.patch", Size: 904 bytes --] diff --git a/testcases/kernel/syscalls/get_mempolicy/get_mempolicy01.c b/testcases/kernel/syscalls/get_mempolicy/get_mempolicy01.c index d0e372c..9179c60 100644 --- a/testcases/kernel/syscalls/get_mempolicy/get_mempolicy01.c +++ b/testcases/kernel/syscalls/get_mempolicy/get_mempolicy01.c @@ -339,6 +339,9 @@ static void cleanup(void) static void setup(void) { + /* check syscall availability */ + TEST(syscall(__NR_get_mempolicy, NULL, NULL, 0, NULL, 0)); + TEST_PAUSE; tst_tmpdir(); } diff --git a/testcases/kernel/syscalls/mbind/mbind01.c b/testcases/kernel/syscalls/mbind/mbind01.c index 2fc6f5a..3f31970 100644 --- a/testcases/kernel/syscalls/mbind/mbind01.c +++ b/testcases/kernel/syscalls/mbind/mbind01.c @@ -300,6 +300,9 @@ TEST_END: static void setup(void) { + /* check syscall availability */ + TEST(syscall(__NR_mbind, NULL, 0, 0, NULL, 0, 0)); + TEST_PAUSE; tst_tmpdir(); } [-- Attachment #3: Type: text/plain, Size: 395 bytes --] ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ [-- Attachment #4: Type: text/plain, Size: 155 bytes --] _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [LTP] [PATCH] syscalls/numa: check syscall availability 2012-07-31 2:53 ` [LTP] [PATCH] syscalls/numa: check syscall availability Caspar Zhang @ 2012-07-31 3:57 ` Garrett Cooper 2012-08-08 9:29 ` Caspar Zhang 0 siblings, 1 reply; 12+ messages in thread From: Garrett Cooper @ 2012-07-31 3:57 UTC (permalink / raw) To: Caspar Zhang; +Cc: LTP List On Mon, Jul 30, 2012 at 7:53 PM, Caspar Zhang <caspar@casparzhang.com> wrote: > > some NUMA related syscalls: mbind, get_mempolicy are not supported on > some arches (e.g. i386), I use TEST macro to test the syscall in setup() > function, if the syscall is not implemented on the system, a TCONF > message will given like this: > > get_mempolicy01 1 TCONF : syscall __NR_get_mempolicy01 not supported on your arch Using TEST isn't necessary to be honest: the syscall wrapper handles the (if you add a comment as to why things are being done in a single line, untested, that should be ok). Thanks! -Garrett ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [LTP] [PATCH] syscalls/numa: check syscall availability 2012-07-31 3:57 ` Garrett Cooper @ 2012-08-08 9:29 ` Caspar Zhang 2012-08-08 9:46 ` Garrett Cooper 0 siblings, 1 reply; 12+ messages in thread From: Caspar Zhang @ 2012-08-08 9:29 UTC (permalink / raw) To: Garrett Cooper; +Cc: LTP List On 07/31/2012 11:57 AM, Garrett Cooper wrote: > On Mon, Jul 30, 2012 at 7:53 PM, Caspar Zhang <caspar@casparzhang.com> wrote: >> >> some NUMA related syscalls: mbind, get_mempolicy are not supported on >> some arches (e.g. i386), I use TEST macro to test the syscall in setup() >> function, if the syscall is not implemented on the system, a TCONF >> message will given like this: >> >> get_mempolicy01 1 TCONF : syscall __NR_get_mempolicy01 not supported on your arch > > Using TEST isn't necessary to be honest: the syscall wrapper > handles the (if you add a comment as to why things are being done in a > single line, untested, that should be ok). > Thanks! > -Garrett > Hi Garrett, sorry I'm kind of not catching you :-( what's your suggestion of correcting/improving this message? Thanks, Caspar ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [LTP] [PATCH] syscalls/numa: check syscall availability 2012-08-08 9:29 ` Caspar Zhang @ 2012-08-08 9:46 ` Garrett Cooper 2012-08-08 14:11 ` Caspar Zhang 0 siblings, 1 reply; 12+ messages in thread From: Garrett Cooper @ 2012-08-08 9:46 UTC (permalink / raw) To: Caspar Zhang; +Cc: LTP List On Aug 8, 2012, at 2:29 AM, Caspar Zhang wrote: > On 07/31/2012 11:57 AM, Garrett Cooper wrote: >> On Mon, Jul 30, 2012 at 7:53 PM, Caspar Zhang <caspar@casparzhang.com> wrote: >>> >>> some NUMA related syscalls: mbind, get_mempolicy are not supported on >>> some arches (e.g. i386), I use TEST macro to test the syscall in setup() >>> function, if the syscall is not implemented on the system, a TCONF >>> message will given like this: >>> >>> get_mempolicy01 1 TCONF : syscall __NR_get_mempolicy01 not supported on your arch >> >> Using TEST isn't necessary to be honest: the syscall wrapper >> handles the (if you add a comment as to why things are being done in a >> single line, untested, that should be ok). >> Thanks! >> -Garrett >> > > Hi Garrett, sorry I'm kind of not catching you :-( what's your suggestion of correcting/improving this message? I'd remove "TEST(..)" from the line and just use the syscall function call. If you want, we can make syscall more explicit as far as a custom wrapper goes. Cheers! -Garrett ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [LTP] [PATCH] syscalls/numa: check syscall availability 2012-08-08 9:46 ` Garrett Cooper @ 2012-08-08 14:11 ` Caspar Zhang 0 siblings, 0 replies; 12+ messages in thread From: Caspar Zhang @ 2012-08-08 14:11 UTC (permalink / raw) To: Garrett Cooper; +Cc: LTP List On 08/08/2012 05:46 PM, Garrett Cooper wrote: > On Aug 8, 2012, at 2:29 AM, Caspar Zhang wrote: > >> On 07/31/2012 11:57 AM, Garrett Cooper wrote: >>> On Mon, Jul 30, 2012 at 7:53 PM, Caspar Zhang <caspar@casparzhang.com> wrote: >>>> >>>> some NUMA related syscalls: mbind, get_mempolicy are not supported on >>>> some arches (e.g. i386), I use TEST macro to test the syscall in setup() >>>> function, if the syscall is not implemented on the system, a TCONF >>>> message will given like this: >>>> >>>> get_mempolicy01 1 TCONF : syscall __NR_get_mempolicy01 not supported on your arch >>> >>> Using TEST isn't necessary to be honest: the syscall wrapper >>> handles the (if you add a comment as to why things are being done in a >>> single line, untested, that should be ok). >>> Thanks! >>> -Garrett >>> >> >> Hi Garrett, sorry I'm kind of not catching you :-( what's your suggestion of correcting/improving this message? > > I'd remove "TEST(..)" from the line and just use the syscall function call. > If you want, we can make syscall more explicit as far as a custom wrapper goes. OK, I'll remove TEST() and resend the patch. Thanks, Caspar > Cheers! > -Garrett > ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list ^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2012-08-08 14:11 UTC | newest] Thread overview: 12+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2012-07-20 10:19 [LTP] [PATCH 0/2] numa_helper: get nodes with mem/cpu/both Jan Stancek 2012-07-20 10:19 ` [LTP] [PATCH 1/2] numa_helper: add flag to get_allowed_nodes() Jan Stancek 2012-07-20 10:19 ` [LTP] [PATCH 2/2] update testcases to use flag for get_allowed_nodes() Jan Stancek 2012-07-20 11:02 ` [LTP] [PATCH 0/2] numa_helper: get nodes with mem/cpu/both Caspar Zhang 2012-07-20 11:28 ` Jan Stancek 2012-07-26 10:14 ` Jan Stancek 2012-07-26 11:21 ` Caspar Zhang 2012-07-31 2:53 ` [LTP] [PATCH] syscalls/numa: check syscall availability Caspar Zhang 2012-07-31 3:57 ` Garrett Cooper 2012-08-08 9:29 ` Caspar Zhang 2012-08-08 9:46 ` Garrett Cooper 2012-08-08 14:11 ` Caspar Zhang
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox