WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

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

To: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] disabling irqs in a non-preemptive OS
From: Matthew Fioravante <Matthew.Fioravante@xxxxxxxxxx>
Date: Thu, 31 Dec 2009 18:16:09 -0500
Delivery-date: Thu, 31 Dec 2009 15:19:57 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 2.0.0.23 (X11/20090817)
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
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] disabling irqs in a non-preemptive OS, Matthew Fioravante <=