[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAP-5=fW0kHPpz5-krEoeRk7QBE7HyerfX-5MrAkukudSTSY52Q@mail.gmail.com>
Date: Tue, 19 Jul 2022 18:14:40 -0700
From: Ian Rogers <irogers@...gle.com>
To: Adrian Hunter <adrian.hunter@...el.com>
Cc: Arnaldo Carvalho de Melo <acme@...nel.org>,
Jiri Olsa <jolsa@...hat.com>,
Namhyung Kim <namhyung@...nel.org>,
Andi Kleen <ak@...ux.intel.com>, linux-kernel@...r.kernel.org,
kvm@...r.kernel.org
Subject: Re: [PATCH 31/35] perf intel-pt: Disable sync switch with guest sideband
On Mon, Jul 11, 2022 at 2:33 AM Adrian Hunter <adrian.hunter@...el.com> wrote:
>
> The sync_switch facility attempts to better synchronize context switches
> with the Intel PT trace, however it is not designed for guest machine
> context switches, so disable it when guest sideband is detected.
>
> Signed-off-by: Adrian Hunter <adrian.hunter@...el.com>
Acked-by: Ian Rogers <irogers@...gle.com>
Thanks,
Ian
> ---
> tools/perf/util/intel-pt.c | 29 +++++++++++++++++++++++++++++
> 1 file changed, 29 insertions(+)
>
> diff --git a/tools/perf/util/intel-pt.c b/tools/perf/util/intel-pt.c
> index 98b097fec476..dc2af64f9e31 100644
> --- a/tools/perf/util/intel-pt.c
> +++ b/tools/perf/util/intel-pt.c
> @@ -74,6 +74,7 @@ struct intel_pt {
> bool data_queued;
> bool est_tsc;
> bool sync_switch;
> + bool sync_switch_not_supported;
> bool mispred_all;
> bool use_thread_stack;
> bool callstack;
> @@ -2638,6 +2639,9 @@ static void intel_pt_enable_sync_switch(struct intel_pt *pt)
> {
> unsigned int i;
>
> + if (pt->sync_switch_not_supported)
> + return;
> +
> pt->sync_switch = true;
>
> for (i = 0; i < pt->queues.nr_queues; i++) {
> @@ -2649,6 +2653,23 @@ static void intel_pt_enable_sync_switch(struct intel_pt *pt)
> }
> }
>
> +static void intel_pt_disable_sync_switch(struct intel_pt *pt)
> +{
> + unsigned int i;
> +
> + pt->sync_switch = false;
> +
> + for (i = 0; i < pt->queues.nr_queues; i++) {
> + struct auxtrace_queue *queue = &pt->queues.queue_array[i];
> + struct intel_pt_queue *ptq = queue->priv;
> +
> + if (ptq) {
> + ptq->sync_switch = false;
> + intel_pt_next_tid(pt, ptq);
> + }
> + }
> +}
> +
> /*
> * To filter against time ranges, it is only necessary to look at the next start
> * or end time.
> @@ -3090,6 +3111,14 @@ static int intel_pt_guest_context_switch(struct intel_pt *pt,
>
> pt->have_guest_sideband = true;
>
> + /*
> + * sync_switch cannot handle guest machines at present, so just disable
> + * it.
> + */
> + pt->sync_switch_not_supported = true;
> + if (pt->sync_switch)
> + intel_pt_disable_sync_switch(pt);
> +
> if (out)
> return 0;
>
> --
> 2.25.1
>
Powered by blists - more mailing lists