[SPDK] Re: How to fix the error generated while generating SPDK thread

Zawadzki, Tomasz <tomasz.zawadzki at intel.com>
Newsgroups dev.linux.lists.spdk
Message-ID <DM6PR11MB4220C5913BD64601373A27ABEEA60@DM6PR11MB4220.namprd11.prod.outlook.com>
Hi,

There is bit more setup needed to be done in order to use spdk_threads, at least spdk_thread_lib_init() is needed.
Even tough bit complex, the nvmf example might be good one for that. Please see:
nvmf_init_threads() in examples/nvmf/nvmf/nvmf.c 

Note: Depending on the goal, Application Framework could be used to simplify the process of preparing the environment.
https://spdk.io/doc/event.html

Thanks,
Tomek

> -----Original Message-----
> From: mostaan.fereidooni(a)gmail.com <mostaan.fereidooni(a)gmail.com>
> Sent: Monday, May 4, 2020 12:48 PM
> To: spdk(a)lists.01.org
> Subject: [SPDK] How to fix the error generated while generating SPDK thread
> 
> Hello I am new with SPDK and have done all the steps mentioned in the
> https://spdk.io/doc/getting_started.html completely and without observing
> any errors.
> 
> But when I run the following simple code on my system #include <stdio.h>
> #include <spdk/bdev.h> #include <spdk/thread.h> #include
> <spdk/queue.h>
> 
> void main()
> {
> 
>     struct spdk_thread* first_reader_thread =
>             spdk_thread_create("first_reader_thread", NULL);
> 
>     if (first_reader_thread == NULL)
>     {
>         printf("First thread creation failed...\n");
>         return ;
>     }
> 
>     struct spdk_thread* second_reader_thread =
>             spdk_thread_create("second_reader_thread", NULL);
>     if (second_reader_thread == NULL)
>     {
>         printf("Second thread creation failed...\n");
>         return ;
>     }
> 
>     printf("first reader thread id is: %"PRIu64"\n",
>            spdk_thread_get_id(first_reader_thread));
>     printf("second reader thread id is: %"PRIu64"\n",
>            spdk_thread_get_id(second_reader_thread));
>     printf("Hello World!\n");
>     return;
> }
> 
> I get the following error:
> 
> "RING: Cannot reserve memory for tailq,
> thread.c: 260:spdk_thread_create: ERROR: Unable to allocate memory for
> message ring, First thread creation failed..."
> 
> it will be appraciated if anyone can guide me to fix this error.
> _______________________________________________
> SPDK mailing list -- spdk(a)lists.01.org
> To unsubscribe send an email to spdk-leave(a)lists.01.org
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.