Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2152917ybt; Fri, 3 Jul 2020 02:08:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyZ/cfI/7rDUuRStuJJSHxgTOnov3Wqs5o1Cmdql2+rCapoA2fYfX5+5CpEPY7TpEyMPwXr X-Received: by 2002:a17:906:7802:: with SMTP id u2mr32293962ejm.478.1593767281800; Fri, 03 Jul 2020 02:08:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593767281; cv=none; d=google.com; s=arc-20160816; b=G4gMWkLP+MUqGJhfUpqdI3FrLW9ILeEpHj5GnEye+8rS5pr9/wP40d/IT49OlTi6Ve arzcr9XNYQyBb2wItwQfjyYfVSku/JYRTWXbajpg4iQT/DSOlk0oJaBBBGmF7muwkd5y rS22V9IVf4WNz2s6L7jWRMpN2JMae6LZJ098Jz9xj0DfjFelbh1vxvTIf7DOFvqaYu51 8QfaZykshRSGgKj8KsDSNP4N6ixrx6k0pWgFAoe5DX8f56sw491I16b+YOu3pLlteQKj L0W0xVeAUDSEML7KAhY6eE/IyRTWBF4Yh1CsiqKWaplWsw2bqDNOJMUQMtOv8q9atMwA axTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :ironport-sdr:ironport-sdr; bh=sTf8d/91ty8BMQVmZrR0W/wXp30etf42hR3jWj6LRds=; b=Ntzz9b1HtR+/DLevIcTeDUEe25cozl9qQYPHP3LMyI/UfYt+M6FR1M5UGN/sFjxynj 7EC/Ceg/j9wKf1/2/pZsXAcP1Vxakji29kUaRsuHgQVuNGSVRADHEQokK2DGSNlWsqGw 6UAHvs0IkKMf+qJECeBuM8kWA540PILQ0RqrIG3z/nF4DbqCESR2WuAj6Ypl7jJuFBmv ibPowQfZdvFjL3t+EiWP/3nKJqRYt5ZqMNTXE+rsGKXu5GyzIA+Potz3K12R4KZSTDjm Cv4CqlBtM96P/wNPd23pHg4emWVbqyPW5aHELCesoduntry81BRl8ADhGruLeaxXSXZL 0vxw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i4si7341323eja.4.2020.07.03.02.07.38; Fri, 03 Jul 2020 02:08:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726396AbgGCJEu (ORCPT + 99 others); Fri, 3 Jul 2020 05:04:50 -0400 Received: from mga07.intel.com ([134.134.136.100]:38702 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725764AbgGCJEt (ORCPT ); Fri, 3 Jul 2020 05:04:49 -0400 IronPort-SDR: gOx/e53kru2QXxcGrCkwR5SHVbOdWD8h0ljxwyZ4z9zZw8uJy78Q7gODaakgUf3MKbpussjkDp 1AZkBpFjGLfg== X-IronPort-AV: E=McAfee;i="6000,8403,9670"; a="212138636" X-IronPort-AV: E=Sophos;i="5.75,307,1589266800"; d="scan'208";a="212138636" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jul 2020 02:04:49 -0700 IronPort-SDR: 7kxNk0o4XkdReLoS7Rl97nsKf0zg7Ab68OgR5Wx67aNMO4qoIBQDUUukFpNPR5EfNPNwg23b7O HMVaUxlgUUVA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,307,1589266800"; d="scan'208";a="267299967" Received: from chenyu-office.sh.intel.com ([10.239.158.173]) by fmsmga008.fm.intel.com with ESMTP; 03 Jul 2020 02:04:44 -0700 From: Chen Yu To: Len Brown , Jacob Pan , "Rafael J. Wysocki" Cc: Artem Bityutskiy , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Chen Yu , Zhang Rui Subject: [PATCH] intel_idle: Customize IceLake server support Date: Fri, 3 Jul 2020 17:02:42 +0800 Message-Id: <20200703090242.5564-1-yu.c.chen@intel.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On ICX platform, the CPU frequency will slowly ramp up when woken up from C-states deeper than/equals to C1E, and since C1E auto-promotion is enabled by default, this might cause unexpected result. Thus this patch disables C1E auto-promotion and expose C1E as a separate idle state, so that the C1E and C6 can be disabled via sysfs when necessary. Besides C1 and C1E, the exit latency of C6 was measured by a dedicated tool. However the exit latency(41us) exposed by _CST is much smaller than the one measured(128us). This is probably due to the _CST uses the exit latency when woken up from PC0+C6, rather than PC6+C6 when C6 was measured. Tested-by: Artem Bityutskiy Acked-by: Artem Bityutskiy Signed-off-by: Zhang Rui Signed-off-by: Chen Yu --- drivers/idle/intel_idle.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c index f4495841bf68..1eab606d858b 100644 --- a/drivers/idle/intel_idle.c +++ b/drivers/idle/intel_idle.c @@ -752,6 +752,35 @@ static struct cpuidle_state skx_cstates[] __initdata = { .enter = NULL } }; +static struct cpuidle_state icx_cstates[] __initdata = { + { + .name = "C1", + .desc = "MWAIT 0x00", + .flags = MWAIT2flg(0x00), + .exit_latency = 1, + .target_residency = 1, + .enter = &intel_idle, + .enter_s2idle = intel_idle_s2idle, }, + { + .name = "C1E", + .desc = "MWAIT 0x01", + .flags = MWAIT2flg(0x01) | CPUIDLE_FLAG_ALWAYS_ENABLE, + .exit_latency = 4, + .target_residency = 4, + .enter = &intel_idle, + .enter_s2idle = intel_idle_s2idle, }, + { + .name = "C6", + .desc = "MWAIT 0x20", + .flags = MWAIT2flg(0x20) | CPUIDLE_FLAG_TLB_FLUSHED, + .exit_latency = 128, + .target_residency = 384, + .enter = &intel_idle, + .enter_s2idle = intel_idle_s2idle, }, + { + .enter = NULL } +}; + static struct cpuidle_state atom_cstates[] __initdata = { { .name = "C1E", @@ -1056,6 +1085,12 @@ static const struct idle_cpu idle_cpu_skx __initconst = { .use_acpi = true, }; +static const struct idle_cpu idle_cpu_icx __initconst = { + .state_table = icx_cstates, + .disable_promotion_to_c1e = true, + .use_acpi = true, +}; + static const struct idle_cpu idle_cpu_avn __initconst = { .state_table = avn_cstates, .disable_promotion_to_c1e = true, @@ -1110,6 +1145,7 @@ static const struct x86_cpu_id intel_idle_ids[] __initconst = { X86_MATCH_INTEL_FAM6_MODEL(KABYLAKE_L, &idle_cpu_skl), X86_MATCH_INTEL_FAM6_MODEL(KABYLAKE, &idle_cpu_skl), X86_MATCH_INTEL_FAM6_MODEL(SKYLAKE_X, &idle_cpu_skx), + X86_MATCH_INTEL_FAM6_MODEL(ICELAKE_X, &idle_cpu_icx), X86_MATCH_INTEL_FAM6_MODEL(XEON_PHI_KNL, &idle_cpu_knl), X86_MATCH_INTEL_FAM6_MODEL(XEON_PHI_KNM, &idle_cpu_knl), X86_MATCH_INTEL_FAM6_MODEL(ATOM_GOLDMONT, &idle_cpu_bxt), -- 2.17.1