From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-eopbgr740047.outbound.protection.outlook.com [40.107.74.47]) by dpdk.org (Postfix) with ESMTP id 91F4758FA for ; Fri, 30 Nov 2018 08:17:02 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ndjD/QY/lIBKvNYatWDnhNwg+raSAu/uAoELuWFNhw0=; b=eu0d+cyuKq9BsJMC2SQn3jUAEcK/5logxYe4iIgcd7hqGNQppJ9n3DE6ukl+kEUCJ/ymvcfmKbmALnnK16DurLM/7HaqsOJbMWzlaFlZdb9QF6q83amchmhQRz1eIl8cAyUxANIk0tjt+GeGe8CgAfEG6N7zCb1zF2GtbRa6zG0= Received: from BYAPR07MB4966.namprd07.prod.outlook.com (52.135.238.207) by BYAPR07MB5590.namprd07.prod.outlook.com (20.177.231.204) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1339.23; Fri, 30 Nov 2018 07:17:00 +0000 Received: from BYAPR07MB4966.namprd07.prod.outlook.com ([fe80::8173:6c30:9144:add]) by BYAPR07MB4966.namprd07.prod.outlook.com ([fe80::8173:6c30:9144:add%2]) with mapi id 15.20.1361.019; Fri, 30 Nov 2018 07:17:00 +0000 From: Pavan Nikhilesh To: Stephen Hemminger , "Jacob, Jerin" CC: "bruce.richardson@intel.com" , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] eal: roundup tsc frequency when estimating it Thread-Index: AQHUiCmS16yoAgbzi06kDx+vW3OwY6Vn6PeA Date: Fri, 30 Nov 2018 07:17:00 +0000 Message-ID: <20181130071641.GA11625@ltp-pvn> References: <20181129083138.23029-1-pbhagavatula@caviumnetworks.com> <20181129132152.754ce410@xeon-e3> In-Reply-To: <20181129132152.754ce410@xeon-e3> Accept-Language: en-IN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BM1PR0101CA0011.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:18::21) To BYAPR07MB4966.namprd07.prod.outlook.com (2603:10b6:a03:5b::15) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Pavan.Bhagavatula@cavium.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [111.93.218.67] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; BYAPR07MB5590; 6:YkvbpfJ6R2ACuYBSlI8TM5aO/sVIiRajFbxa3iscc6wAqfc5SuaAhGxoEpoqufjTNAlkWFSiozI/4XjkKOTtrwK65s62vQCRMp/4ovJfpI1xS4uoyBSxDFidac44xLwVpg0sFHxYjqUKL1QJN/QGxuZR9M1BpIQBHT8Lg9HejgD9+tmAdjJyiTxzD1Nd0O/CFvBhhPNwSfAXcF/U2O98i0sXJozoZ2vrHKjv6JSkaU7Nc+H2xkbDE8F6zyMuc+S9tFmNrTA24MNLFu/aEQpO9GxrDZv24d0AySVszEz8XLOGsYYbQIUBdu7UgHPXCOYrcUdgsGmlGdXblvixNnY0f6pr/qJBtRPso+zu36irOQQnWzR6kQ9XlG4UR1BQfZOYnD/uoaHh9sVWuKb419afMBIW1kHUXVfdw6DGk0SHm5Dwp5fOM9K1CNAgpa55PBrbxTqneC9CBCuKscdGpzdP1g==; 5:+HM0LQFgXcKn7Slo1dJUNB7l93MB9TUTJ5uRdfrD2Pxf7RKB7MpI8STmiqEJaGSoP9jhqO/59nz1XDJ0San0X9bavxDDOaIUfP3qRdx5n0bmKWonZ9ufkZQ8reufNU5dh+v+UNBhvNeLQxB/EsrML3xYO69Y3NxoKA4eFDNzNpE=; 7:ZCgdYgZP+30P/TPjTwfFLLBeriyoSnIsbP9qvdGjCb7w+StzRnYoG6qtMT8IfTfDuebVAmyQXwZQHGJsbKeHKXLYZgYkaisNbqb58gXUs57bn78RGgng0mFYrzRlEIjPOZHmXQPael2xrZzkkVoo9A== x-ms-office365-filtering-correlation-id: 14042dbb-27cf-4213-f597-08d65693d1c8 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(5600074)(711020)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:BYAPR07MB5590; x-ms-traffictypediagnostic: BYAPR07MB5590: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3231453)(999002)(944501410)(52105112)(3002001)(10201501046)(93006095)(148016)(149066)(150057)(6041310)(20161123564045)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(201708071742011)(7699051)(76991095); SRVR:BYAPR07MB5590; BCL:0; PCL:0; RULEID:; SRVR:BYAPR07MB5590; x-forefront-prvs: 087223B4DA x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(7916004)(396003)(346002)(39860400002)(136003)(366004)(376002)(199004)(189003)(8676002)(6246003)(78486014)(305945005)(256004)(229853002)(97736004)(81156014)(186003)(25786009)(14444005)(81166006)(106356001)(68736007)(6486002)(53936002)(6436002)(6512007)(316002)(4326008)(7736002)(54906003)(110136005)(5660300001)(9686003)(71190400001)(486006)(52116002)(71200400001)(446003)(11346002)(66066001)(33656002)(99286004)(476003)(42882007)(8936002)(14454004)(1076002)(6116002)(3846002)(72206003)(2906002)(33716001)(386003)(6506007)(105586002)(33896004)(478600001)(76176011)(102836004)(26005); DIR:OUT; SFP:1101; SCL:1; SRVR:BYAPR07MB5590; H:BYAPR07MB4966.namprd07.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: oQZFk7qTC1O2I4f+oQVpHt0FyE9dQYzS7mngFq36evkRGZWf3GKz4G73vsDcF9UsOyhlpZSy8nanHSSGn3FMkwVWTtZrU5CrGm/MDSdYXm6m3T+xpJisUsgMg41UF90yT20MoAV1kOyV1syfQwOP1fzuJ7kV32Amupb8/ufmPXCJTLgik7FwN/old3eVlWvFUBMegxY1PrEIQGzNKxRpTMqJs2a2NLkCOpy5wZw3nmDPhnmEwH9v3hPkyVy8JcP7/YB42Yi7pregNUnpk5xciw3MAaY9DVk8+2+euBi57EjUd0aDto02NFpGkDspdO3AHy4xZ7E/IBTKYGsr8gioWS8uhtyPvimy7afw4cUtJGA= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-ID: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-Network-Message-Id: 14042dbb-27cf-4213-f597-08d65693d1c8 X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Nov 2018 07:17:00.4597 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR07MB5590 Subject: Re: [dpdk-dev] [PATCH] eal: roundup tsc frequency when estimating it X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Nov 2018 07:17:03 -0000 Hi Stephen, On Thu, Nov 29, 2018 at 01:21:52PM -0800, Stephen Hemminger wrote: > On Thu, 29 Nov 2018 08:32:03 +0000 > Pavan Nikhilesh wrote: > > > When estimating tsc frequency using sleep/gettime round it up to the > > nearest multiple of 10Mhz for more accuracy. > > > > Signed-off-by: Pavan Nikhilesh > > Rounding reduces accuracy. > > Why is this code being used? Shouldn't get_tsc_freq_arch return a > correct value? This patch doesn't modify get_tsc_freq_arch(), it basically gives a more accurate freq reading when we rely on sleep(1) i.e. only when get_tsc_freq_arch() returns 0. example: static uint64_t estimate_tsc_freq(void) { RTE_LOG(WARNING, EAL, "WARNING: TSC frequency estimated roughly" " - clock timings may be less accurate.\n"); /* assume that the sleep(1) will sleep for 1 second */ uint64_t start =3D rte_rdtsc(); sleep(1); return rte_rdtsc() - start; } This will not give the accurate cyc/sec in most cases, rounding it to 10Mhz= wil do the job. In case of ARM64 if we enable RTE_ARM_EAL_RDTSC_USE_PMU, get_tsc_freq_arch(= ) will return 0 as there is no instruction to determine the clk of PMU. > > How well does the rdmsr() logic work in VM? > It looks like Hyper-V has special MSR's for TSC frequency determination. Maybe bruce can give a more accurate answer to this as it is x86 specific. Thanks, Pavan.