From owner-freebsd-current@freebsd.org Tue Mar 10 16:24:28 2020 Return-Path: Delivered-To: freebsd-current@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5E6162693F7 for ; Tue, 10 Mar 2020 16:24:28 +0000 (UTC) (envelope-from theron.tarigo@gmail.com) Received: from mail-qt1-x841.google.com (mail-qt1-x841.google.com [IPv6:2607:f8b0:4864:20::841]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48cL5R34hyz3M5C; Tue, 10 Mar 2020 16:24:27 +0000 (UTC) (envelope-from theron.tarigo@gmail.com) Received: by mail-qt1-x841.google.com with SMTP id n5so6463174qtv.7; Tue, 10 Mar 2020 09:24:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:subject:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=PX9bNpbBoxLDiJ4J4SvgoREIaOcJvRCmIoad74xYB0c=; b=qMcIkCKQQbLenPIDHpiYYk55xt41bjDPudCuCzFxPnCPAhTxC9HmmzYlZuFznlTUWf upKcZIIWLOav7sgZdisa0BTkfNL+c8b9TkB8aZdOH4EFA0vMlosIgeDOXaAyD8IHTbsK 1OE2S8Beb/S/Q1xvwOgfVJl+TA2YwOey1stq9FHB9me/l3HzW/BK0BBdbrZL73haiSwR VZV2z93TB0cZIMwDajq3R6FHkOt0QVAkzax+goGS26R8SjWdaBcCKit5lIVEBZG5WWvo EgzAoCcOlqZSzs15UWGW4mo5S4jcL4HskMyRL1ZEY2ZKFTDbx+3m/HWv6CIwq6RvzR+R 4K6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:subject:to:cc:references:message-id :date:user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=PX9bNpbBoxLDiJ4J4SvgoREIaOcJvRCmIoad74xYB0c=; b=pOz9673dsbhUphqH+A71PeJyIQAfc7Hg/UTP832SrNXhr3Bk5J2MvQr6nzHAyx+DtX D8tu1Knuh2CkUwonfJWRZD6kJ97CrEUu30FSQrIL5XWZbbzRh1V0GUyP6o1jpSvH+0v2 SzCDxUv3bvlF0VgZIorX7eLoVgCPq3b8XsaDJqO+HmbUZbaUg6Kdv5DNgpLN9BXJwoxM Zh9PSINKdW3v/2lXO2PRYywDnEKDV0lnVn/4qgZK5nKR0HQeD83NGLWH09zG+bsv+e2u e0T4E9p9cKyGG/DQXYP6qzGF11XM/EfVD3zm/4LMGTjrMVDGT0BLZuOjvTpJ7ysmm7ZB z2iA== X-Gm-Message-State: ANhLgQ0ok7sk3qkhcNuK6h7t+APQMn13u4Y8MJ2Kxu9GjYG2HqJ9xikD yHud1gwEcmZNvzvTFpDR2XWgFBmB9OA= X-Google-Smtp-Source: ADFU+vsjEieNKvN1Be4GX84P+/kc1bMgfpVlqEALvRXWZNii5g3Pf1XyVEEYm3ULnp0FVT9XPWbtGw== X-Received: by 2002:ac8:1194:: with SMTP id d20mr19680623qtj.243.1583857465879; Tue, 10 Mar 2020 09:24:25 -0700 (PDT) Received: from [168.122.152.42] (dhcp-resnet-168-122-152-42.bu.edu. [168.122.152.42]) by smtp.gmail.com with ESMTPSA id v126sm7108665qkb.107.2020.03.10.09.24.25 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 10 Mar 2020 09:24:25 -0700 (PDT) Sender: Theron Tarigo From: Theron Subject: Re: System clock is slow To: Peter Jeremy Cc: FreeBSD Current , kib@freebsd.org, neel@neelc.org References: <989cd36a-e015-940a-dfe2-851c6fdf4734@gmail.com> <20200310053833.GD3091@server.rulingia.com> Message-ID: Date: Tue, 10 Mar 2020 12:24:24 -0400 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <20200310053833.GD3091@server.rulingia.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Rspamd-Queue-Id: 48cL5R34hyz3M5C X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=qMcIkCKQ; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of therontarigo@gmail.com designates 2607:f8b0:4864:20::841 as permitted sender) smtp.mailfrom=therontarigo@gmail.com X-Spamd-Result: default: False [-3.00 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c]; FREEMAIL_FROM(0.00)[gmail.com]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; FROM_EQ_ENVFROM(0.00)[]; IP_SCORE(0.00)[ip: (2.00), ipnet: 2607:f8b0::/32(-1.85), asn: 15169(-1.65), country: US(-0.05)]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; TAGGED_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com.dwl.dnswl.org : 127.0.5.0]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; IP_SCORE_FREEMAIL(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[1.4.8.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; RCVD_TLS_ALL(0.00)[] X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Mar 2020 16:24:28 -0000 On 2020-03-10 01:38, Peter Jeremy wrote: > Are you running NTP? If so, is NTP maintaining lock and what is the > reported PLL frequency (ntpq -c kerni)? Didn't show any useful difference, "kernel status: pll unsync" when I tested this. > What does "sysctl kern.timecounter" report and have you tried using > any of the alternative timecounters listed in kern.timecounter.choice? Indeed that reveals the problem:     kern.timecounter.hardware: TSC-low (before regression)     kern.timecounter.tc.TSC-low.frequency: 1296053807 (after regression)     kern.timecounter.tc.TSC-low.frequency: 1300000000 (why are these tsc_freq divided by two?) Through some printf's in tsc.c I've determined that the 2.6e9 value is from 0x16 CPUID which Intel says is only a nominal value not to be used, whereas 2.592e9 value is from calibration. /*  * Calculate TSC frequency using information from the CPUID leaf 0x15  * 'Time Stamp Counter and Nominal Core Crystal Clock'.  If leaf 0x15  * is not functional, as it is on Skylake/Kabylake, try 0x16 'Processor  * Frequency Information'.  Leaf 0x16 is described in the SDM as  * informational only, but if 0x15 did not work, and TSC calibration  * is disabled, it is the best we can get at all.  It should still be  * an improvement over the parsing of the CPU model name in  * tsc_freq_intel(), when available.  */ The implementation logic for when to use tsc_freq_cpuid() looks wrong to me; it doesn't match what this comment implies.  Fallback to calibration when calibration is unspecified should proceed when 0x15 fails regardless of what 0x16 does.  (CC'd the authors). Switching to HPET or ACPI-fast gives the expected results.  Would there be any reason to not use HPET provided I can cope with the performance implications? The name of the ACPI option varies haphazardly between "ACPI-fast" and "ACPI-safe" between reboots, I guess it is sensitive to some buggy vendor firmware. > Are you overclocking your CPU (or doing anything else non-standard)? I had previously used powerd to let the CPU underclock to 700MHz when idle.  Now, I've lost all control over CPU frequency (either by powerd or by sysctl) since there is some in-kernel cpufreq driver which I can't figure out how to disable.  It's very much an annoyance, but I think unrelated to the timecounter problem. Theron