From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 60FBECCA47F for ; Wed, 20 Jul 2022 01:18:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241370AbiGTBSz (ORCPT ); Tue, 19 Jul 2022 21:18:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241078AbiGTBSh (ORCPT ); Tue, 19 Jul 2022 21:18:37 -0400 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46E826C115 for ; Tue, 19 Jul 2022 18:14:54 -0700 (PDT) Received: by mail-wm1-x32c.google.com with SMTP id be14-20020a05600c1e8e00b003a04a458c54so344982wmb.3 for ; Tue, 19 Jul 2022 18:14:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=YtETk/RtD2vfpKLPOYkK3onAIfmX1vMQdXew1DBAtWE=; b=VjHJMI94hF15HeECAjWZcPQbMufkMPjqLIIExiPZ5qpah+cB3gf29WmBjTPZ/CavYw urwYjQepGXpKdyesjkgxQSDuqk1ZgWyBxBOX+aPSQy+RvlWtOzBb+TY0wa5PE8WRVhbq /NpvkwUGddPCn5BOong0Rby+i06xSMVIaf3Ej+eVZkZ+Vo3mwK64E6pBXbL8PmYq4Zk3 Jl/l1KWAL2RH+Gjn8t3xn7Yx2TojfuB9egRAemN79qmmOqeMDrOpGILcKE0Qc93/GwTb NbSCvKmhqUgWoxM1iuUC4TCt6DjW5g04lb+vKSrDCmdZhW/d9MhqTF85O+3HKl5aI5ZG xtFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=YtETk/RtD2vfpKLPOYkK3onAIfmX1vMQdXew1DBAtWE=; b=Opf6b2YD2RM+jYgp4DqFAUbDLRVBxKXIqZQ2oKu2MaXBf1swTGnI9qDmJNcN8C27C7 IN5yzxuM2AMQlSM3mH9yZBL/A40+qD3aCbAfGkizp2K6+cueRa9woNR4M4R6dZAEwave CGcMmfDwtXE9cuhf+1gqOTJj54GXq07oEXOjN1FgxZQkkvxbWs3yr12vQEdKlaP1Mc82 VYCfH2H6cN7z6gr3YFl8ajislpNSE//pVQQpEaeKIPW/g8yQ46FTnJW2dVrldVL9+Tuu s7dkwjq3DIfw5skgy1JE1ugN6YQfW5/HmHVrP0Sc0sX5tOVuBu3j65LfBkRUuRpSGXn3 AB/g== X-Gm-Message-State: AJIora/pokn1O8A2MBUEeJWZNxqF/Nx7Jt6dBN+r+4VA5XQ+35UsaXhJ 56qkP0vJxKZoHxkch+uBEISlLNqvpBNYUuvRahI/PA== X-Google-Smtp-Source: AGRyM1sSipGrC2xG2iqHNRsY+NyReM9AdVDMAmwIm7gnydC6CBKRlCCn5BoAB5dIx7zaUZ5nLyDMnnJBxqYhUViNO2c= X-Received: by 2002:a05:600c:2854:b0:3a3:1551:d7d with SMTP id r20-20020a05600c285400b003a315510d7dmr1437492wmb.174.1658279692551; Tue, 19 Jul 2022 18:14:52 -0700 (PDT) MIME-Version: 1.0 References: <20220711093218.10967-1-adrian.hunter@intel.com> <20220711093218.10967-32-adrian.hunter@intel.com> In-Reply-To: <20220711093218.10967-32-adrian.hunter@intel.com> From: Ian Rogers Date: Tue, 19 Jul 2022 18:14:40 -0700 Message-ID: Subject: Re: [PATCH 31/35] perf intel-pt: Disable sync switch with guest sideband To: Adrian Hunter Cc: Arnaldo Carvalho de Melo , Jiri Olsa , Namhyung Kim , Andi Kleen , linux-kernel@vger.kernel.org, kvm@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 11, 2022 at 2:33 AM Adrian Hunter 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 Acked-by: Ian Rogers 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 >