I am working on an application for which it is necessary to run a CUDA kernel indefinitely. I have one CPU thread that writes stg on a list and gpu reads that list and reset
The CUDA programming language and the CUDA architecture do not currently support infinite kernels. I suggest you consider Roger's suggestion.
If you want to pursue this I suggest you add the following debug code to your kernel:
This is a software watchdog.
You can use clock() or clock64() to control how often you do (1) and (2).
You can use cuda-gdb to debug your problem.
Infinite loops are not supported in the language. The compiler may be stripping code. You may want to review the PTX and SASS. If the compiler is generating bad code you can fake it out by making the compiler think there is a valid exit condition.