Real Time Instruction Trace
December 2015
Real Time Instruction Trace
Programming Reference v1.05
47
packet ‘wraps’ its 8-bit TSC value), then the RTIT analyzer may be unable to properly understand the
trace. If this is suspected, MTC_range should be increased.
The buffer overflow condition will not be cleared until:
a) The RTIT buffer has completely drained to the memory unit and is empty.
b) An instruction is starting while TriggerEn==1 and ContextEn==1 at the beginning of
the instruction.
When the buffer overflow condition is cleared by the above conditions, the buffer overflow has
‘naturally’ cleared (to differentiate from being cleared by an MSR write). When the buffer overflow is
naturally cleared, the Buffer_Overflow bit of RTIT_STATUS is cleared, a FUP.BuffOvf (flow update
packet of type buffer overflow - event field is 010b) is generated, and the valid bits of the
RTIT_LAST_LIP and RTIT_LAST_CALL_NLIP MSRs are cleared. They are cleared before the overflow
packet is sent, so the FUP.BuffOvf will never contain a last LIP compressed address.
The address contained in the FUP.BuffOvf will be the start of the next instruction after the currently
executing instruction (the NLIP of the current instruction). Thus, on clearing of a buffer overflow, the
analyzer will know exactly where the CPU is now executing, but will not know the exact instruction
where the buffer overflow occurred.
If there are taken/not taken indications in RTIT_TNT_BUFF, then they will be sent out before the
FUP.BuffOvf is sent. They will represent taken/not taken branches before the buffer overflow occurred,
and thus can help the analyzer understand what code was executing when the buffer overflow
occurred. This will also occur if the RTIT_TNT_BUFF was completely full with 6 branches and it was the
TNT packet itself that attempted to cause the overflow. In that case, the full TNT packet will not be
dropped and will still be seen in the trace before the buffer overflow packet.
Full TNT packets include cycle count packets; but that in this case, the TNT packet cycle count will be
the time when the buffer overflow was drained and not when the 6
th
branch occurred that filled up the
TNT buffer. When the trace analyzer sees a full TNT packet followed by a buffer overflow and the
buffer overflow packet has a cycle count of 0 that means this situation has occurred. In this case, the
trace analyzer should not treat the cycle count at the end of the full TNT packet as the time when the
6
th
jump retired; instead, it is the time when the buffer overflow packet was sent.
If a TraceStop action occurred during the buffer overflow (which means that the IP matched that
specified in RANGE0 or RANGE1 and that range was programmed to cause a TraceStop by
TraceStop_Event_ID), then that TraceStop action will be held pending during the buffer overflow and
will not be dropped. Once the buffer overflow packet has been sent, the TraceStop action will occur—
which includes clearing out RTIT_CTL[Trace_Active], sending out the TraceStop packet, and possibly
draining RTIT buffers again. This means that the buffer overflow packet may contain an address
reached after the filtering logic pended the TraceStop action. It also means that the cycle counter will
continue running after the filtering logic pended the TraceStop action.
The FUP.BuffOvf can cause a PSB packet to be generated due to its incrementing of Pkt_Cnt.
If TriggerEn becomes 0 and then goes back to 1 (due to an MSR write) during a buffer overflow, a PSB
packet will be generated. It is possible for this PSB packet to be seen in the trace before the buffer
overflow packet, even though the re-setting of TriggerEn occurs after the buffer overflow started.
Additionally, if a TraceStop packet was pending when TriggerEn became 0, the PSB packet may come
out before the TraceStop packet.
Although the packet ordering does not match the order in which the actions occurred, this is not
expected to be a real problem for the RTIT analyzer, since the purpose of the PSB packet is still met
(which is to ensure that the header bytes can be found in the trace).