I found that if I statically link the pcap and pfring libraries, the
problem does not exist.  Why is this?  Is there a better way to fix this?

FYI - To validate this I had to perform the following steps.

$ gcc -Wall -D_GNU_SOURCE numa.c -static -lpfring -lpcap -Wl,-Bdynamic
-lnuma -lpthread -o static-numa


$ sudo ln -sf /lib64/ld-linux-x86-64.so.2 /lib/ld64.so.1

$ sudo ./static-numa

check: found 4 cpu cores
check: cpu 0 -> numa node 0
check: cpu 1 -> numa node 0
check: cpu 2 -> numa node 0
check: cpu 3 -> numa node 0
check: max packet length of 'wlan0' = 1518

Thanks


On Mon, Aug 24, 2015 at 10:47 AM, Nick Allen <[email protected]> wrote:

> I created a small test program that isolates where this NUMA issue is
> coming from.  The problem occurs when I call
> pfring_zc_create_cluster(...).  Once inside pfring_zc_create_cluster(...)
> it is a black box to me.  Any thoughts on what else I could try to resolve
> this issue?
>
>
> $ gcc -Wall -D_GNU_SOURCE numa.c -lnuma -lpthread -lpfring -lpcap -o numa
> $ sudo ./numa
> check: found 4 cpu cores
> check: cpu 0 -> numa node 0
> check: cpu 1 -> numa node 0
> check: cpu 2 -> numa node 0
> check: cpu 3 -> numa node 0
> check: max packet length of 'wlan0' = 1518
> libnuma: Warning: node 6 not allowed
> numa_sched_setaffinity_v2_int() failed; abort
> : Invalid argument
> set_mempolicy: Invalid argument
>
>
> Here is the test program that I created.
>
> #include <numa.h>
> #include <stdio.h>
> #include <unistd.h>
> #include <pfring.h>
> #include <pfring_zc.h>
> #include <pfring_mod_sysdig.h>
> #include <numa.h>
> #include <pthread.h>
>
> static int max_packet_len(char *device)
> {
>   pfring *ring;
>   pfring_card_settings settings;
>
>   ring = pfring_open(device, 1536, PF_RING_PROMISC |
> PF_RING_ZC_NOT_REPROGRAM_RSS);
>   if (ring == NULL)
>   {
>     return 1536;
>   }
>
>   pfring_get_card_settings(ring, &settings);
>   pfring_close(ring);
>   return settings.max_packet_size;
> }
>
> /**
>  * gcc -Wall -D_GNU_SOURCE numa.c -lnuma -lpthread -lpfring -lpcap -o numa
>  */
> int main(int argc, char *args[])
> {
>   int i;
>   int numa_id;
>   int num_cpu;
>   pfring_zc_cluster *zc;
>
>   char *device = "wlan0";
>   int cluster_id = 1234;
>   int pkt_len;
>   int meta_len = 0;
>   int pkt_buffs = 4;
>   char *hugepg = "/mnt/huge";
>
>   // how many cpu?
>   num_cpu = sysconf(_SC_NPROCESSORS_ONLN);
>   printf("check: found %i cpu cores \n", num_cpu);
>
>   // which numa node for each cpu?
>   for(i = 0; i < num_cpu; i++)
>   {
>     numa_id = numa_node_of_cpu(i);
>     printf("check: cpu %i -> numa node %i \n", i, numa_id);
>   }
>
>   pkt_len = max_packet_len(device);
>   printf("check: max packet length of '%s' = %i \n", device, pkt_len);
>
>   // create the cluster
>   zc = pfring_zc_create_cluster(cluster_id, pkt_len, meta_len, pkt_buffs,
> numa_id, hugepg);
>   if (NULL == zc)
>   {
>     printf("error: %s: check huge table mount?\n", strerror(errno));
>     return -1;
>   }
>
>   return 0;
> }
>
>
> On Fri, Aug 21, 2015 at 12:09 PM, Nick Allen <[email protected]> wrote:
>
>> I have seen a few past references to issues like this on the list, but
>> nothing that helps resolve this issue for me.
>>
>> libnuma: Warning: node 6 not allowed
>> numa_sched_setaffinity_v2_int() failed; abort
>> : Invalid argument
>> set_mempolicy: Invalid argument
>>
>>
>> I am seeing this issue on both a server running CentOS 6.6 (libnuma
>> 2.0.9, Napatech NIC) and my development laptop running Ubuntu 15.04
>> (libnuma 2.0.10, Intel NIC).
>>
>> The numa_id that gets pased to 'pfring_zc_create_cluster' is 0.
>>
>> $ numactl --show
>> policy: default
>> preferred node: current
>> physcpubind: 0 1 2 3
>> cpubind: 0
>> nodebind: 0
>> membind: 0
>>
>>
>> When I originally built PF_RING, the configure script was able to find
>> the NUMA library.  Attempted against just to be sure.
>>
>> checking for numa_available in -lnuma... yes
>> checking if libnuma is present... yes
>>
>>
>> What am I doing wrong?  What other information can I provide?
>>
>> Mucho Gracias
>>
>>
>> --
>> Nick Allen <[email protected]>
>>
>
>
>
> --
> Nick Allen <[email protected]>
>



-- 
Nick Allen <[email protected]>
_______________________________________________
Ntop-misc mailing list
[email protected]
http://listgateway.unipi.it/mailman/listinfo/ntop-misc

Reply via email to