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()
2316 bool tsc, pip, vmcs, tma, psbend; member
2339 data->tsc = true; in intel_pt_vm_psb_lookahead_cb()
2419 /* Lookahead and get the TMA packet after TSC */
2454 * expect last_mtc_ctc to be before ctc, but the TSC packet can slip in intel_pt_calc_expected_tsc()
2463 * Convert CTC ticks to TSC ticks, add the starting point in intel_pt_calc_expected_tsc()
2500 /* VMX adds the TSC Offset, so subtract to get host TSC */ in intel_pt_translate_vm_tsc()
2502 /* TSC packet has only 7 bytes */ in intel_pt_translate_vm_tsc()
2512 intel_pt_log("Translated VM TSC %#" PRIx64 " -> %#" PRIx64 in intel_pt_translate_vm_tsc()
2513 " VMCS %#" PRIx64 " TSC Offset %#" PRIx64 "\n", in intel_pt_translate_vm_tsc()
2541 p_log("VMCS: %#" PRIx64 " TSC Offset %#" PRIx64, in intel_pt_print_vmcs_info()
2552 if (data->tsc && !data->psbend) in intel_pt_vm_tm_corr_psb()
2564 p_log("ERROR: First TSC is not in PSB+"); in intel_pt_vm_tm_corr_first_tsc()
2573 p_log("ERROR: First TSC, unknown TSC Offset"); in intel_pt_vm_tm_corr_first_tsc()
2587 p_log("ERROR: First TSC, no PIP, unknown TSC Offset"); in intel_pt_vm_tm_corr_first_tsc()
2621 p_log("ERROR: TSC without TMA"); in intel_pt_vm_tm_corr_tsc()
2643 /* Determine if TSC is from Host or Guest */ in intel_pt_vm_tm_corr_tsc()
2662 return; /* Zero TSC Offset, assume Host */ in intel_pt_vm_tm_corr_tsc()
2664 * TSC packet has only 7 bytes of TSC. We have no in intel_pt_vm_tm_corr_tsc()
2673 /* Same TSC Offset as last VMCS, assume Guest */ in intel_pt_vm_tm_corr_tsc()
2680 * the next host TSC in the same buffer, but we don't bother to in intel_pt_vm_tm_corr_tsc()
2684 /* Within expected range for Host TSC, assume Host */ in intel_pt_vm_tm_corr_tsc()
2692 /* Determine whether to assign TSC Offset */ in intel_pt_vm_tm_corr_tsc()
2698 /* Continuous tracing, TSC in a PSB is not a time loss */ in intel_pt_vm_tm_corr_tsc()
2703 * Unlikely to be a time loss TSC in a PSB which is not in intel_pt_vm_tm_corr_tsc()
2711 /* Record VMCS TSC Offset */ in intel_pt_vm_tm_corr_tsc()
2722 /* Determine what TSC Offset to use */ in intel_pt_vm_tm_corr_tsc()
2731 p_log("ERROR: Unknown TSC Offset for VMCS %#" PRIx64, in intel_pt_vm_tm_corr_tsc()
2769 /* Within expected range for Host TSC, assume Host */ in intel_pt_vm_tm_corr_pebs_tsc()
2775 /* Translate Guest TSC to Host TSC */ in intel_pt_vm_tm_corr_pebs_tsc()
2778 intel_pt_log("Translated VM TSC %#" PRIx64 " -> %#" PRIx64 in intel_pt_vm_tm_corr_pebs_tsc()
2779 " VMCS %#" PRIx64 " TSC Offset %#" PRIx64 "\n", in intel_pt_vm_tm_corr_pebs_tsc()
4051 * When using only TSC/MTC to compute cycles, IPC can be in intel_pt_decode()
4058 /* Let PSB event always have TSC timestamp */ in intel_pt_decode()
4158 * intel_pt_next_tsc - find and return next TSC.
4161 * @tsc: TSC value returned
4162 * @rem: returns remaining size when TSC is found
4164 * Find a TSC packet in @buf and return the TSC value. This function assumes
4165 * that @buf starts at a PSB and that PSB+ will contain TSC and so stops if a
4168 * Return: %true if TSC is found, false otherwise.
4170 static bool intel_pt_next_tsc(unsigned char *buf, size_t len, uint64_t *tsc, in intel_pt_next_tsc() argument
4182 *tsc = packet.payload; in intel_pt_next_tsc()
4196 * @tsc1: first TSC to compare
4197 * @tsc2: second TSC to compare
4199 * This function compares 7-byte TSC values allowing for the possibility that
4200 * TSC wrapped around. Generally it is not possible to know if TSC has wrapped
4257 * using TSC.
4264 * @ooo_tsc: out-of-order TSC due to VM TSC offset / scaling
4266 * If the trace contains TSC we can look at the last TSC of @buf_a and the
4267 * first TSC of @buf_b in order to determine if the buffers overlap, and then
4268 * walk forward in @buf_b until a later TSC is found. A precondition is that
4297 return buf_b; /* No TSC in buf_a => assume no overlap */ in intel_pt_find_overlap_tsc()
4301 /* Ignore PSB+ with no TSC */ in intel_pt_find_overlap_tsc()
4305 /* Same TSC, so buffers are consecutive */ in intel_pt_find_overlap_tsc()
4328 * @have_tsc: can use TSC packets to detect overlap
4331 * @ooo_tsc: out-of-order TSC due to VM TSC offset / scaling
4410 uint64_t tsc; in intel_pt_ff_cb() local
4418 !intel_pt_next_tsc(buf, len, &tsc, &rem)) in intel_pt_ff_cb()
4421 tsc = intel_pt_8b_tsc(tsc, buffer->ref_timestamp); in intel_pt_ff_cb()
4424 tsc, buffer->ref_timestamp); in intel_pt_ff_cb()
4430 if (tsc < d->timestamp) in intel_pt_ff_cb()
4487 uint64_t tsc; in intel_pt_fast_forward() local
4490 if (!intel_pt_next_tsc(buf, len, &tsc, &rem)) in intel_pt_fast_forward()
4492 tsc = intel_pt_8b_tsc(tsc, decoder->buf_timestamp); in intel_pt_fast_forward()
4494 * A TSC packet can slip past MTC packets but, after fast in intel_pt_fast_forward()
4495 * forward, decoding starts at the TSC timestamp. That means in intel_pt_fast_forward()
4499 if (tsc < timestamp) { in intel_pt_fast_forward()
4500 intel_pt_log("Fast forward to next PSB timestamp " x64_fmt "\n", tsc); in intel_pt_fast_forward()