Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1171841imm; Fri, 13 Jul 2018 12:55:36 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfL4TqotemKfirUL5tji/UgDliYrbCAFRXr/ZmdvtUN/15n3doifCYU1pJEBDe2UxqP7a7u X-Received: by 2002:a17:902:e28b:: with SMTP id cf11-v6mr7777680plb.86.1531511736304; Fri, 13 Jul 2018 12:55:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531511736; cv=none; d=google.com; s=arc-20160816; b=HUuxIWdUt7Ga7ozjFvW9yoXOATzrj1o9p7SCUG046mwLRmYGOAnMobLTUsOiPHx9hd WpKijTuf7aPV5Ovxkp9w1CCz8q5s3ZHyNzioomdBmc04qBZn1c3bxY3qbzbMhu5v7ee0 tG7m+PuAkvcN7yXPAjIDpE2k21/KepHQzUirksJz1Ui4UkBcs9tFCAfBLpsaH8mRvodh z6MVwnnRkWi4F4A2DDE08VMMCRFyL5agF2wsGWcxoJWDHRiIkFt7QxWGOlv1lourSQ/m 5uB1dwY7CpMKPn0JQEWAHjK9kh9TaH3C7SBzoJk25BNhesID52LP21MD8cvIBM4Anf8a Hzkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=A39jJQKKQcZBORC0vGfyWu25MJzfeSnCRDU4ORWMAyo=; b=kIsFH1XTgnNZ/WjGB0V6vcbpTTf/4Ce3qOQI6otHQND8j2GO2ixe+H5CvuyZIpduYu LvzrJTtfDq51Q5srliIIH0UdGFKvLIzPhgghS9pciCI14ISVwf6zy4OoTQTQyE2NEneS aGkjrxhImDLQFtSA4rYAEgIB7tfSci7jKpqwEXwVTqR1K90KjvaYnFUX5IE6f/mgZgcm LYfxMAG6s6upOqNMoSzvs/S/Bt3EP3XeymqjuMSFlBTlsPC+5NSJ4oQvzPqvP4T4o5Rn mujIAm77cdMvAllEIC/T8Ue+MriyrX6LPKsyLtdxk5ExDPdFGzoY/wjGnSPcrlzJVQ5X dKjQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 33-v6si24324113ply.344.2018.07.13.12.55.21; Fri, 13 Jul 2018 12:55:36 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731910AbeGMUKL (ORCPT + 99 others); Fri, 13 Jul 2018 16:10:11 -0400 Received: from mga.supermicro.com ([207.212.57.84]:44859 "EHLO mga.supermicro.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730017AbeGMUKL (ORCPT ); Fri, 13 Jul 2018 16:10:11 -0400 Received: from pps.filterd (MGA.supermicro.com [127.0.0.1]) by MGA.supermicro.com (8.16.0.22/8.16.0.22) with SMTP id w6DJs4Tk002693; Fri, 13 Jul 2018 12:54:04 -0700 Received: from ex2013-mbx2.supermicro.com ([10.2.1.38]) by MGA.supermicro.com with ESMTP id 2k2w4sh19m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Fri, 13 Jul 2018 12:54:04 -0700 Received: from [172.16.95.100] (10.2.0.41) by Ex2013-MBX2.supermicro.com (10.2.1.38) with Microsoft SMTP Server (TLS) id 15.0.1236.3; Fri, 13 Jul 2018 12:53:11 -0700 Subject: Re: [RFC] x86, tsc: Add kcmdline args for skipping tsc calibration sequences To: Arjan van de Ven , , CC: , , References: <9cdcf3bb-4d01-19cc-536f-4745ecb058c6@linux.intel.com> From: patrickg Message-ID: Date: Fri, 13 Jul 2018 12:54:03 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <9cdcf3bb-4d01-19cc-536f-4745ecb058c6@linux.intel.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [10.2.0.41] X-ClientProxiedBy: EX2013-CA1.supermicro.com (10.2.1.31) To Ex2013-MBX2.supermicro.com (10.2.1.38) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-07-13_07:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=794 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1806210000 definitions=main-1807130179 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/13/2018 12:40 PM, Arjan van de Ven wrote: > On 7/13/2018 12:19 PM, patrickg wrote: >> This RFC patch is intended to allow bypass CPUID, MSR and QuickPIT calibration methods should the user desire to. >> >> The current ordering in ML x86 tsc is to calibrate in the order listed above; returning whenever there's a successful calibration.  However there are certain BIOS/HW Designs for overclocking that cause the TSC to change along with the max core clock; and simple 'trusting' calibration methodologies will lead to the TSC running 'faster' and eventually, TSC instability. >> > > > that would be a real violation of the contract between cpu and OS: tsc is not supposed to change for the duration of the boot With the methodology used; the TSC is still invariant; it's just running faster than the CPUID math calculates. > >> I only know that there's a use-case for me to want to be able to skip CPUID calibration, however I included args for skipping all the rest just so that all functionality is covered in the long run instead of just one use-case. > > wouldn't it be better to start the detailed calibration with the value from CPUID instead; that way we also properly calibrate spread spectrum etc... > > I thought we switched to that recently to be honest... Are you referencing: 1bf8915ae5156dff439d2c65314bd8fdde1b83bf - x86/tsc: Enumerate SKL cpu_khz and tsc_khz via CPUID However since it's returning at CPUID calibration during native_calibrate_cpu(); it's not compared after-the-fact, leading to the TSC to use the 'slower' number returned by CPUID. Now keep in mind; I dunno if there was any reason to explicitly not want to utilize the PIT calib sequences on SKL. That'd be a factor for this. Would comparing the number after the fact; then if there's a significant difference between PIT and MSR/CPUID, defaulting to the 'faster' value be a better solution?