While doing some benchmarking of other code, I noticed that there were a lot of calls to rman_get_bustag/handle(). They weren't taking up much actual time since they're pretty lightweight but seemed to be unnecessary. I worked up the attached diff and benchmarked it. There are about 1000 calls a second to the rman routines without this patch and essentially none with it. It makes about a 1% difference in throughput under some IO loads. It is only for non-Promise or non-SII controllers right now since I didn't extend the initialization step to more than ata-pci.c. The same approach could be used for the other INW/OUTW calls as well but they're not in the fast path. I think it may make more of a difference with small reads. Feel free to test, cleanup, and commit. Thanks, -- Nate Index: ata-all.h =================================================================== RCS file: /home/ncvs/src/sys/dev/ata/ata-all.h,v retrieving revision 1.87 diff -u -r1.87 ata-all.h --- ata-all.h 9 Dec 2004 07:31:06 -0000 1.87 +++ ata-all.h 3 Jan 2005 09:54:40 -0000 _at__at_ -331,6 +331,8 _at__at_ struct ata_resource { struct resource *res; int offset; + bus_space_tag_t tag; + bus_space_handle_t handle; }; /* structure describing an ATA channel */ _at__at_ -493,7 +495,7 _at__at_ (offset), (addr), (count)) #define ATA_IDX_INB(ch, idx) \ - ATA_INB(ch->r_io[idx].res, ch->r_io[idx].offset) + bus_space_read_1(ch->r_io[idx].tag, ch->r_io[idx].handle, ch->r_io[idx].offset) #define ATA_IDX_INW(ch, idx) \ ATA_INW(ch->r_io[idx].res, ch->r_io[idx].offset) _at__at_ -514,13 +516,13 _at__at_ ATA_INSL_STRM(ch->r_io[idx].res, ch->r_io[idx].offset, addr, count) #define ATA_IDX_OUTB(ch, idx, value) \ - ATA_OUTB(ch->r_io[idx].res, ch->r_io[idx].offset, value) + bus_space_write_1(ch->r_io[idx].tag, ch->r_io[idx].handle, ch->r_io[idx].offset, value) #define ATA_IDX_OUTW(ch, idx, value) \ ATA_OUTW(ch->r_io[idx].res, ch->r_io[idx].offset, value) #define ATA_IDX_OUTL(ch, idx, value) \ - ATA_OUTL(ch->r_io[idx].res, ch->r_io[idx].offset, value) + bus_space_write_4(ch->r_io[idx].tag, ch->r_io[idx].handle, ch->r_io[idx].offset, value) #define ATA_IDX_OUTSW(ch, idx, addr, count) \ ATA_OUTSW(ch->r_io[idx].res, ch->r_io[idx].offset, addr, count) Index: ata-pci.c =================================================================== RCS file: /home/ncvs/src/sys/dev/ata/ata-pci.c,v retrieving revision 1.91 diff -u -r1.91 ata-pci.c --- ata-pci.c 8 Dec 2004 11:17:38 -0000 1.91 +++ ata-pci.c 3 Jan 2005 09:45:55 -0000 _at__at_ -417,15 +417,23 _at__at_ for (i = ATA_DATA; i <= ATA_STATUS; i ++) { ch->r_io[i].res = io; + ch->r_io[i].tag = rman_get_bustag(io); + ch->r_io[i].handle = rman_get_bushandle(io); ch->r_io[i].offset = i; } ch->r_io[ATA_ALTSTAT].res = altio; + ch->r_io[ATA_ALTSTAT].tag = rman_get_bustag(altio); + ch->r_io[ATA_ALTSTAT].handle = rman_get_bushandle(altio); ch->r_io[ATA_ALTSTAT].offset = ata_legacy(device_get_parent(dev)) ? 0 : 2; ch->r_io[ATA_IDX_ADDR].res = io; + ch->r_io[ATA_IDX_ADDR].tag = rman_get_bustag(io); + ch->r_io[ATA_IDX_ADDR].handle = rman_get_bushandle(io); if (ctlr->r_res1) { for (i = ATA_BMCMD_PORT; i <= ATA_BMDTP_PORT; i++) { ch->r_io[i].res = ctlr->r_res1; + ch->r_io[i].tag = rman_get_bustag(ctlr->r_res1); + ch->r_io[i].handle = rman_get_bushandle(ctlr->r_res1); ch->r_io[i].offset = (i - ATA_BMCMD_PORT)+(ch->unit * ATA_BMIOSIZE); } }Received on Mon Jan 03 2005 - 16:46:08 UTC
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:25 UTC