From 7ca7b343ff9949293a005aab9aec06cc7fb98093 Mon Sep 17 00:00:00 2001 From: Lisa Hsu Date: Sun, 4 Jul 2004 16:47:07 -0400 Subject: almost forgot to do this - hope it doesn't mess up schedule. dev/ns_gige.cc: dev/ns_gige.hh: add the stats nate wanted --HG-- extra : convert_revision : b59d586def7df31741b53cdb59cf3b19253caf26 --- dev/ns_gige.cc | 84 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--- dev/ns_gige.hh | 8 ++++++ 2 files changed, 88 insertions(+), 4 deletions(-) diff --git a/dev/ns_gige.cc b/dev/ns_gige.cc index 64f255e6b..f88fc507f 100644 --- a/dev/ns_gige.cc +++ b/dev/ns_gige.cc @@ -187,6 +187,59 @@ NSGigE::regStats() .prereq(rxBytes) ; + txIPChecksums + .name(name() + ".txIPChecksums") + .desc("Number of tx IP Checksums done by device") + .precision(0) + .prereq(txBytes) + ; + + rxIPChecksums + .name(name() + ".rxIPChecksums") + .desc("Number of rx IP Checksums done by device") + .precision(0) + .prereq(rxBytes) + ; + + txTCPChecksums + .name(name() + ".txTCPChecksums") + .desc("Number of tx TCP Checksums done by device") + .precision(0) + .prereq(txBytes) + ; + + rxTCPChecksums + .name(name() + ".rxTCPChecksums") + .desc("Number of rx TCP Checksums done by device") + .precision(0) + .prereq(rxBytes) + ; + + descDmaReads + .name(name() + ".descDMAReads") + .desc("Number of descriptors the device read w/ DMA") + .precision(0) + ; + + descDmaWrites + .name(name() + ".descDMAWrites") + .desc("Number of descriptors the device wrote w/ DMA") + .precision(0) + ; + + descDmaRdBytes + .name(name() + ".descDmaReadBytes") + .desc("number of descriptor bytes read w/ DMA") + .precision(0) + ; + + descDmaWrBytes + .name(name() + ".descDmaWriteBytes") + .desc("number of descriptor bytes write w/ DMA") + .precision(0) + ; + + txBandwidth .name(name() + ".txBandwidth") .desc("Transmit Bandwidth (bits/s)") @@ -1146,7 +1199,7 @@ NSGigE::doRxDmaRead() rxDmaState = dmaReadWaiting; else dmaInterface->doDMA(Read, rxDmaAddr, rxDmaLen, curTick, - &rxDmaReadEvent); + &rxDmaReadEvent, true); return true; } @@ -1198,7 +1251,7 @@ NSGigE::doRxDmaWrite() rxDmaState = dmaWriteWaiting; else dmaInterface->doDMA(WriteInvalidate, rxDmaAddr, rxDmaLen, curTick, - &rxDmaWriteEvent); + &rxDmaWriteEvent, true); return true; } @@ -1273,6 +1326,9 @@ NSGigE::rxKick() rxDmaLen = sizeof(rxDescCache.link); rxDmaFree = dmaDescFree; + descDmaReads++; + descDmaRdBytes += rxDmaLen; + if (doRxDmaRead()) goto exit; } else { @@ -1283,6 +1339,9 @@ NSGigE::rxKick() rxDmaLen = sizeof(ns_desc); rxDmaFree = dmaDescFree; + descDmaReads++; + descDmaRdBytes += rxDmaLen; + if (doRxDmaRead()) goto exit; } @@ -1400,15 +1459,18 @@ NSGigE::rxKick() if (rxPacket->isIpPkt() && extstsEnable) { rxDescCache.extsts |= EXTSTS_IPPKT; + rxIPChecksums++; if (!ipChecksum(rxPacket, false)) { DPRINTF(EthernetCksum, "Rx IP Checksum Error\n"); rxDescCache.extsts |= EXTSTS_IPERR; } if (rxPacket->isTcpPkt()) { rxDescCache.extsts |= EXTSTS_TCPPKT; + rxTCPChecksums++; if (!tcpChecksum(rxPacket, false)) { DPRINTF(EthernetCksum, "Rx TCP Checksum Error\n"); rxDescCache.extsts |= EXTSTS_TCPERR; + } } else if (rxPacket->isUdpPkt()) { rxDescCache.extsts |= EXTSTS_UDPPKT; @@ -1434,6 +1496,9 @@ NSGigE::rxKick() rxDmaLen = sizeof(rxDescCache.cmdsts) + sizeof(rxDescCache.extsts); rxDmaFree = dmaDescFree; + descDmaWrites++; + descDmaWrBytes += rxDmaLen; + if (doRxDmaWrite()) goto exit; } @@ -1586,7 +1651,7 @@ NSGigE::doTxDmaRead() txDmaState = dmaReadWaiting; else dmaInterface->doDMA(Read, txDmaAddr, txDmaLen, curTick, - &txDmaReadEvent); + &txDmaReadEvent, true); return true; } @@ -1638,7 +1703,7 @@ NSGigE::doTxDmaWrite() txDmaState = dmaWriteWaiting; else dmaInterface->doDMA(WriteInvalidate, txDmaAddr, txDmaLen, curTick, - &txDmaWriteEvent); + &txDmaWriteEvent, true); return true; } @@ -1707,6 +1772,9 @@ NSGigE::txKick() txDmaLen = sizeof(txDescCache.link); txDmaFree = dmaDescFree; + descDmaReads++; + descDmaRdBytes += txDmaLen; + if (doTxDmaRead()) goto exit; @@ -1718,6 +1786,9 @@ NSGigE::txKick() txDmaLen = sizeof(ns_desc); txDmaFree = dmaDescFree; + descDmaReads++; + descDmaRdBytes += txDmaLen; + if (doTxDmaRead()) goto exit; } @@ -1780,9 +1851,11 @@ NSGigE::txKick() udpChecksum(txPacket, true); } else if (txDescCache.extsts & EXTSTS_TCPPKT) { tcpChecksum(txPacket, true); + txTCPChecksums++; } if (txDescCache.extsts & EXTSTS_IPPKT) { ipChecksum(txPacket, true); + txIPChecksums++; } } @@ -1813,6 +1886,9 @@ NSGigE::txKick() txDmaLen = sizeof(txDescCache.cmdsts) + sizeof(txDescCache.extsts); txDmaFree = dmaDescFree; + descDmaWrites++; + descDmaWrBytes += txDmaLen; + if (doTxDmaWrite()) goto exit; diff --git a/dev/ns_gige.hh b/dev/ns_gige.hh index 191c867ce..a8d8d1f18 100644 --- a/dev/ns_gige.hh +++ b/dev/ns_gige.hh @@ -366,6 +366,14 @@ class NSGigE : public PciDev Stats::Scalar<> rxBytes; Stats::Scalar<> txPackets; Stats::Scalar<> rxPackets; + Stats::Scalar<> txIPChecksums; + Stats::Scalar<> rxIPChecksums; + Stats::Scalar<> txTCPChecksums; + Stats::Scalar<> rxTCPChecksums; + Stats::Scalar<> descDmaReads; + Stats::Scalar<> descDmaWrites; + Stats::Scalar<> descDmaRdBytes; + Stats::Scalar<> descDmaWrBytes; Stats::Formula txBandwidth; Stats::Formula rxBandwidth; Stats::Formula txPacketRate; -- cgit v1.2.3 From 5bbd57917f25724985f50d82db272823d58b9584 Mon Sep 17 00:00:00 2001 From: Lisa Hsu Date: Mon, 5 Jul 2004 11:20:53 -0400 Subject: these changes are an undo from my last changeset. these are meant for later. --HG-- extra : convert_revision : 0126918ef293cba02aaaa61dff3c471eb4743116 --- dev/ns_gige.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dev/ns_gige.cc b/dev/ns_gige.cc index f88fc507f..c6fc5513d 100644 --- a/dev/ns_gige.cc +++ b/dev/ns_gige.cc @@ -1199,7 +1199,7 @@ NSGigE::doRxDmaRead() rxDmaState = dmaReadWaiting; else dmaInterface->doDMA(Read, rxDmaAddr, rxDmaLen, curTick, - &rxDmaReadEvent, true); + &rxDmaReadEvent); return true; } @@ -1251,7 +1251,7 @@ NSGigE::doRxDmaWrite() rxDmaState = dmaWriteWaiting; else dmaInterface->doDMA(WriteInvalidate, rxDmaAddr, rxDmaLen, curTick, - &rxDmaWriteEvent, true); + &rxDmaWriteEvent); return true; } @@ -1651,7 +1651,7 @@ NSGigE::doTxDmaRead() txDmaState = dmaReadWaiting; else dmaInterface->doDMA(Read, txDmaAddr, txDmaLen, curTick, - &txDmaReadEvent, true); + &txDmaReadEvent); return true; } @@ -1703,7 +1703,7 @@ NSGigE::doTxDmaWrite() txDmaState = dmaWriteWaiting; else dmaInterface->doDMA(WriteInvalidate, txDmaAddr, txDmaLen, curTick, - &txDmaWriteEvent, true); + &txDmaWriteEvent); return true; } -- cgit v1.2.3 From 3512904c744406da909690b1690350a3289bde92 Mon Sep 17 00:00:00 2001 From: Ali Saidi Date: Mon, 5 Jul 2004 15:49:42 -0400 Subject: Added code to read any location in memory a repetative number of and average the results. It works on alpha but I haven't got it working on x86 I think for lack of knowing a good address to read. --HG-- extra : convert_revision : e2442de641741674d692245712aa92e258cf6d48 --- util/ccdrv/Makefile | 29 ++++++++++ util/ccdrv/devtime.c | 143 ++++++++++++++++++++++++++++++++++++++++++++++++++ util/ccdrv/readme.txt | 18 +++++++ 3 files changed, 190 insertions(+) create mode 100644 util/ccdrv/Makefile create mode 100644 util/ccdrv/devtime.c create mode 100644 util/ccdrv/readme.txt diff --git a/util/ccdrv/Makefile b/util/ccdrv/Makefile new file mode 100644 index 000000000..123333533 --- /dev/null +++ b/util/ccdrv/Makefile @@ -0,0 +1,29 @@ +# Copyright (c) 2004 The Regents of The University of Michigan +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer; +# redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution; +# neither the name of the copyright holders nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# Authors: Ali Saidi + +obj-m := devtime.o diff --git a/util/ccdrv/devtime.c b/util/ccdrv/devtime.c new file mode 100644 index 000000000..e637116a4 --- /dev/null +++ b/util/ccdrv/devtime.c @@ -0,0 +1,143 @@ +/* + * Copyright (c) 2004 The Regents of The University of Michigan + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer; + * redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution; + * neither the name of the copyright holders nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef __i386__ +#include +#include +#endif + +#define DRIVER_AUTHOR "Ali Saidi" +#define DRIVER_DESC "Interface to time uncacachable read and writes to device registers" +#define DRIVER_VER "0.1" + +static unsigned long devCnt, devSum, devSsq; +static char *dataAddr = NULL; +static int count = 0; + +static inline uint32_t cycleCounter(uint32_t dep); + +static int __init devtime_start(void) +{ + uint64_t addr; + uint32_t t1, t2; + uint32_t trash; + int x; + + struct net_device *dev; + + + printk("Devtime Driver Version %s Loaded...\n", DRIVER_VER); + + if ((dataAddr != 0) && (count != 0)) + { + addr = simple_strtoull(dataAddr, NULL, 0); + + devSum = 0; + devCnt = count; + + printk("Preparing to read %#llx %d times.\n", addr, count); + + t1 = cycleCounter(trash); + for (x=0; x < count; x++) + { + trash = readl(addr); + t2 = cycleCounter(trash); + devSum += t2 - t1; + t1 = t2; + } + + printk("Read Address %#llx %ld times. Average latency %ld.\n", addr, devCnt, devSum/devCnt); + } else { + dev = dev_get_by_name("eth0"); + if (dev) + { + printk("Eth0: MemStart: %#lx MemEnd: %#lx I/O Addr: %#lx\n", dev->mem_start, + dev->mem_end, dev->base_addr); + dev_put(dev); + } + dev = dev_get_by_name("eth1"); + if (dev) + { + printk("Eth1: MemStart: %#lx MemEnd: %#lx I/O Addr: %#lx\n", dev->mem_start, + dev->mem_end, dev->base_addr); + dev_put(dev); + } + + + printk("Required information not supplied.\n"); + } + + return 0; +} + +#ifdef __i386__ + +static inline uint32_t cycleCounter(uint32_t dep) +{ + uint32_t time; + cpuid_eax(0); + rdtscl(time); + cpuid_eax(0); + return time; +} + +#elif __alpha__ + +inline uint32_t cycleCounter(uint32_t dep) +{ + uint32_t res; + asm volatile ("rpcc %0, %1" : "=r"(res) : "r" (dep) : "memory"); + return res; +} +#else +#error Architecture NOT SUPPORTE +#endif + +static void __exit devtime_end(void) { + printk("Devtime Driver Version %s Unloaded...\n", DRIVER_VER); +} + + +module_init(devtime_start); +module_exit(devtime_end); + +MODULE_LICENSE("BSD"); +MODULE_AUTHOR(DRIVER_AUTHOR); +MODULE_DESCRIPTION(DRIVER_DESC); +module_param(dataAddr, charp, 0); +module_param(count, int, 0); diff --git a/util/ccdrv/readme.txt b/util/ccdrv/readme.txt new file mode 100644 index 000000000..4b9892f69 --- /dev/null +++ b/util/ccdrv/readme.txt @@ -0,0 +1,18 @@ +This driver will read the address you point it to [count] times and +print the results to the systemlog. + +To build the driver (Linux 2.6.X only) execute: +make -C /path/to/linux-2.6.X/ SUBDIRS=$PWD modules + + +Insmodding the kernel module without options will print +the device addresses of eth0 and eth1 if they exist. + +Insmodding the kernel module with the options: +dataAddr=0xXXXXXXXXX and count=XXXXX + +will read a long at addr dataAddr count times and return. + +Between runs you need to rmmod the module from the kernel. + + -- cgit v1.2.3 From fe3a86e2efff07f858cda6d9ebd0e6ed853429eb Mon Sep 17 00:00:00 2001 From: Ali Saidi Date: Mon, 5 Jul 2004 16:49:56 -0400 Subject: updated to work on all platforms (actually map sure that the physical address we are trying to access is mapped before accessing it.) --HG-- extra : convert_revision : 104341334a3d2bb812a6b0b6277ab353f8f9b39e --- util/ccdrv/devtime.c | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/util/ccdrv/devtime.c b/util/ccdrv/devtime.c index e637116a4..5c17bf5ef 100644 --- a/util/ccdrv/devtime.c +++ b/util/ccdrv/devtime.c @@ -34,6 +34,7 @@ #include #include #include +#include #include #ifdef __i386__ @@ -70,18 +71,34 @@ static int __init devtime_start(void) devSum = 0; devCnt = count; - printk("Preparing to read %#llx %d times.\n", addr, count); - - t1 = cycleCounter(trash); - for (x=0; x < count; x++) + addr = ioremap(addr, PAGE_SIZE); + /** + * Make sure that the remapping actually worked. On alpha we have + * linear addressing, so its not a problem. But it can fail in x86 + * if physical memory is mapped to this address. + */ + if (addr) { - trash = readl(addr); - t2 = cycleCounter(trash); - devSum += t2 - t1; - t1 = t2; + printk("Preparing to read %#llx %d times.\n", addr, count); + + t1 = cycleCounter(trash); + for (x=0; x < count; x++) + { + trash = readl(addr); + t2 = cycleCounter(trash); + devSum += t2 - t1; + t1 = t2; + } + + /** + * Unmap the address. + */ + iounmap(addr); + + printk("Read Address %#llx %ld times. Average latency %ld.\n", addr, devCnt, devSum/devCnt); } - - printk("Read Address %#llx %ld times. Average latency %ld.\n", addr, devCnt, devSum/devCnt); + else + printk("Unable to remap address. Please try again later.\n"); } else { dev = dev_get_by_name("eth0"); if (dev) @@ -90,6 +107,7 @@ static int __init devtime_start(void) dev->mem_end, dev->base_addr); dev_put(dev); } + dev = 0; dev = dev_get_by_name("eth1"); if (dev) { -- cgit v1.2.3 From 4869ba881ebfbc9305b6c7a6a9e8a566de0a93e4 Mon Sep 17 00:00:00 2001 From: Erik Hallnor Date: Tue, 6 Jul 2004 11:29:23 -0400 Subject: Remove duplicate stat cpu/trace/reader/m5_reader.cc: Wrap assert variable in NDEBUG --HG-- extra : convert_revision : 8c79dc30eff2f2fa0110a04c30df17ec4417c28c --- cpu/trace/reader/m5_reader.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cpu/trace/reader/m5_reader.cc b/cpu/trace/reader/m5_reader.cc index a1ada38a2..d081f0bc0 100644 --- a/cpu/trace/reader/m5_reader.cc +++ b/cpu/trace/reader/m5_reader.cc @@ -54,10 +54,12 @@ M5Reader::getNextReq(MemReqPtr &req) traceFile.read((char*) &ref, sizeof(ref)); if (!traceFile.eof()) { //traceFile.read((char*) &ref, sizeof(ref)); +#ifndef NDEBUG int gcount = traceFile.gcount(); assert(gcount != 0 || traceFile.eof()); assert(gcount == sizeof(ref)); assert(ref.cmd < 12); +#endif tmp_req = new MemReq(); tmp_req->paddr = ref.paddr; tmp_req->asid = ref.asid; -- cgit v1.2.3