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 17890459D3 for ; Thu, 19 Sep 2024 11:37:57 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 00F9F402B1; Thu, 19 Sep 2024 11:37:57 +0200 (CEST) Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) by mails.dpdk.org (Postfix) with ESMTP id 06C67400D5 for ; Thu, 19 Sep 2024 11:37:56 +0200 (CEST) Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-2068acc8a4fso6979765ad.1 for ; Thu, 19 Sep 2024 02:37:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726738675; x=1727343475; 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=M+hb+CMnry9Nja+M3JZNBYQ8IzoupLHLY2pnlpBTSw0=; b=MbXQby8SkhIWTXiHRRGYZiRzqapvu+Jr9uI0IY9FjS4JjQlOUtpjOOo6vSRQVBUL/v PbfHs/my69daksnv81A+asv8s86qBwQZDOfjuxuENt6RwcAlFf9cQIaXP1siUqUAA2Rs CHirxV8aA2M9bAAidvTsIXlli4eRaWNcK705pvx5eeWy1PaOQaf/M2HsmffLq+SNGZwn ytXDK7eVmZklDzyMkALqeI4ZfOTCQhlSTHytqDEHy+IJzG9Nrl/p4I+j8NQ/BydYaLMB JXX8mDjA73odH0kC1+rKsu4W7RIWSLDV1TyTMg04Odgkv57I1QHEBr3/pgwWmrOMWwhc +8xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726738675; x=1727343475; 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=M+hb+CMnry9Nja+M3JZNBYQ8IzoupLHLY2pnlpBTSw0=; b=dLAR4L+CAIpDDdMpyiMVuq3G3N7clcaQP5DFWbKLP3UFhf2dEISRcuevZ11aNVMREn JJjmioxfgXUTtYyDMEZk40MAbGXADSPr16c5EuclvREHFxAkaED/Q8PCHY6K7ZyGl+zs H3zw1GQUme7QuNgHUdYJcNBL99nhNmQyFyKx89ITTjgHaE3Z3GWtouuPFm7TYBk1wiVe UujhqqnNDye3OUa/hzrykgDc7PeKf8wmopgYXharX0fE0IG3UaKDRcOStxb+zeSk8l9o WSoL2fwp0scCMR8QrcFXqCfa4p4apiBvtqjrwTAOvNjH7uGvESjU138Xv2m9bUvlxuDs Hx2g== X-Gm-Message-State: AOJu0Yw+NBiXerC82Dt7TiBbp0WAT/QUGeW/kt2qyyKVfItW0WuNhkcg TtUSZL+3bsxLfB8tuPk0hIJAeqjsovMfcmOPodA3i2UlrLCLtew5VKUqAIS8dWzVt6Ll59QObXi LtW+dq+5srHze7Nn34C8MO3pbN9vYpeX4 X-Google-Smtp-Source: AGHT+IGiFp3xh5bDif1pSGF+CtXylPFczf3MoRjO1Rot69AFN5Mfmw0zGJ2Qc/YLK3psSEyw5JYT5Ie3lV5XIS99w+c= X-Received: by 2002:a17:902:d2ca:b0:202:2f0:3bb2 with SMTP id d9443c01a7336-20782c201e0mr210838105ad.60.1726738675012; Thu, 19 Sep 2024 02:37:55 -0700 (PDT) MIME-Version: 1.0 References: <20240918162739.144ffd9d@hermes.local> In-Reply-To: <20240918162739.144ffd9d@hermes.local> From: Isaac Boukris Date: Thu, 19 Sep 2024 12:37:43 +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 Thu, Sep 19, 2024 at 2:27=E2=80=AFAM Stephen Hemminger wrote: > > On Thu, 19 Sep 2024 01:04:40 +0300 > Isaac Boukris wrote: > > > I've run the helloworld application on an isolated cpu: > > taskset -c 10 ./dpdk-helloworld --log-level=3Dlib.eal:debug --no-huge > > > > The results are: > > EAL: TSC frequency arch ~2100000 KHz > > EAL: TSC frequency linux ~2095082 KHz > > EAL: TSC frequency estimate ~2095346 KHz > > > > The arch one is picked, which seems rather wrong, any way to override t= hat? > > Should we lower the estimation rounding to 1MHz or even 1KHz in the lin= ux one? > > > > Thoughts? Thanks! > > > > Kernel: 4.18.0-513.9.1.el8_9.x86_64 > > Note: 4.18 kernel was end of life 12 August 2018, I assume > this is RHEL8 which does their own backports and never changes kernel ver= sion. Indeed RHEL 8.9 > What is the kernel dmesg, why is it deciding on that value? It comes from kernel's determine_cpu_tsc_frequencies() afaict (which didn't change that much). As a matter of fact, I got a similar behavior on my vmware VM on my laptop (although smaller diff). kernel: 4.18.0-553.8.1.el8_10.x86_64 lscpu: Model name: 12th Gen Intel(R) Core(TM) i7-1260P Stepping: 3 CPU MHz: 2495.994 BogoMIPS: 4991.98 Hypervisor vendor: VMware dmesg | grep -i tsc [ 0.000000] vmware: TSC freq read from hypervisor : 2495.994 MHz [ 0.000000] tsc: Detected 2495.994 MHz processor [ 0.000000] TSC deadline timer available [ 0.010000] clocksource: tsc-early: mask: 0xffffffffffffffff max_cycles: 0x23fa717cb36, max_idle_ns: 440795237972 ns [ 0.905000] clocksource: Switched to clocksource tsc-early [ 3.104381] tsc: Refined TSC clocksource calibration: 2495.990 MHz [ 3.105473] clocksource: tsc: mask: 0xffffffffffffffff max_cycles: 0x23fa6db1dfc, max_idle_ns: 440795265852 ns [ 3.264297] clocksource: Switched to clocksource tsc cat /sys/devices/system/cpu/cpu0/tsc_freq_khz 2495990 sudo bpftrace -e 'BEGIN { printf("%u\n", *kaddr("tsc_khz")); exit(); }' Attaching 1 probe... 2495990 My modified dpdk code above gives: EAL: TSC frequency arch ~0 KHz EAL: TSC frequency linux ~2495982 KHz EAL: TSC frequency estimate ~2497263 KHz Note that with the unmodified dpdk code which rounds to 10MHz both the linux and the common estimation would give 2500000 KHz.