Lines Matching full:tsc
362 * A TSC packet can slip past MTC packets so that the timestamp appears in intel_pt_decoder_new()
364 * cycles, which is certainly less than 0x1000 TSC ticks, but accept in intel_pt_decoder_new()
879 * For now, do not support using TSC packets - refer in intel_pt_calc_cyc_cb()
965 …intel_pt_log("Timestamp: calculated %g TSC ticks per cycle too big (c.f. CBR-based value %g), pos … in intel_pt_calc_cyc_cb()
974 …intel_pt_log("Timestamp: calculated %g TSC ticks per cycle c.f. CBR-based value %g, pos " x64_fmt … in intel_pt_calc_cyc_cb()
977 …intel_pt_log("Timestamp: calculated %g TSC ticks per cycle c.f. unknown CBR-based value, pos " x64… in intel_pt_calc_cyc_cb()
1002 * For now, do not support using TSC packets for at least the reasons: in intel_pt_calc_cyc_to_tsc()
1004 * 2) TSC packets within PSB+ can slip against CYC packets in intel_pt_calc_cyc_to_tsc()
2320 bool tsc, pip, vmcs, tma, psbend; member
2343 data->tsc = true; in intel_pt_vm_psb_lookahead_cb()
2423 /* Lookahead and get the TMA packet after TSC */
2458 * expect last_mtc_ctc to be before ctc, but the TSC packet can slip in intel_pt_calc_expected_tsc()
2467 * Convert CTC ticks to TSC ticks, add the starting point in intel_pt_calc_expected_tsc()
2504 /* VMX adds the TSC Offset, so subtract to get host TSC */ in intel_pt_translate_vm_tsc()
2506 /* TSC packet has only 7 bytes */ in intel_pt_translate_vm_tsc()
2516 intel_pt_log("Translated VM TSC %#" PRIx64 " -> %#" PRIx64 in intel_pt_translate_vm_tsc()
2517 " VMCS %#" PRIx64 " TSC Offset %#" PRIx64 "\n", in intel_pt_translate_vm_tsc()
2545 p_log("VMCS: %#" PRIx64 " TSC Offset %#" PRIx64, in intel_pt_print_vmcs_info()
2556 if (data->tsc && !data->psbend) in intel_pt_vm_tm_corr_psb()
2568 p_log("ERROR: First TSC is not in PSB+"); in intel_pt_vm_tm_corr_first_tsc()
2577 p_log("ERROR: First TSC, unknown TSC Offset"); in intel_pt_vm_tm_corr_first_tsc()
2591 p_log("ERROR: First TSC, no PIP, unknown TSC Offset"); in intel_pt_vm_tm_corr_first_tsc()
2625 p_log("ERROR: TSC without TMA"); in intel_pt_vm_tm_corr_tsc()
2647 /* Determine if TSC is from Host or Guest */ in intel_pt_vm_tm_corr_tsc()
2666 return; /* Zero TSC Offset, assume Host */ in intel_pt_vm_tm_corr_tsc()
2668 * TSC packet has only 7 bytes of TSC. We have no in intel_pt_vm_tm_corr_tsc()
2677 /* Same TSC Offset as last VMCS, assume Guest */ in intel_pt_vm_tm_corr_tsc()
2684 * the next host TSC in the same buffer, but we don't bother to in intel_pt_vm_tm_corr_tsc()
2688 /* Within expected range for Host TSC, assume Host */ in intel_pt_vm_tm_corr_tsc()
2696 /* Determine whether to assign TSC Offset */ in intel_pt_vm_tm_corr_tsc()
2702 /* Continuous tracing, TSC in a PSB is not a time loss */ in intel_pt_vm_tm_corr_tsc()
2707 * Unlikely to be a time loss TSC in a PSB which is not in intel_pt_vm_tm_corr_tsc()
2715 /* Record VMCS TSC Offset */ in intel_pt_vm_tm_corr_tsc()
2726 /* Determine what TSC Offset to use */ in intel_pt_vm_tm_corr_tsc()
2735 p_log("ERROR: Unknown TSC Offset for VMCS %#" PRIx64, in intel_pt_vm_tm_corr_tsc()
2773 /* Within expected range for Host TSC, assume Host */ in intel_pt_vm_tm_corr_pebs_tsc()
2779 /* Translate Guest TSC to Host TSC */ in intel_pt_vm_tm_corr_pebs_tsc()
2782 intel_pt_log("Translated VM TSC %#" PRIx64 " -> %#" PRIx64 in intel_pt_vm_tm_corr_pebs_tsc()
2783 " VMCS %#" PRIx64 " TSC Offset %#" PRIx64 "\n", in intel_pt_vm_tm_corr_pebs_tsc()
4055 * When using only TSC/MTC to compute cycles, IPC can be in intel_pt_decode()
4062 /* Let PSB event always have TSC timestamp */ in intel_pt_decode()
4162 * intel_pt_next_tsc - find and return next TSC.
4165 * @tsc: TSC value returned
4166 * @rem: returns remaining size when TSC is found
4168 * Find a TSC packet in @buf and return the TSC value. This function assumes
4169 * that @buf starts at a PSB and that PSB+ will contain TSC and so stops if a
4172 * Return: %true if TSC is found, false otherwise.
4174 static bool intel_pt_next_tsc(unsigned char *buf, size_t len, uint64_t *tsc, in intel_pt_next_tsc() argument
4186 *tsc = packet.payload; in intel_pt_next_tsc()
4200 * @tsc1: first TSC to compare
4201 * @tsc2: second TSC to compare
4203 * This function compares 7-byte TSC values allowing for the possibility that
4204 * TSC wrapped around. Generally it is not possible to know if TSC has wrapped
4261 * using TSC.
4268 * @ooo_tsc: out-of-order TSC due to VM TSC offset / scaling
4270 * If the trace contains TSC we can look at the last TSC of @buf_a and the
4271 * first TSC of @buf_b in order to determine if the buffers overlap, and then
4272 * walk forward in @buf_b until a later TSC is found. A precondition is that
4301 return buf_b; /* No TSC in buf_a => assume no overlap */ in intel_pt_find_overlap_tsc()
4305 /* Ignore PSB+ with no TSC */ in intel_pt_find_overlap_tsc()
4309 /* Same TSC, so buffers are consecutive */ in intel_pt_find_overlap_tsc()
4332 * @have_tsc: can use TSC packets to detect overlap
4335 * @ooo_tsc: out-of-order TSC due to VM TSC offset / scaling
4414 uint64_t tsc; in intel_pt_ff_cb() local
4422 !intel_pt_next_tsc(buf, len, &tsc, &rem)) in intel_pt_ff_cb()
4425 tsc = intel_pt_8b_tsc(tsc, buffer->ref_timestamp); in intel_pt_ff_cb()
4428 tsc, buffer->ref_timestamp); in intel_pt_ff_cb()
4434 if (tsc < d->timestamp) in intel_pt_ff_cb()
4491 uint64_t tsc; in intel_pt_fast_forward() local
4494 if (!intel_pt_next_tsc(buf, len, &tsc, &rem)) in intel_pt_fast_forward()
4496 tsc = intel_pt_8b_tsc(tsc, decoder->buf_timestamp); in intel_pt_fast_forward()
4498 * A TSC packet can slip past MTC packets but, after fast in intel_pt_fast_forward()
4499 * forward, decoding starts at the TSC timestamp. That means in intel_pt_fast_forward()
4503 if (tsc < timestamp) { in intel_pt_fast_forward()
4504 intel_pt_log("Fast forward to next PSB timestamp " x64_fmt "\n", tsc); in intel_pt_fast_forward()