Received: by 10.223.176.46 with SMTP id f43csp2734531wra; Mon, 22 Jan 2018 02:30:58 -0800 (PST) X-Google-Smtp-Source: AH8x226Y6sCZeSMa7JOlhLo1pTAArGzYMCDsAzBHlPYF/j+7ipUlnO53x2y3MEzU+Kytk4YpW92m X-Received: by 2002:a17:902:221:: with SMTP id 30-v6mr3291108plc.134.1516617058233; Mon, 22 Jan 2018 02:30:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516617058; cv=none; d=google.com; s=arc-20160816; b=HVxYLzj5Nve7lXcs30HEqi6baNvSgVmamUmk7UWALaamoKHywUu+GqgohTOaiZMqxG /BlTcAXXiD8GKhL99q31uA//rxVWDr3phOHDGjUJiTZdHNsduMxh0pnUhlbnL3+zFLR6 451lScJ62mcBgyqpMXtIVpJHCSmVBaY95tzYsedRlBjje+9GUhekg26slR8tUH88s8W+ 9ZnR3exD0RRM91xPJhk38z0El+6PfNGjY0MVnGR895dwS6zzqoMcNnsBkxThafG1xyqW qtovjeRCsUdnYmGGY/OkffrD/oTbh7RnwBkG1fCXNmJwOp3Em7tcMuhLVSNSEY73pC+y dZ8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:arc-authentication-results; bh=b2kru6fxMfDIbj5+prrIkjeLgXDh8GvSSSgGv47MLwQ=; b=07hVsEWHHT4ZaH5E6cC4FNJ8kufeFXG2gU8mQIiq4lbU/o+HUKyHezXUy0XNxKv+Oo QS4lxCDYxDfR/5sJS6WumepFIYDKxE6aNhJz5ssijGbuELz+xciArBaxqAdoH0Ts5via Z/GfGkcuwh8tR7yb48Iyp4w8v/zXMDfYqRdvNC8kVVTm8jKoPye1M44ozSbkSyWAAEEU v5HT8CAL/u/58fdRCtAXW4+lxhyLwVNWOePQ/nMxs1yocEOx9tems9I9KxJMJ11MFtaJ GKJmh1iP0Um64oJaOVP3Hr5UUN6woVq6XZEoqaRV/zeNWeWw8uJr7esg7Z7bLhj29gDY kQOw== 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 r90si629126pfa.51.2018.01.22.02.30.44; Mon, 22 Jan 2018 02:30:58 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751057AbeAVK3v (ORCPT + 99 others); Mon, 22 Jan 2018 05:29:51 -0500 Received: from zxshcas2.zhaoxin.com ([180.169.121.92]:14808 "EHLO ZXSHCAS2.zhaoxin.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1750890AbeAVK3t (ORCPT ); Mon, 22 Jan 2018 05:29:49 -0500 X-Greylist: delayed 903 seconds by postgrey-1.27 at vger.kernel.org; Mon, 22 Jan 2018 05:29:49 EST Received: from zxbjmbx3.zhaoxin.com (10.29.252.165) by ZXSHCAS2.zhaoxin.com (10.28.252.162) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1261.35; Mon, 22 Jan 2018 18:14:32 +0800 Received: from timguo-System-Product-Name.zhaoxin.com (10.29.8.61) by zxbjmbx3.zhaoxin.com (10.29.252.165) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1261.35; Mon, 22 Jan 2018 18:14:31 +0800 From: davidwang To: , , , , , , CC: , , , , davidwang Subject: [PATCH] x86/centaur: Mark TSC invariant Date: Mon, 22 Jan 2018 18:14:17 +0800 Message-ID: <1516616057-5158-1-git-send-email-davidwang@zhaoxin.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.29.8.61] X-ClientProxiedBy: zxbjmbx1.zhaoxin.com (10.29.252.163) To zxbjmbx3.zhaoxin.com (10.29.252.165) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Centaur CPU has a constant frequency TSC and that TSC does not stop in C-States. But because the flags are not set for that CPU, the TSC is treated as not constant frequency and assumed to stop in C-States, which makes it an unreliable and unusable clock source. Setting those flags tells the kernel that the TSC is usable, so it will select it over HPET. The effect of this is that reading time stamps (from kernel or user space) will be faster and more efficent. Signed-off-by: davidwang --- arch/x86/kernel/cpu/centaur.c | 4 ++++ drivers/acpi/processor_idle.c | 1 + 2 files changed, 5 insertions(+) diff --git a/arch/x86/kernel/cpu/centaur.c b/arch/x86/kernel/cpu/centaur.c index 68bc6d9..c578cd2 100644 --- a/arch/x86/kernel/cpu/centaur.c +++ b/arch/x86/kernel/cpu/centaur.c @@ -106,6 +106,10 @@ static void early_init_centaur(struct cpuinfo_x86 *c) #ifdef CONFIG_X86_64 set_cpu_cap(c, X86_FEATURE_SYSENTER32); #endif + if (c->x86_power & (1 << 8)) { + set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC); + set_cpu_cap(c, X86_FEATURE_NONSTOP_TSC); + } } static void init_centaur(struct cpuinfo_x86 *c) diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index d50a7b6..5f0071c 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c @@ -207,6 +207,7 @@ static void tsc_check_state(int state) switch (boot_cpu_data.x86_vendor) { case X86_VENDOR_AMD: case X86_VENDOR_INTEL: + case X86_VENDOR_CENTAUR: /* * AMD Fam10h TSC will tick in all * C/P/S0/S1 states when this bit is set. -- 1.9.1