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

[Xen-devel] disabling irqs in a non-preemptive OS



I've been working on a tpm backend driver in mini-os and I'm trying to eliminate all possible race conditions.

My question is what exactly do you gain from disabling irqs with

local_irq_save()
local_irq_restore()

From what I've gathered,
When you disable interupts it sets vcpu->evtchn_upcall_mask = 1, which I assume means mask all event channels. Also, in sched.c, if anything tries to call schedule while irqs are disabled the OS will crash and print and error.

mini-os is a uniprocessor and non-preemptive OS so unless your thread blocks, an irq handler (in this case event channel handler) will never be run and thus won't be able to touch your critical sections.

So really what do you get from disabling interrupts? Is it just a nice way of alerting you if something in your code block calls schedule()? Is it just a matter of good form and possibly securing your code in case someone adds preemption to mini os in the future? Or am I completely missing something here?

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

 


Rackspace

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