Received: by 10.213.65.68 with SMTP id h4csp2116349imn; Sun, 8 Apr 2018 20:07:11 -0700 (PDT) X-Google-Smtp-Source: AIpwx4++c+D7zuz6y+cx30/DZOhz3AiaZGbCdBM2COhQxmzFOv85Sy9jckbHjt00BvN6E5HfAoyp X-Received: by 2002:a17:902:6009:: with SMTP id r9-v6mr5965067plj.70.1523243231920; Sun, 08 Apr 2018 20:07:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523243231; cv=none; d=google.com; s=arc-20160816; b=z1P97NDut9sgr5jTuC7tq6zdo7thboNrWJYDfyxBw5ntNhpOEt6V13B3Epznqhc/P3 eDN0LAgPHWoya3Vz32yBWdY0l1LXzz2hwZZJSrvcmOWq1xvXrdAYpYCm1Ks06P1Licd/ LIHBm7qVDWiPHxAcab0mxtrlHGDD3pp/eWnBxtSoZ3oCJcgymaocqmqATDBFfNOlGYtT dhEEXURM1u/zgPGhuSERYKrgkkDzWT1hXz70fox3znBtvzNu4VwOzb1zV1ur3xtY6HkW aUIHFDNUX1r1Vsy7wZC6xcS2wl7GbOhrjwmcOU4phNEvSyy5+BdZChiKaxV9LeD3qG/v ZzdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=Jxtnj9YhDHgMsiJRXhEhxv7SKsRuSYjGLlg6qfudq5U=; b=vdVVB1KCqjZgKYxBmh/Gyq5hXkI9ZjLDjzD5+y7GuJDBcDxdS2L1+8prK8L8Ur+SUA D5l1DWLY3but9F/Ln7P8HvSUl81FcL2PtPRyRuiEyx4yWWpOZG23hRNZXeG2jpH2SJc9 zvmtJcaAW10BS+KN7+E79FDnaWHZLh/g+wXvq4xqxx+KS/iCfNWDo25wkR7Mhln9uq1R ZC/b6Io7IgrPkNZiQdUvlD0s6Fly/wQ8bPsHS33YovL5R9PWCAn/LLk1w/dgiZQxI8yO xKDqHAYcFz6kmlO/vOC0seWu3Y8VXmvDxrQim4H4L1Z1FWRST0oBoM9EHjtg7HRsJAYS j5Jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=kbFfZH8o; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z22-v6si13743806plo.270.2018.04.08.20.06.35; Sun, 08 Apr 2018 20:07:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=kbFfZH8o; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757281AbeDIBTW (ORCPT + 99 others); Sun, 8 Apr 2018 21:19:22 -0400 Received: from mail-sn1nam02on0135.outbound.protection.outlook.com ([104.47.36.135]:3040 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932820AbeDIAhp (ORCPT ); Sun, 8 Apr 2018 20:37:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=Jxtnj9YhDHgMsiJRXhEhxv7SKsRuSYjGLlg6qfudq5U=; b=kbFfZH8oNJDmhQ27q3zRjDmpdGtBlbtEEtza2FHY2m7HF9Skz/RYqVzSXKIf+zqIqFywUlFeGVKbkVDZ+TjGb3LLhxJVQV8YeNkVkUTnXKUhoLJkRampz1tM1uihl9DtytIEj51Ui8mHdJL+wspvvJ9+UoPwwQO4kaarq3qInwY= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB1031.namprd21.prod.outlook.com (52.132.128.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.696.0; Mon, 9 Apr 2018 00:37:41 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059%2]) with mapi id 15.20.0696.003; Mon, 9 Apr 2018 00:37:41 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Adrian Hunter , Andi Kleen , Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH AUTOSEL for 4.4 096/162] perf intel-pt: Do not use TSC packets for calculating CPU cycles to TSC Thread-Topic: [PATCH AUTOSEL for 4.4 096/162] perf intel-pt: Do not use TSC packets for calculating CPU cycles to TSC Thread-Index: AQHTz5m+oALNFDerpUatPCekgmdJIA== Date: Mon, 9 Apr 2018 00:28:55 +0000 Message-ID: <20180409002738.163941-96-alexander.levin@microsoft.com> References: <20180409002738.163941-1-alexander.levin@microsoft.com> In-Reply-To: <20180409002738.163941-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM5PR2101MB1031;7:vJWr2TkcA+G6A67ZD7xq/ALLbLLneVQphNY+pjzuENwuwezE+aPC58r9NoWomHKJJVp3BFz47yxPtFu/t3JkusexyuqJu6FLwuSoyRi9Lah2Uhuz/gkpwjz1utw3LtcZJoRt5cxW7nvNDJUhoP5vFe8frkQPUulvxOe6vViu26BCDTsVP7YuGB/ZYVMOZw1Zg1ks7aBOC+x56YO/70u/DtgzrRmjFeZtNteO8aLr12YLBhvMRrtM1MWoJl/mFcb7;20:US3IXXd/udv7yOyev6iJoIlH2ySuxmVAo0ElGaQqaOkTzhcJN0tn0Mr3R0gwnqsIl2377JwQjXLpzHI38S8fkrIG2abnty67K9VHN7Wcso9E6bxDmzLPHbb3ziEUURO7zLhhTLLW70mE3ljm8x5LdNMVX9VQ3ruOy0W/6kbx1Io= x-ms-office365-filtering-ht: Tenant X-MS-Office365-Filtering-Correlation-Id: 66b66669-d090-436c-f9b7-08d59db21a98 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB1031; x-ms-traffictypediagnostic: DM5PR2101MB1031: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(42068640409301)(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(3231221)(944501327)(52105095)(3002001)(10201501046)(6055026)(61426038)(61427038)(6041310)(20161123558120)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(6072148)(201708071742011);SRVR:DM5PR2101MB1031;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB1031; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(396003)(376002)(366004)(39380400002)(346002)(39860400002)(189003)(199004)(2900100001)(10290500003)(99286004)(76176011)(14454004)(966005)(7736002)(11346002)(26005)(6666003)(86612001)(72206003)(478600001)(36756003)(106356001)(66066001)(2616005)(186003)(575784001)(22452003)(86362001)(68736007)(305945005)(54906003)(102836004)(486006)(110136005)(316002)(6506007)(446003)(107886003)(53936002)(4326008)(105586002)(6306002)(6436002)(6486002)(476003)(6512007)(5660300001)(5250100002)(25786009)(3846002)(6116002)(1076002)(97736004)(3280700002)(2501003)(2906002)(81156014)(8676002)(10090500001)(81166006)(8936002)(3660700001)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB1031;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: 4mr8Zxh2LfiPxUXQ5HwQC2xclNvd1XyCjLtRzYfCvgnHj/XEVTh16tm4BQ0awMsVggDLYGVFGSBJl2fQtd+oHvBChMMm73wE9Ojv/zCZrO3ZIEyOSzQVsFBy4Na/QbXRzCfEeUe5wtHu9KSkP2cqHBq3ghOajumHHZY/n12aQiswMRBdfgL3VBNrQ8V9ihy3gg4CIaBC9yJ3b4M2WiSuSmU1v6JxQgqTRBax4TB1ZHoFIjbViN8tfSo0baptUfpnJGoN49bMF0EOA3aLxLfA/Ns7IhlXiiv+3+IbUZPRMWBgVYuTOrKMgGfn+jDHTT+lt+nIQvRpwmrPyoYcaUkSfBMYueW7lzJrYQ5etyOM58aLJNpe0EhsdoyHL3z5HNxLMqFkLPHkOFE3GdwqCzpJTJz3dOVhcu3KwkJId9AXHQ4= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 66b66669-d090-436c-f9b7-08d59db21a98 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:28:55.0366 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1031 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Adrian Hunter [ Upstream commit 38b65b0891dc129dc0a5ce148a21c481e667b395 ] CBR (core-to-bus ratio) packets provide an indication of CPU frequency. A more accurate measure can be made by counting the cycles (given by CYC packets) in between other timing packets (either MTC or TSC). Using TSC packets has at least 2 issues: 1) timing might have stopped (e.g. mwait) or 2) TSC packets within PSB+ might slip past CYC packets. For now, simply do not use TSC packets for calculating CPU cycles to TSC. That leaves the case where 2 MTC packets are used, otherwise falling back to the CBR value. Signed-off-by: Adrian Hunter Cc: Andi Kleen Link: http://lkml.kernel.org/r/1495786658-18063-37-git-send-email-adrian.hu= nter@intel.com Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin --- tools/perf/util/intel-pt-decoder/intel-pt-decoder.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c b/tools/pe= rf/util/intel-pt-decoder/intel-pt-decoder.c index eeeae0629ad3..fbfe97dcdaf0 100644 --- a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c +++ b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c @@ -696,6 +696,12 @@ static int intel_pt_calc_cyc_cb(struct intel_pt_pkt_in= fo *pkt_info) break; =20 case INTEL_PT_TSC: + /* + * For now, do not support using TSC packets - refer + * intel_pt_calc_cyc_to_tsc(). + */ + if (data->from_mtc) + return 1; timestamp =3D pkt_info->packet.payload | (data->timestamp & (0xffULL << 56)); if (data->from_mtc && timestamp < data->timestamp && @@ -808,6 +814,14 @@ static void intel_pt_calc_cyc_to_tsc(struct intel_pt_d= ecoder *decoder, .cbr_cyc_to_tsc =3D 0, }; =20 + /* + * For now, do not support using TSC packets for at least the reasons: + * 1) timing might have stopped + * 2) TSC packets within PSB+ can slip against CYC packets + */ + if (!from_mtc) + return; + intel_pt_pkt_lookahead(decoder, intel_pt_calc_cyc_cb, &data); } =20 --=20 2.15.1