From patchwork Thu Mar 13 17:36:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: dirk.brandewie@gmail.com X-Patchwork-Id: 3827661 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B38899F369 for ; Thu, 13 Mar 2014 17:36:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D28E6201B6 for ; Thu, 13 Mar 2014 17:36:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 021C120173 for ; Thu, 13 Mar 2014 17:36:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754743AbaCMRgp (ORCPT ); Thu, 13 Mar 2014 13:36:45 -0400 Received: from mail-pb0-f45.google.com ([209.85.160.45]:65162 "EHLO mail-pb0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754266AbaCMRgZ (ORCPT ); Thu, 13 Mar 2014 13:36:25 -0400 Received: by mail-pb0-f45.google.com with SMTP id uo5so1419432pbc.18 for ; Thu, 13 Mar 2014 10:36:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=7pzD5FWCN6JMgj43G5zkCK8ur0M3dazEg0zp6TgapJg=; b=O7bFqvAW+DtgjzB65LVx/XXq+6VZD9kqlYqyBNbCl0Q10CVbN2HfvnLb8YFWN1xkY5 ihIX8umnPpQ2zoQmuZ4RPffewGCCihpYu9ArSpfXHvU849uS9rfibTDawhOUEtVUbUZY B+6wRmbN5TGI3NvazfAlHvRWUL8r0Sqkko3uZipw4yjVbc3f3SSwWIX9oA2hIl3ro1/4 +cb5zhFek920KJ5sWgakjZ5Y8KYMqL3q6m1205nwbPgXe1hWNReja8lIu5tdnpCCUV1K MwJz2Avagdh/F33g7sdf0gzBi4Qxx8MSO11KTI6k507usUl+Z0vjwPhtDeXAyPQ1YPrQ pQ9w== X-Received: by 10.67.14.231 with SMTP id fj7mr3685871pad.115.1394732185208; Thu, 13 Mar 2014 10:36:25 -0700 (PDT) Received: from echolake.localdomain (static-50-43-42-35.bvtn.or.frontiernet.net. [50.43.42.35]) by mx.google.com with ESMTPSA id tu3sm12946015pab.1.2014.03.13.10.36.23 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Mar 2014 10:36:24 -0700 (PDT) From: dirk.brandewie@gmail.com To: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org, rjw@rjwysocki.net, patrick.marlier@gmail.com, dirk.brandewie@gmail.com, Dirk Brandewie Subject: [PATCH 2/2] intel_pstate: Set core to min P state during core offline Date: Thu, 13 Mar 2014 10:36:08 -0700 Message-Id: <1394732168-12638-3-git-send-email-dirk.j.brandewie@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1394732168-12638-1-git-send-email-dirk.j.brandewie@intel.com> References: <1394732168-12638-1-git-send-email-dirk.j.brandewie@intel.com> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Dirk Brandewie Change to use ->exit_prepare() callback to do clean up during CPU hotplug. The requested P state for an offline core will be used by the hardware coordination function to select the package P state. If the core is under load when it is offlined it will fix the package P state floor to the requested P state of offline core. Reported-by: Patrick Marlier Signed-off-by: Dirk Brandewie --- drivers/cpufreq/intel_pstate.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index 2cd36b9..fe32a8c 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c @@ -447,7 +447,7 @@ static void core_set_pstate(struct cpudata *cpudata, int pstate) if (limits.no_turbo) val |= (u64)1 << 32; - wrmsrl(MSR_IA32_PERF_CTL, val); + wrmsrl_on_cpu(cpudata->cpu, MSR_IA32_PERF_CTL, val); } static struct cpu_defaults core_params = { @@ -773,16 +773,22 @@ static int intel_pstate_verify_policy(struct cpufreq_policy *policy) return 0; } -static int intel_pstate_cpu_exit(struct cpufreq_policy *policy) +static int intel_pstate_cpu_exit_prepare(struct cpufreq_policy *policy) { - int cpu = policy->cpu; + int cpu_num = policy->cpu; + struct cpudata *cpu = all_cpu_data[cpu_num]; + + pr_info("intel_pstate CPU %d exiting\n", cpu_num); + + del_timer(&all_cpu_data[cpu_num]->timer); + intel_pstate_set_pstate(cpu, cpu->pstate.min_pstate); + kfree(all_cpu_data[cpu_num]); + all_cpu_data[cpu_num] = NULL; - del_timer(&all_cpu_data[cpu]->timer); - kfree(all_cpu_data[cpu]); - all_cpu_data[cpu] = NULL; return 0; } + static int intel_pstate_cpu_init(struct cpufreq_policy *policy) { struct cpudata *cpu; @@ -818,7 +824,7 @@ static struct cpufreq_driver intel_pstate_driver = { .setpolicy = intel_pstate_set_policy, .get = intel_pstate_get, .init = intel_pstate_cpu_init, - .exit = intel_pstate_cpu_exit, + .exit_prepare = intel_pstate_cpu_exit_prepare, .name = "intel_pstate", };