[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [UNIKRAFT PATCH] include: Introduce uk/preemmpt.h



On 7/23/20 6:32 PM, Simon Kuenzer wrote:
> Hey Costin, hey Alexander,
> 
> a question from my side as clarification. I understand this is kind
> of an adopted concept from Linux.

Well, it's actually about critical sections which is an old systems
concept. [1]

> However, is it intended that interrupts do not count as preemption?
> When do I use uk_preempt_disable() and when lcpu_irqf_save()?
Disabling interrupts does disable preemption. However, here we need to
disable only preemption in order to keep the current thread running on
the current CPU. But the advantage here is we can also continue to
handle interrupts.

If for example the current thread is the ring consumer and the ring is
filled in interrupt context then we must leave the interrupts enabled.

> When scheduling is there, does this general header get a dependency
> to uksched?

That's right. More precisely, when preemptive scheduling is there.

> In such a case, shouldn't this header go to uksched and in ukring we
> include it as soon as uksched is selected?

Well, not necessarily. In the ring implementation you just need to
define critical sections. The ring implementation doesn't care whether
there is a scheduler around or not. It just needs to make the calls that
helps it define the critical sections. That's why I don't think it's
necessary to directly link the ring with the scheduler.

[1]
https://en.wikipedia.org/wiki/Critical_section#Kernel-level_critical_sections

Cheers,
Costin



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.