From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6B39B459DC for ; Fri, 20 Sep 2024 05:19:49 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 302D840669; Fri, 20 Sep 2024 05:19:49 +0200 (CEST) Received: from mail-pj1-f52.google.com (mail-pj1-f52.google.com [209.85.216.52]) by mails.dpdk.org (Postfix) with ESMTP id 721D0400EF for ; Fri, 20 Sep 2024 05:19:47 +0200 (CEST) Received: by mail-pj1-f52.google.com with SMTP id 98e67ed59e1d1-2d88690837eso1408102a91.2 for ; Thu, 19 Sep 2024 20:19:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726802386; x=1727407186; darn=dpdk.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=2sH2hYWToX7DM9txw9fhkrn9oig8KBOSQCXtWvBqjxQ=; b=WLcfrdLCm2MNygAJiSxDAapj21Nt+1oNRmidxUMj3TP8YFiJDiCJp2qZHsYff4Sdjd as7qZUUkftDx+AVkki0pBmrRD9AtFITIfyEYusPHGnj9DDR09NSsFhGIWeEnitFcO3ag 9r6R46xs8RV1QxTWHayYTeXzOAxPRbVZ1G8KhdzJEdWV/hkTPqoDyAswMUEB4stXFRGP ggprjDn8LZot5XB8EGI1GjucssV9VgN7wn1jpCbV+yfzupgd16v2KxK/DKC6dj6+00Mz v8gTww2bCCkLWQYgEu29oTvfxUGPBrAta6u5Jm/YKafNQpEYqZ+/5fY8QysL1XXYI1Js vVDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726802386; x=1727407186; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2sH2hYWToX7DM9txw9fhkrn9oig8KBOSQCXtWvBqjxQ=; b=LYknGfz9XLL+BI+P6fqHKKxihmXmiWVs8B7ckGa0J6q5wZUOQqzSqsdDMUQtaB5/q1 efPZc0GdRMrqZd9g7hE7n3K86UIOFPEmOkvQYeOMB6K4NjbklfxOqRl1dS/Ii39XFkV6 EVQJumpi//WCdTEPh+t4bvmETavWo53X2BTlL/uCfv6s5XxcJv8yoMNm7z09KfPI57es O1O5C3xZe9TH1GKEqb8zWY2pvt+MHy316A+foaGNCp+ut88a4Qa2M1aDjLcXnvBUgaqv zcO7lRaDd5B81THvj38jWHeSFrHhP1tUEe9eJB5uAlgtfSIPdPzHFrsfGM/SoQpj1HV2 eTGQ== X-Gm-Message-State: AOJu0Yzm8xqvIfQrUkFw9GIhR1zVbM7RJ/4gs4eiVnU+OpppWQQHTQ5T ESp7G27X/LLarJSFNDC1DAG0pWcWoLSo0Xrt5wE1QNDQY7dj2Fxyqbeyla1WwJVUCi2Cf//wmxr XBLNPzMLonODBJ4nebRaNrDDZVR2kWetV X-Google-Smtp-Source: AGHT+IGU/qwZAWCXUn7Hi1cHOPN8RWi1bgWsOtG45PVI+0AGuaKeW/80CYuNC3Dq3fB0Cavdj1Mg7pT6HQLjU5DvhFg= X-Received: by 2002:a17:90a:4ca7:b0:2c5:10a6:e989 with SMTP id 98e67ed59e1d1-2dd7f6ebe03mr1852699a91.35.1726802386346; Thu, 19 Sep 2024 20:19:46 -0700 (PDT) MIME-Version: 1.0 References: <20240919152148.45a19343@hermes.local> In-Reply-To: <20240919152148.45a19343@hermes.local> From: Isaac Boukris Date: Fri, 20 Sep 2024 06:19:35 +0300 Message-ID: Subject: Re: Accuracy of rte_get_tsc_hz() compared to linux To: Stephen Hemminger Cc: users@dpdk.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: users@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK usage discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: users-bounces@dpdk.org On Fri, Sep 20, 2024 at 1:21=E2=80=AFAM Stephen Hemminger wrote: > > On Thu, 19 Sep 2024 01:04:40 +0300 > Isaac Boukris wrote: > > > Hi, > > > > On Intel(R) Xeon(R) Gold 6130 CPU @ 2.10GHz (see lscpu output at the en= d). > > > > The rte_get_tsc_hz() returns 2100000 KHz but using it causes our > > timestamps to lag behind real time (roughly a sec per 10 min). I > > noticed the kernel uses 2095082 KHz and in fact it gives much better > > results. > > > > dmesg: > > tsc: Detected 2095.082 MHz processor > > > > tsc_freq_khz (custom kmod to exposes kernel's tsc_khz): > > cat /sys/devices/system/cpu/cpu0/tsc_freq_khz > > 2095082 > > > Sigh. exposing tsc frequency through sysfs is a Redhat extension > that never got merged upstream. Actually I think it is a google thing, I got it from github, someone implemented it for all (hence custom). It is a shame it was never merged as people know about it for a long time. I mean the whole rdtsc API is incomplete without it. As it is, I think the low hanging fruit for now would be to: - lower the rounding in our linux estimate from 10 to 1 MHz. - ignore the arch result if the cpu doesn't have the tsc_known_freq flag. On top of that we can consider: - increase the time of our linux estimate code and lower the rounding even further. - lower the rounding of our common estimation code from 10 to 1 MHz.