Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp713670imu; Mon, 5 Nov 2018 07:43:01 -0800 (PST) X-Google-Smtp-Source: AJdET5dRwFhvMBmOR3CyiMcwJF8eLEZVhRzK88u3BG9l+pSIJL7IIa5o21EbBy9FrzNiLDle/e0C X-Received: by 2002:a17:902:187:: with SMTP id b7-v6mr22707164plb.150.1541432581673; Mon, 05 Nov 2018 07:43:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541432581; cv=none; d=google.com; s=arc-20160816; b=UeOruvEByC5CXXkWVq7gImA8PUIFVMjNWT14vLuDH+cs9kAnpRQBjLFW3PLordlHPs xi9eXTI6z5tyAQwpE2EocUgB21bIaQhu3B9Y3XhTJa8zRf2bOEFvpvzhH1ElNHCbwADE OoedcQC9vh0AxiA71kec34ccZSkMMugrKkkcnkOKwlfXhHMG3ymTp4qxhGU7K4T3Mkkt v8JjfoNEQl0C+/dnhUpOIWMMPANLqFHGkfCoPTctM6RlR8zYwN2fBqjjYDmcPjR/fHkv vEz0qNcUtX4taAW53qoUQYOatBDbj82QrfXLdWoyjlfKUnR9/iToLvqLbrVuiqCeWQ14 kqrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version; bh=8ab6Vk+yzfKDjSfnydzp4gBlhKr240tzvkIDBQusVGs=; b=Q86m0FS0U8lXOxZFwJr8WvF6gxuUSPUBbDk6JzaojVEpolN4tI4/E00mT8U4ZEZ8FW ENzXiSbcGKTJlUZtwsl2EDerjlOrPi+rz2kfavlwX9huaDa9OEzT4S57NBMya/SHqvjR X5arlQ+bB5F0BKFyLZ6zmDnfxhTu7dAf8o13EG21GJcvQ9/CxBa7ScvCcLCp/IQf86PG ckTyOkoHf9hAYgIoAlW/7dfQwu3Utx4fPRoGWYoE4Ccn5QS8NSMeAnJqMRyQTIGkWMRQ FaPNIHjBhNbYUaNhLk7S/IpYMYzPhh6uc/B02QRePhGg6CUUhDSN0slIHzDPtBRDP6sv mInQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y10-v6si8725361plt.145.2018.11.05.07.42.38; Mon, 05 Nov 2018 07:43:01 -0800 (PST) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387442AbeKFBCO (ORCPT + 99 others); Mon, 5 Nov 2018 20:02:14 -0500 Received: from mail-ot1-f42.google.com ([209.85.210.42]:34734 "EHLO mail-ot1-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387420AbeKFBCO (ORCPT ); Mon, 5 Nov 2018 20:02:14 -0500 Received: by mail-ot1-f42.google.com with SMTP id t5so4738102otk.1 for ; Mon, 05 Nov 2018 07:41:57 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=8ab6Vk+yzfKDjSfnydzp4gBlhKr240tzvkIDBQusVGs=; b=j6Uv0R8VrXf7V6WtBSQgQjrzHTTMk0Nfss+UL3eOsrTL5U7Rm2JzTBeQYO+UrHckO+ KbR8FmVmT4MNTUkIhEeac68fuMgo5KPvCepLQAk2o2bvx/lIqE7670qp7lJbsz0jNzfv WZHDYqi5kiEQNIoroLL4x72THLv6bN9KZaFBIMwuDqxCNteXDJn+3PZiKs2bCDPklRzI SX5et6D9VAXgfoIRY6nn5Gk4qGcg7Ua6z5EFMumegsFEfQWxJs72ZSvrUfjpIHQFOcfo ZvdiL47+bE32PtbSQtxA1wbvEppM+UXW9rLSxYEAhDYzkej62TUYkoWVyVeGy5FTJt9P X9zA== X-Gm-Message-State: AGRZ1gKGHCh0fx443PHk54ihgIpxk6RaM+CrIKngr3EAnKQiQ6Hu7gGv i6nkrUyW0Rlh/+K7fbrjrrkf6bf2Vha9XPzwSnFsYQ== X-Received: by 2002:a9d:55af:: with SMTP id m44mr14082790oth.277.1541432517364; Mon, 05 Nov 2018 07:41:57 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a9d:faf:0:0:0:0:0 with HTTP; Mon, 5 Nov 2018 07:41:56 -0800 (PST) In-Reply-To: References: <1541085133-32534-1-git-send-email-neelx@redhat.com> From: Daniel Vacek Date: Mon, 5 Nov 2018 16:41:56 +0100 Message-ID: Subject: Re: [PATCH] tsc: make calibration refinement more robust To: Thomas Gleixner Cc: x86@kernel.org, Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , LKML , Peter Zijlstra Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Nov 3, 2018 at 11:04 AM, Thomas Gleixner wrote: > Daniel, > > On Fri, 2 Nov 2018, Daniel Vacek wrote: >> On Thu, Nov 1, 2018 at 4:34 PM, Thomas Gleixner wrote: >> >> -#define MAX_RETRIES 5 >> >> -#define SMI_TRESHOLD 50000 >> >> +#define MAX_RETRIES 5 >> >> +#define TSC_THRESHOLD (tsc_khz >> 5) >> > >> > This breaks pit_hpet_ptimer_calibrate_cpu() because at that point tsc_hkz is 0. >> >> That did not show up with my testing, sorry. I guess >> pit_calibrate_tsc() never failed for me. Hmm, actually it looks like >> quick_pit_calibrate() does the job for me so >> pit_hpet_ptimer_calibrate_cpu() is likely not even called. > > Right. It's only called when quick calibration fails. Testing does not > replace code inspection :) Agreed. I was not 100% sure about this early init and order of execution as it's dynamically changed with x86_platform.calibrate_cpu and x86_platform.calibrate_tsc. Thanks again for the review, Thomas. > Can you please avoid hiding the logic in a macro? Just use a local > variable: > > u64 thresh = tsc_khz ? tsc_khz >> 5 : TSC_DEFAULT_THRESHOLD; > > and use that in the comparison. Sweet, I'll do that :) --nX > Thanks, > > tglx