Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp7170632imu; Thu, 27 Dec 2018 13:53:30 -0800 (PST) X-Google-Smtp-Source: AFSGD/UEwuOAUvXHAhTDdctqqBFiZEQaZFIDyOZ/sPF9ARmHPKKmK1hgcnOfYkvKj2BlPsYjVlVj X-Received: by 2002:a62:ca9c:: with SMTP id y28mr25502847pfk.236.1545947610414; Thu, 27 Dec 2018 13:53:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545947610; cv=none; d=google.com; s=arc-20160816; b=ObONaSgQQJzZ+Gabo90V3LarvnfgEXonYiOGV9DfHxzudWYVPnzxCsOi6jsrm2xly4 a/U2njNLw6z2d780KiHuSOxxTBXPJfG3yrKwPGjPOl3XeFn/61cTGf6qW8UQPMLm8U4i ea1B1dNlrc64y345vyWxdof5P5kOG87Of5VkhC0CCzRy7eOnCeyhsYo5ny/XDhnA2RqY XSVv8rAHx/m9l/ftHstClgqh9nJpd6jehjn0sPqK7iVIQgBz0YzNrRNJAhNJ6gQ7O6+T YmwAOu8b1nJkKgiIRrQD/rPagW7u1T298mAgz22uxstquVmMUY8sMofvxzBMaDw5mfeA HGbQ== 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; bh=5uCaTUmvF8nJPj301g7iyJkjziCnDNDYpIVpnDp6HLw=; b=yLq5PER1oDNk43xomgaH7JqUh2ZxQXJvSHk0NLaR6F9hmXgh3XTl98RL/WAWjZSVV3 r6F7rBYWiO5pOESPP9IbzlO9ZeMjTD8+47RR7hvFHKZzxDhstNE4dcKjuzhbk9MMYIiw SxsE/iv/zfoWsGHCfOth5cgjdz1/543ExJzb1+WMKl0De4dAAwGKMRbpTUmEhbwrkpL5 H+qqB95mbQ1sCKqa19/SqchG/fubX9+zZcqWCA954whI/WcxjiDfOM+iWgYnhxvkI/qd 5bHUtHfMCw4L1rhrioelCwRdOf0b/ciQ8ZewFf7dG5ynwYr6LHoWF0b0Ws7K212tJn6O 4f7w== 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 d8si1537079pgh.505.2018.12.27.13.53.15; Thu, 27 Dec 2018 13:53:30 -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 S1729935AbeL0I5Q (ORCPT + 99 others); Thu, 27 Dec 2018 03:57:16 -0500 Received: from ZXSHCAS1.zhaoxin.com ([203.148.12.81]:22258 "EHLO ZXSHCAS1.zhaoxin.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728748AbeL0I5Q (ORCPT ); Thu, 27 Dec 2018 03:57:16 -0500 X-Greylist: delayed 901 seconds by postgrey-1.27 at vger.kernel.org; Thu, 27 Dec 2018 03:57:14 EST Received: from zxbjmbx2.zhaoxin.com (10.29.252.164) by ZXSHCAS1.zhaoxin.com (10.28.252.161) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1261.35; Thu, 27 Dec 2018 16:42:05 +0800 Received: from timguo-System-Product-Name.zhaoxin.com (10.29.8.54) by zxbjmbx2.zhaoxin.com (10.29.252.164) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1261.35; Thu, 27 Dec 2018 16:42:04 +0800 From: David Wang To: , , , , , , , , CC: , , , , David Wang Subject: [PATCH v3] Optimize C3 entry on Centaur CPUs Date: Thu, 27 Dec 2018 16:41:50 +0800 Message-ID: <1545900110-2757-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.54] X-ClientProxiedBy: zxbjmbx1.zhaoxin.com (10.29.252.163) To zxbjmbx2.zhaoxin.com (10.29.252.164) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org For new Centaur CPUs the ucode will take care of the preservation of cache coherence between CPU cores in C-states regardless of how deep the C-states are. So, it is not necessary to flush the caches in software befor entering C3. And this useless operation will cause performance drop for the cores which share some caches with the idling core. Signed-off-by: David Wang Reviewed-by: Thomas Gleixner Changes from v2 to v3: *1, Replace "c->x86_mask" with "c->x86_stepping". Changes from v1 to v2: * 1, Add some Family/Model/Stepping contrains to let this patch only apply * to new centaur CPUs. * 2, The arbiter disable/enable operations maybe needed for old VIA/Centaur * platform. So, delete "flags->bm_control=0" in patch v1. --- arch/x86/kernel/acpi/cstate.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/arch/x86/kernel/acpi/cstate.c b/arch/x86/kernel/acpi/cstate.c index 158ad14..ed17640 100644 --- a/arch/x86/kernel/acpi/cstate.c +++ b/arch/x86/kernel/acpi/cstate.c @@ -51,6 +51,18 @@ void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flags, if (c->x86_vendor == X86_VENDOR_INTEL && (c->x86 > 0xf || (c->x86 == 6 && c->x86_model >= 0x0f))) flags->bm_control = 0; + /* + * For all recent Centaur CPUs, the ucode will make sure that each + * core can keep cache coherence with each other while entering C3 + * type state. So, set bm_check to 1 to indicate that the kernel + * need not execute a cache flush operation (WBINVD) when entering + * C3 type state. + */ + if (c->x86_vendor == X86_VENDOR_CENTAUR) { + if (c->x86 > 6 || (c->x86 == 6 && c->x86_model == 0x0f && + c->x86_stepping >= 0x0e)) + flags->bm_check = 1; + } } EXPORT_SYMBOL(acpi_processor_power_init_bm_check); -- 1.9.1