MessagePort: implement the virtual recvTiming function to avoid double pkt delete
authorJoel Hestness <hestness@cs.utexas.edu>
Mon, 7 Feb 2011 06:14:17 +0000 (22:14 -0800)
committerJoel Hestness <hestness@cs.utexas.edu>
Mon, 7 Feb 2011 06:14:17 +0000 (22:14 -0800)
Double packet delete problem is due to an interrupt device deleting a packet that the SimpleTimingPort also deletes. Since MessagePort descends from SimpleTimingPort, simply reimplement the failing code from SimpleTimingPort: recvTiming.

src/arch/x86/interrupts.cc
src/dev/x86/intdev.cc
src/dev/x86/intdev.hh

index 951392a158d43c192315c93d1e67c392a6432156..a7d9f32775d42f13fbbf8fa8f5bfc58c94e21d9d 100644 (file)
@@ -340,8 +340,6 @@ X86ISA::Interrupts::recvResponse(PacketPtr pkt)
         low.deliveryStatus = 0;
         regs[APIC_INTERRUPT_COMMAND_LOW] = low;
     }
-    delete pkt->req;
-    delete pkt;
     DPRINTF(LocalApic, "ICR is now idle.\n");
     return 0;
 }
index 5bc6065f5b66f5600d4081e1ab2c5c6812e63c02..0d392d5ee03456a33be7b7558f728d88ed97b86c 100644 (file)
@@ -37,10 +37,14 @@ X86ISA::IntDev::IntPort::sendMessage(ApicList apics,
     ApicList::iterator apicIt;
     for (apicIt = apics.begin(); apicIt != apics.end(); apicIt++) {
         PacketPtr pkt = buildIntRequest(*apicIt, message);
-        if (timing)
+        if (timing) {
             sendMessageTiming(pkt, latency);
-        else
+            // The target handles cleaning up the packet in timing mode.
+        } else {
             sendMessageAtomic(pkt);
+            delete pkt->req;
+            delete pkt;
+        }
     }
 }
 
index b01d36e37f3f9016cbf9461940f0110213761822..61e486718a4bdaeceeace0b96fdb91bf313939f5 100644 (file)
@@ -138,8 +138,6 @@ class IntDev
     virtual Tick
     recvResponse(PacketPtr pkt)
     {
-        delete pkt->req;
-        delete pkt;
         return 0;
     }