0

i want to set rise the priority and the affinity of irq processes (spi, gpiod) in linux, from a program written in C/C++. To set the priority of my own process I use pthread_setschedparam to set the affinity of my own process I use pthread_setaffinity_np. I use pthread_self() for this functions. However especially the gpio irqs are tricky because they only are created after gpiod_line_request_rising_edge_events[1] is called. Until now I just use a shell command similar to chrt -f -p 90 $(pgrep myGpio) to give the irqs higher prioritys on my system I could just put that in a system("..") function but there should be a better solution which I just do not know.

Thank you in Advance

[1]https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/tree/include/gpiod.h#n499

Houmles
  • 197
  • 11
fws
  • 11
  • 4
  • See https://stackoverflow.com/a/20425286/1216776 – stark Feb 19 '21 at 19:36
  • thank you, I but already use the PREEMPT_RT patch my problem is not that I am not able to change the priority (I can via a shell command) but whats the best approach in C/C++. Or is the only possible way to set the irq priority a kernel module? – fws Feb 19 '21 at 20:33

1 Answers1

1

I solved it by using libprocps. It is possible to get the pid of the irq via the name of the gpio or of the spi device and then to set the cpu affinity/priority of the irq.

Robert Newton
  • 1,344
  • 12
  • 19
fws
  • 11
  • 4