Jack Humphries
Jack Humphries

Reputation: 13267

Considerations when writing a preemptive user-level thread scheduler in a DPDK application

I've read a good chunk of the DPDK documentation, but I'm confused as to whether it supports or encourages interrupts. The documentation flat out says that DPDK does not use interrupts, but I am still able to register for interrupts and receive them successfully.

Specifically, I'm investigating whether I can write a user-level preemptive thread scheduler for a DPDK application. In order to create this, I would need to register for timer interrupts. The documentation says that DPDK does not support schedulers.

I see that DPDK has an lthread abstraction, but its scheduler implementation requires each individual lthread to manually yield control to the scheduler, rather than control automatically be transferred back to the scheduler based on a timer interrupt.

I see the alarm functionality (in rte_alarm), which simulates timer interrupts based on polling. However, you need another pthread to do the polling, and currently the polling pthread is the one that runs the callback function (whereas I want the pthread that originally set the timer to run the callback function).

I don't understand why DPDK would implement an lthread abstraction that doesn't support preemption when it is possible to register for real timer interrupts from the OS. You may have to be more careful when using certain objects, such as lockless ring buffers, but that's manageable.

Can someone provide clarification as to what DPDK supports?

Upvotes: 0

Views: 600

Answers (1)

Andriy Berestovskyy
Andriy Berestovskyy

Reputation: 8544

DPDK supports interrupts from the UIO-mapped devices, but at the moment they mostly intended for link status changes or watchdog.

It might be possible to write a user-level preemptive thread scheduler, but one of the main points of DPDK is to avoid interrupts and context switches.

DPDK does support lcore preemption using OS scheduler, please refer the --lcores command line argument:

http://dpdk.org/doc/guides/testpmd_app_ug/run_app.html

With some performance trade-offs, you can use DPDK from a dynamically created pthreads as described here:

http://dpdk.org/doc/guides/prog_guide/env_abstraction_layer.html#non-eal-pthread-support

Upvotes: 0

Related Questions