Received: by 10.213.65.68 with SMTP id h4csp2139448imn; Thu, 29 Mar 2018 19:04:21 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/1ET0ZAfZEEj+SdjSKnAqtiLgkCbywmE9yPugKfSt/w3h69IbHfa7Ov+od1ePLhms2qA6D X-Received: by 10.98.238.3 with SMTP id e3mr8247922pfi.88.1522375461450; Thu, 29 Mar 2018 19:04:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522375461; cv=none; d=google.com; s=arc-20160816; b=nHtAMAfoNlkEikd42Q1F6WyMAli5n22ABh4dROEY50EF29ys2ew9RBXEnBIymY2FH6 4F5CkZ/qJIt6aVeZilc21X/ufE+qguENVyWwcmYWO/OZzzkmSLXmTqulpkmMH8FNDvof 4AdZ9VcFU0LOFK/3MRgf9wkt3c6th72GGSbfPwpprQZbSbmUXjhfxaaPfjOvsSpA44N5 BzBeEvyzFAOeAzrywKRU4T6eKjTl3CqhWqOr35gPPHT+u+okDx90P9o3ocdGGmjSXlfr vyz5ZteXqKJv4IYIPwMbeSXYrQ82dQGJ383KTl6ZrtclAsQPwzkYCKuJPgvq2HRnxPUf ZrwQ== 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=lUqtYaei4qZaoY2FZX7plv6zAU683DLysbKPURzmMok=; b=s+G6xcZDq6oxLCR6nHJlWLpgiWzphvPb4/wXk4Yqz485elk6MHrjP8ZswcMFv/i6S/ jloEVEjwMoR61iHl1jVKYNJ6whkD8GFZbOKHJiFAqst4iXjaBMX7+dQmyRLekD2hSjpR B2g11BHDJ5fiSZgPO+F8ywg5isr7J/g1Fp4vowfStI50PUWTfRVWO9/oPMPpu8qkvIEW 3K1nTWPcojbzYHmmA8cgB5vXAoKLiBd3vdRBg1ChBpfci40wRQN25gQmnqn1tbQU1COR iTVezwT/bpMu6jmtop2x5IehrbavZ7xGy7Y2tPaB1jao7zffvRp72DdaDOafYvVcWoKY Umgw== 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 l128si4892894pgl.248.2018.03.29.19.04.07; Thu, 29 Mar 2018 19:04:21 -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 S1752655AbeC3CCz (ORCPT + 99 others); Thu, 29 Mar 2018 22:02:55 -0400 Received: from zxshcas1.zhaoxin.com ([180.169.121.91]:12621 "EHLO ZXSHCAS1.zhaoxin.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1752510AbeC3CCy (ORCPT ); Thu, 29 Mar 2018 22:02:54 -0400 Received: from zxbjmbx3.zhaoxin.com (10.29.252.165) 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; Fri, 30 Mar 2018 10:02:52 +0800 Received: from timguo-System-Product-Name.zhaoxin.com (10.29.8.54) 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; Fri, 30 Mar 2018 10:02:51 +0800 From: David Wang To: , , , , , , , , , CC: , , , , , , David Wang Subject: [PATCH v2] Optimize C3 entry on Centaur CPUs Date: Fri, 30 Mar 2018 10:02:39 +0800 Message-ID: <1522375359-30370-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 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 For new Centaur CPUs the ucode will take care of the preservation of cache coherence between CPU cores in C-states and the other CPU cores regardless of how deep the C-states are, so it is not necessary to flush the caches in software before entering C3. Signed-off-by: David Wang 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 | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arch/x86/kernel/acpi/cstate.c b/arch/x86/kernel/acpi/cstate.c index dde437f..d92a7f3 100644 --- a/arch/x86/kernel/acpi/cstate.c +++ b/arch/x86/kernel/acpi/cstate.c @@ -51,6 +51,16 @@ 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 && + (c->x86 > 6 || (c->x86 == 6 && c->x86_model == 0x0f && c->x86_mask>=0x0e))) + flags->bm_check = 1; } EXPORT_SYMBOL(acpi_processor_power_init_bm_check); -- 1.9.1