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

Re: [microblaze-uclinux] Power-fail handling



Hi again John,

Thanks for the place to look. I'm in the 2.4 kernel, and it looks like emergency_sync() doesn't exist in linux/fs.h there. But I followed your clue to look in drivers/char/sysrq.c and I see something that looks like a earlier attempt at a "do_emergency_sync()" in the driver itself. I'll study this for a while to see if I can figure out how this function gets registered to be called back by the bdflush kernel thread. Is this likely to be interrupt-safe in your opinion?

Thanks,

Jim


----- Original Message ----- From: "John Williams" <jwilliams@xxxxxxxxxxxxxx>
To: <microblaze-uclinux@xxxxxxxxxxxxxx>
Sent: Sunday, October 19, 2008 10:09 PM
Subject: Re: [microblaze-uclinux] Power-fail handling


Hi Jim,

Jim Law wrote:

We have a SystemAce CardFlash with a single FAT partition. Our custom board gives an interrupt when the AC power begins to fail, allowing us at least 20ms of time before on-board power begins to go away. I'm trying to find a reliable way to flush anything that might be in uClinux's buffers to the CardFlash when we get that interrupt. I believe sync() does what we want, but I'm having issues getting there fast enough. We catch the power fail interrupt just fine. Then we throw a signal that gets caught by a handler in our application. Our application priority has been set so we catch the signal reliably quickly in the handler, and so far we're running less than 1ms into our available time. But it seems like the call to sync() does not return reliably in the time available, even if we know there is nothing pending to write to the CardFlash. I don't know if I've chosen a silly way of doing this, or if there is some other side-effect or function of sync() that might be taking the time.

You might try calling emergency_sync() directly from your interrupt handler in the driver, that's how they do it in e.g. drivers/char/sysrq.c

Your driver will have to #include <linux/fs.h> to get the function prototype.

Let us know if this helps, it's a useful capability.

Cheers,

John

___________________________
microblaze-uclinux mailing list
microblaze-uclinux@xxxxxxxxxxxxxx
Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
Mailing List Archive : http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/


___________________________
microblaze-uclinux mailing list
microblaze-uclinux@xxxxxxxxxxxxxx
Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
Mailing List Archive : http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/