Re: NVMe: NVM capacity and unallocated capacity are zero?
Posted: Sun Mar 28, 2021 9:36 pm
Note that this is essentially a semaphore. Take a semaphore, initialize it to zero. Driver waits on the semaphore, ISR posts to it. If the IRQ occurs before the wait, the semaphore will be non-zero, and therefore the wait will not block. Therefore it is no longer necessary to ensure the right order with CLI and STI.Octocontrabass wrote:Have your scheduler provide a generic "sleep until my IRQ has arrived" function for driver threads to call, and a "wake my driver" function for ISRs to call. Hiding all of the ugly architecture-specific bits will make it feel much less like a hack. The only trick is that the IRQ may arrive before the driver tries to sleep.