flushing cache after block io
Hi,
On an ARM core with write-allocate writeback cache, there can be cache inconsistencies when an executable file is read from a block device into memory.
On a compact flash block device driver, I got around this problem by flushing the caches for the pages that bio buffers use on every bio read. E.g.
cflash_read_sectors(dev, sect_begin, nsect, buf);flush_icache_range(buf, buf + nsect*512);
Now I have the same problem with a ATA harddisk connected with a PDC20269 controller. The question is where would be the best high-level place to put these flushes so that it works regardless of what block IO driver is used?
Thanks,
Bahadir
Quoted 8 lines · Bahadir Balban
On an ARM core with write-allocate writeback cache, there can be cache inconsistencies when an executable file is read from a block device into memory.
On a compact flash block device driver, I got around this problem by flushing the caches for the pages that bio buffers use on every bio read. E.g.
Quoted 7 lines
cflash_read_sectors(dev, sect_begin, nsect, buf);flush_icache_range(buf, buf + nsect*512);Now I have the same problem with a ATA harddisk connected with a PDC20269 controller. The question is where would be the best high-level place to put these flushes so that it works regardless of what block IO driver is used?
Russell, didn't you go through all of this pain and fix it a year or two ago?
Bahadir, exactly what kernel/version is this with?
Quoted 13 lines · Mark Lord
Quoted 11 lines · Bahadir Balban
On an ARM core with write-allocate writeback cache, there can be cache inconsistencies when an executable file is read from a block device into memory.
On a compact flash block device driver, I got around this problem by flushing the caches for the pages that bio buffers use on every bio read. E.g.
cflash_read_sectors(dev, sect_begin, nsect, buf);flush_icache_range(buf, buf + nsect*512);
Quoted 7 lines
Quoted 4 lines
Now I have the same problem with a ATA harddisk connected with a PDC20269 controller. The question is where would be the best high-level place to put these flushes so that it works regardless of what block IO driver is used?
Russell, didn't you go through all of this pain and fix it a year or two ago?
I thought so.
Quoted 1 line
Bahadir, exactly what kernel/version is this with?
Bahadir must be using an old kernel.
Signature · 3 lines
Russell King Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/ maintainer of:
Quoted 7 lines · Mark Lord
Russell, didn't you go through all of this pain and fix it a year or two ago?
Bahadir, exactly what kernel/version is this with?
This is on 2.6.19 but I'm unsure if there's a fix in the tree as I might be one of the few to try ARM MPCore with a block device. Although, filesystems over mtd or nfs work fine without the flushing.
If you have an idea please let me know.
Thanks,
Bahadir
Quoted 5 lines · Bahadir Balban
Quoted 4 lines · Mark Lord
Russell, didn't you go through all of this pain and fix it a year or two ago?
Quoted 7 lines
Quoted 3 lines
Bahadir, exactly what kernel/version is this with?
This is on 2.6.19 but I'm unsure if there's a fix in the tree as I might be one of the few to try ARM MPCore with a block device. Although, filesystems over mtd or nfs work fine without the flushing.
You want to be running something post 2.6.20-rc5 ideally (so 2.6.20). There's a couple of cache flushing related patches merged between .19 and .20.
Signature · 3 lines
Russell King Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/ maintainer of: