From: ikuzar RABE <ikuzar9295@gmail.com>
To: users@dpdk.org
Subject: [dpdk-users] lthread_run( ): segmentation fault
Date: Thu, 18 Apr 2019 17:01:57 +0200 [thread overview]
Message-ID: <CACNnN_nW9Nydt+mTN0OTxg35HHBYQ9WGqS=Y0=seagV1ANKm8g@mail.gmail.com> (raw)
Hi all,
I run the program you can see here (L-thread):
https://doc.dpdk.org/api/examples_2performance-thread_2pthread_shim_2main_8c-example.html
If I run it without changing code, it 's OK.
Now, Inside initial_lthread(), if I comment the code which run and
synchronizes _helloworld_pthread (I just keep initial_lthread),
I get a segmentation fault inside lthread_run(); I put breakpoints to
locate where the segfault comes from.
I get nothing interesting from backtrace with gdb (I put -O0 and -g3 as
optimisation and debugging options). I do not know why.
Please see below what I get:
MY-PC# gdb --args ./lthread_hello_dpdk -l 0,25
GNU gdb (Debian 7.7.1+dfsg-5) 7.7.1
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html
>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./lthread_hello_dpdk...done.
(gdb) r
Starting program: /.../lthread_hello_dpdk -l 0,25
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
EAL: Detected 48 lcore(s)
EAL: Detected 2 NUMA nodes
EAL: Multi-process socket /var/run/dpdk/rte/mp_socket
[New Thread 0x7ffff607a700 (LWP 32139)]
[New Thread 0x7ffff5879700 (LWP 32140)]
EAL: Probing VFIO support...
[New Thread 0x7ffff4ef4700 (LWP 32141)]
[New Thread 0x7fdfeefff700 (LWP 32142)]
EAL: PCI device 0000:02:00.0 on NUMA socket 0
EAL: probe driver: 8086:1583 net_i40e
PMD: Global register is changed during support QinQ parser
PMD: Global register is changed during configure hash input set
PMD: Global register is changed during configure fdir mask
PMD: Global register is changed during configure hash mask
PMD: Global register is changed during support QinQ cloud filter
PMD: Global register is changed during disable FDIR flexible payload
EAL: PCI device 0000:05:00.0 on NUMA socket 0
EAL: probe driver: 8086:1533 net_e1000_igb
EAL: PCI device 0000:06:00.0 on NUMA socket 0
EAL: probe driver: 8086:1533 net_e1000_igb
LTHREAD: starting scheduler 0x7ffbeff34040 on lcore 25 phys core 1
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fdfeefff700 (LWP 32142)]
0x0000000000000000 in ?? ()
(gdb) bt
#0 0x0000000000000000 in ?? ()
#1 0x00007ffbeff3c440 in ?? ()
#2 0x0000000000000000 in ?? ()
(gdb)
Please see below how I comment the code which run and
synchronizes _helloworld_pthread,
_thread pthread_t _tid[HELLOW_WORLD_MAX_LTHREADS];
static void *initial_lthread(void *args __attribute__((unused)))
{
int lcore = (int) rte_lcore_id();
/*
*
* We can now enable pthread API override
* and start to use the pthread APIs
*/
pthread_override_set(1);
uint64_t i;
int ret;
#if 0
/* initialize mutex for shared counter */
_print_count = 0;
pthread_mutex_init(&_print_lock, NULL);
/* initialize mutex and condition variable controlling thread exit
*/
pthread_mutex_init(&_exit_lock, NULL);
pthread_cond_init(&_exit_cond, NULL);
/* spawn a number of threads */
for (i = 0; i < HELLOW_WORLD_MAX_LTHREADS; i++) {
/*
* Not strictly necessary but
* for the sake of this example
* use an attribute to pass the desired lcore
*/
pthread_attr_t attr;
rte_cpuset_t cpuset;
// CPU_ZERO(&cpuset);
// CPU_SET(lcore, &cpuset);
// pthread_attr_init(&attr);
// pthread_attr_setaffinity_np(&attr, sizeof(rte_cpuset_t),
&cpuset);
/* create the thread */
ret = pthread_create(&_tid[i], NULL,
_helloworld_pthread, (void *) i);
if (ret != 0)
rte_exit(EXIT_FAILURE, "Cannot create helloworld
thread\n");
}
#endif
/* wait for 1s to allow threads
* to block on the condition variable
* N.B. nanosleep() is resolved to lthread_sleep()
* by the shim.
*/
struct timespec time;
time.tv_sec = 1;
time.tv_nsec = 0;
nanosleep(&time, NULL);
#if 0
/* wake up all the threads */
pthread_cond_broadcast(&_exit_cond);
/* wait for them to finish */
for (i = 0; i < HELLOW_WORLD_MAX_LTHREADS; i++) {
uint64_t thread_no;
pthread_join(_tid[i], (void *) &thread_no);
if (thread_no != i)
printf("error on thread exit\n");
}
pthread_cond_destroy(&_exit_cond);
pthread_mutex_destroy(&_print_lock);
pthread_mutex_destroy(&_exit_lock);
#endif
/* shutdown the lthread scheduler */
lthread_scheduler_shutdown(rte_lcore_id());
lthread_detach();
return NULL;
}
To summarize: if I do not create lthread within init_thread I get
segmentation fault
Thank you for your help,
Regards,
ikuzar
reply other threads:[~2019-04-18 15:02 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CACNnN_nW9Nydt+mTN0OTxg35HHBYQ9WGqS=Y0=seagV1ANKm8g@mail.gmail.com' \
--to=ikuzar9295@gmail.com \
--cc=users@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).