From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 914A6A00E6 for ; Thu, 18 Apr 2019 17:02:09 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7EB491BB9A; Thu, 18 Apr 2019 17:02:09 +0200 (CEST) Received: from mail-it1-f177.google.com (mail-it1-f177.google.com [209.85.166.177]) by dpdk.org (Postfix) with ESMTP id D47DF1BB92 for ; Thu, 18 Apr 2019 17:02:07 +0200 (CEST) Received: by mail-it1-f177.google.com with SMTP id 139so3765985ita.4 for ; Thu, 18 Apr 2019 08:02:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=hpB5yRN9IaP8TGmtRSxpSSU08w8shpKCUYbv+LQmLY8=; b=Q15F58UkxW7pn08fYpb1iJkVVbYOn5s+qLbK7319AbVPRgXiN+8RzKkJGBSd5EXRGC yf84vXKobxpVzgjDC32tZ/cQdsSN0LLF9hb0Heh2vdT3AXfEqIUrsrN9VqLkt/mFvbyN KAbFi01WSDQcQQAWSgCwgtXjQd1u0C3H2YzuZfIf+HQGMG+Bu3qyWxmxSS9NIsSRwLaN o84IsMDlfuaU1XW8TMTsFx7VnTQgJlhFwEJzm/6fouum7/EWXMajiBuWA0D1qqSaYHsk gykMwP0cEJ5FTgFPEYjAmAmO2ggnKkKnZwjoaV501hzCtXUi3MAA8xW0NdJ4+IV7r8WI U7UQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=hpB5yRN9IaP8TGmtRSxpSSU08w8shpKCUYbv+LQmLY8=; b=Ff6SKYRTpJM7/NQlQ7QNNsUmBbu9+ZJKRXPXqY4KGVcUZb8fNye5M7tb75kXlaWgBc xfS4TDuK/7FotjXoiO6UByU9KWTkBaby1bCJ5sLZ2i0n6UVKAOz+mxgBMErXtjvJvBzP eB454mb9ZiZ9Y0Pw6R8j5Zfr7HQmNVuy3OEadYqi5M8Prt5xy453uR6Tygm2TDlzKWNC SAEzvvfC9zyPmOVfljz3RuPTGCjFvZy6oHNqNAXZRPgezsqLDiGw1n8beyVvW9N4wQ9a nW+BzyvPndVuVpkbW9PeSrNK7smn9iVF01LIMYVu28V2N3PeZjz/kNbxogMAGQHfuWcb bdLA== X-Gm-Message-State: APjAAAX4u6Nmy2H7QntSsHe49+uRVCHdL8phGR+uU0RdoZf2H+eFSecZ ujETXxupy2qxNAlzFIlCsK9Jwh8H6Om5f/3zEy/Qn8jc X-Google-Smtp-Source: APXvYqwpo6DANlQb2bb+m/KDuuXX7kRcQxbksHgW7Q++u21SQ4pWQ+DVz/TMixRBU0506YCfCzHIyf+6Dhzccg3Yreg= X-Received: by 2002:a24:3508:: with SMTP id k8mr3686746ita.92.1555599726855; Thu, 18 Apr 2019 08:02:06 -0700 (PDT) MIME-Version: 1.0 From: ikuzar RABE Date: Thu, 18 Apr 2019 17:01:57 +0200 Message-ID: To: users@dpdk.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: [dpdk-users] lthread_run( ): segmentation fault X-BeenThere: users@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK usage discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: users-bounces@dpdk.org Sender: "users" 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 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: . Find the GDB manual and other documentation resources online at: . 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