Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp235910ybt; Thu, 9 Jul 2020 21:11:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy9nsI16FlWIOG8qTv29w21C6UoIX9lEO3IV8Om7rKILo5X0fLn2kuvLOzY1L8zS97E1AtF X-Received: by 2002:a17:906:2b50:: with SMTP id b16mr62088170ejg.410.1594354314216; Thu, 09 Jul 2020 21:11:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594354314; cv=none; d=google.com; s=arc-20160816; b=uis0xdXLSgS/BsIQo6g4NQVq0qBoJqYQ0D0GhvXOKM7bNum00CVLlAd5h8wRcjTczm RYdHfk1yZqH9jEh7UddSy0DiPy0LxOdItnv00lGzGI89PSjOEcg+gRyvm9FY1c8vIOAU uTsV11RYRR1Y/BrhWxkJURdEX8qHAY+1kkFOGazdv3FiQsb+I56XVgnEH42DPNh1Xjr7 +R6s3yM1rL18pnRRvcs+obKQ1u3ZEGaKAGBT2OvFE/33iRZ5mgQpiUhLPXOJGNQSaLBE eoEgwZ0j+ySXedJoZyIFkqhSSMQP27Wz97r+K2778pdmXH9Lj7J0gdekYzstBXpL24kP gARw== 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=zTMrx8SS7jmr1mHuqhLiGcbFnoA4pSIaeQXwGOgOH2I=; b=PG9hYLK7qkc1+Z+WedjTZnEnhQPM5IuVRtW2/DZuBTeTq8j9XRZ3KtsEllqHLS/mbf 3ir55irnrPvk94MeeQP1t6fiRrRKyHYPUX7vX98wFhdvCqZS0475QcwBW080EskcSqKA yIgTXAqvKB8TuvVoN6IiHnLA2AdrkT2jF3qpK/uq/ythLi1AEgrw/fa7BxJPtxZa+YT4 V7MPZg6cUg0BZ0Cg5IDrRhP2TavZFQwU2qIDu0ERUvTrPE6wAkI7StqfT9+cpqrto842 Mw1JUcK/Qe1dLW29qGZprAAbUWQIwglMSZCJdCf/sbqNBlBbePzX6p1wTpXpJBKqgoP5 UHrw== 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 hk1si3036990ejb.497.2020.07.09.21.11.17; Thu, 09 Jul 2020 21:11:54 -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 S1725966AbgGJELG (ORCPT + 99 others); Fri, 10 Jul 2020 00:11:06 -0400 Received: from mga18.intel.com ([134.134.136.126]:48310 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725777AbgGJELF (ORCPT ); Fri, 10 Jul 2020 00:11:05 -0400 IronPort-SDR: zthha9ddH52MsCsaeheEjUVTGXHBiHwoBCYKHae8iiNM4x+lLZaAAqWg0hwj6ZOED+Rfoz1CLq WE8g66mFQ3SQ== X-IronPort-AV: E=McAfee;i="6000,8403,9677"; a="135611521" X-IronPort-AV: E=Sophos;i="5.75,334,1589266800"; d="scan'208";a="135611521" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jul 2020 21:11:05 -0700 IronPort-SDR: O8JSIaYP8xEdErt152VGO90GCWM6m1o5mEKemJL0bHREATm5oBf16JEQe97HEdZ2/CohI0VM5z qXbRCTstSjIA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,334,1589266800"; d="scan'208";a="389362043" Received: from chenyu-office.sh.intel.com ([10.239.158.173]) by fmsmga001.fm.intel.com with ESMTP; 09 Jul 2020 21:11:02 -0700 From: Chen Yu To: Len Brown , "Rafael J . Wysocki" Cc: Zhang Rui , Artem Bityutskiy , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Chen Yu , Len Brown Subject: [PATCH][v2] intel_idle: Customize IceLake server support Date: Fri, 10 Jul 2020 12:12:01 +0800 Message-Id: <20200710041201.22390-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. Although this feature does save energy in many cases this might also cause unexpected result. For example, workload might get unstable performance due to the uncertainty of CPU frequency. Besides, the CPU frequency might not be locked to specific level when the CPU utilization is low. 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 we 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. Choose the latter as we need the longest latency in theory. Reported-by: kernel test robot Tested-by: Artem Bityutskiy Acked-by: Artem Bityutskiy Cc: Len Brown Cc: Rafael J. Wysocki Signed-off-by: Zhang Rui Signed-off-by: Chen Yu --- v2: Minor commit message refinement for better understanding. -- 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