Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3210511imm; Tue, 29 May 2018 03:13:31 -0700 (PDT) X-Google-Smtp-Source: AB8JxZouD06tzaYQnuIVh5276+bKRGjT7EdA60WwMCS7TAc6Em6yA3Ow5vYzCWFrNDHjectQZlH6 X-Received: by 2002:a63:9302:: with SMTP id b2-v6mr13480340pge.263.1527588811655; Tue, 29 May 2018 03:13:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527588811; cv=none; d=google.com; s=arc-20160816; b=zZdOgf1VP+tbmmIwbt98+svE3ConYKAo5FFJrDYGOF8q76uHtDwBgoItrI1NdbeD3T 5FfhZWQqKJLmdjfMAIh/w2dmbosCcvq82d2xXUmSHcODTwgRyBb8Y54g5JrsIPJIOgI/ Wk1E48fuF44gJcN64sH2df6jGxc0/RRq5QkpxHWm0rfOy2VYeo4SY2/xFPqXgrgR5npF Od0eJmUN5CpETNjxxqHKsSVdQ5M1otkGrc3MblXwR7UhFAIeCKM4EY8Z5zDUZckDAptB cZjrYqVfdWyK0yqkc8/pLyxMN8rOqteAblkgBIraELvmgbYDxPWqfqcbXOnikAqoJ+eT 3jog== 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=rlCnKya3xG5ZMftU2s9+O2nWWrUwtqyI8k/1nJUlD9o=; b=bkb0iRJ82m10nVFwdYWx0/J4tVkZjE7uPvTgNr5szD3odrS2UkOHK4pjz6NbFbSpiC rJxTbgWByc7epabQaJlTz9MG7RNoKb5QltIrn83/nMdhkj6AVqLJ3FbazUA94NAUb+yW J3jnof2fWLuhNNoh6OY5Vust1drRbgvgKxUx5uoQ7+LpGDjuE/88kpmk5jr04z4ePBFf DWai99Jl3/9/CKbR47hKl5cWoxAt5hBrKIJT68C05BV1vCKz1UdrOM3zj+QVaVwko1v9 sCfq2Wexps9xuu3RTo7JktcJ0TihwoQZZW00lXsbsxaEXN8Ks/eGVYU/XQepYMVTUD6M wuxQ== 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 e8-v6si25630020pgt.185.2018.05.29.03.13.17; Tue, 29 May 2018 03:13:31 -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 S932854AbeE2KMv (ORCPT + 99 others); Tue, 29 May 2018 06:12:51 -0400 Received: from ZXSHCAS1.zhaoxin.com ([203.148.12.81]:33203 "EHLO ZXSHCAS1.zhaoxin.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S932665AbeE2KMs (ORCPT ); Tue, 29 May 2018 06:12:48 -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; Tue, 29 May 2018 18:12:40 +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; Tue, 29 May 2018 18:12:39 +0800 From: David Wang To: , , , , , , , , CC: , , , , , , David Wang Subject: [PATCH v3] Optimize C3 entry on Centaur CPUs Date: Tue, 29 May 2018 18:12:37 +0800 Message-ID: <1527588757-19229-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 regardless of how deep the C-states are. So, it is not necessary to flush the caches in software befor entering C3. Signed-off-by: David Wang 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 | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/arch/x86/kernel/acpi/cstate.c b/arch/x86/kernel/acpi/cstate.c index dde437f..a82fed6 100644 --- a/arch/x86/kernel/acpi/cstate.c +++ b/arch/x86/kernel/acpi/cstate.c @@ -51,6 +51,19 @@ 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