In wdm.h, some IRQL are defined, and i use them in function KeRaiseIrql , this is not a problem. The Problem is that when i have a new device installed on PCIe, and there must be interrupt from this hardware device. is it the device driver to define new IRQL? or OS will define it after bootup?
Windows assigns the device an IRQL “automatically” when it wires-up the device to the IDT… which happens when your driver connects to interrupts from the device.
There’s nothing you need to do to make this happen, other than write your driver the usual way.
Thx @“Peter_Viscarola_(OSR)”
How can i know what the IRQL value is?
i want to do some KeRaiseIrql to the level to block the interrupt from this particular device.
i want to do some KeRaiseIrql to the level to block the interrupt from this particular device.
Are you actually trying to synchronize things here? Remember that raising the IRQL only affects the one CPU on which you are running. Interrupts can still be fired on another CPU. That’s why we use a spin lock.
If you really want to stop the device from interrupting, you have to find and disable the “interrupt enable” bit in the device’s registers.
thx @Tim_Roberts and @“Peter_Viscarola_(OSR)” so spin lock will lock the bus ? i recall that the book windows internal says something about a type of lock that can lock the bus. am i right about spin lock?
You say “the bus” as if there was only one. No, the spin lock is a CPU thing. When a process grabs a spin lock, any other process that tries to grab it will block.
In SMP , When a process running on processor A grabs a spin lock, any other process running on processor B that tries to grab
it will block too ?
Well, it is not going to “block” in a sense that the term “blocking” is normally used in OS-level lingo. What it is going to do is to spin in an idle do-nothing loop until the lock gets released. No context switches are going to take place on a given CPU meanwhile, because it is going to spin at elevated IRQL. Therefore, spinlocks have to be used judiciously, which is particularly true for the large systems with the large number of logical processors…
so spin lock will lock the bus ? i recall that the book windows internal says something about a type of lock that can lock the bus.
am i right about spin lock?
The very first thing that comes up to my mind when I see the lines like that is our discussion of this topic with Alberto - he believed that one might lock a bus with some “bus-level lock” that might span across multiple instructions …