From patchwork Tue Jul 30 13:54:28 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 18669 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f199.google.com (mail-ve0-f199.google.com [209.85.128.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7E66E248E6 for ; Tue, 30 Jul 2013 13:54:31 +0000 (UTC) Received: by mail-ve0-f199.google.com with SMTP id m1sf5619111ves.6 for ; Tue, 30 Jul 2013 06:54:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-beenthere:x-forwarded-to:x-forwarded-for :delivered-to:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=BlCKPG8s4dylx86DbSDUDZYVSkRjJ0heedj7pbjhBmU=; b=W8VOHfr3H73WJWJkE2UKJQ3CFJAGoikDecKTd+4TY0HSnYRnTeLlZDznVKJqRuaX3W EwPffluYxWWwpZgCjbwCM/kTs5/5sGJwjR08cUnTp3tm+m2vFoB+xGGaK5fNKxqFrsiZ zT041azOFIzz4itTg4aLVv7EcLx0hB7tJDBd/kBjzHDY2XEwjuWxKNTPQBww4+IlkrqC q+R5OaLisKo0ICMH76QQ/Vvm7RzQH3xMVqDc4i1RuCKXUV8WX7wd/AxgDkbTfUi6EuwV K6uonbnuwBLWt6QVzgsMXbdLby6f94t1OEFVCAKppqSowPFeY8opXXOlbD+hxRRmL1hR x/VQ== X-Received: by 10.236.153.202 with SMTP id f50mr31655718yhk.48.1375192471162; Tue, 30 Jul 2013 06:54:31 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.84.170 with SMTP id a10ls218467qez.20.gmail; Tue, 30 Jul 2013 06:54:31 -0700 (PDT) X-Received: by 10.52.106.199 with SMTP id gw7mr17314146vdb.99.1375192470857; Tue, 30 Jul 2013 06:54:30 -0700 (PDT) Received: from mail-vb0-f42.google.com (mail-vb0-f42.google.com [209.85.212.42]) by mx.google.com with ESMTPS id dc8si3454981vdc.122.2013.07.30.06.54.30 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 30 Jul 2013 06:54:30 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.42 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.42; Received: by mail-vb0-f42.google.com with SMTP id e12so1759261vbg.29 for ; Tue, 30 Jul 2013 06:54:30 -0700 (PDT) X-Received: by 10.52.160.197 with SMTP id xm5mr5618261vdb.48.1375192470686; Tue, 30 Jul 2013 06:54:30 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.221.11.8 with SMTP id pc8csp177470vcb; Tue, 30 Jul 2013 06:54:30 -0700 (PDT) X-Received: by 10.180.20.228 with SMTP id q4mr1130822wie.1.1375192469548; Tue, 30 Jul 2013 06:54:29 -0700 (PDT) Received: from mail-we0-f181.google.com (mail-we0-f181.google.com [74.125.82.181]) by mx.google.com with ESMTPS id w1si30103575wjw.83.2013.07.30.06.54.29 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 30 Jul 2013 06:54:29 -0700 (PDT) Received-SPF: neutral (google.com: 74.125.82.181 is neither permitted nor denied by best guess record for domain of daniel.lezcano@linaro.org) client-ip=74.125.82.181; Received: by mail-we0-f181.google.com with SMTP id p58so5078332wes.40 for ; Tue, 30 Jul 2013 06:54:29 -0700 (PDT) X-Received: by 10.194.63.46 with SMTP id d14mr47458792wjs.81.1375192469003; Tue, 30 Jul 2013 06:54:29 -0700 (PDT) Received: from mai.home (AToulouse-654-1-378-11.w86-199.abo.wanadoo.fr. [86.199.233.11]) by mx.google.com with ESMTPSA id r6sm6026572wiw.0.2013.07.30.06.54.27 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 30 Jul 2013 06:54:28 -0700 (PDT) From: Daniel Lezcano To: rjw@sisk.pl, lenb@kernel.org Cc: linux-pm@vger.kernel.org, patches@linaro.org, linaro-kernel@lists.linaro.org Subject: [PATCH 2/2] x86: cpuidle: remove broadcast timer initialization Date: Tue, 30 Jul 2013 15:54:28 +0200 Message-Id: <1375192468-2255-2-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1375192468-2255-1-git-send-email-daniel.lezcano@linaro.org> References: <1375192468-2255-1-git-send-email-daniel.lezcano@linaro.org> X-Gm-Message-State: ALoCoQk4Buo/GCWrXEBbnmDMlNQ6MjFQCuhvwlJ8dJ/IQXZGxgibdJCDS9/LILL3lRzTRKq9TN4L X-Original-Sender: daniel.lezcano@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.42 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Commit 89878baa73f0f1c679355006bd8632e5d78f96c2 introduced the flag CPUIDLE_FLAG_TIMER_STOP where we specify a specific idle state stops the local timer. Commit a06df062a189a8d5588babb8bf0bb78672497798 introduced the initialization of the timer broadcast framework depending of the flag presence. We have now a way to set a flag for a specific state to tell if the local timer will be down in deep idle state or not and we have cpu hotplug support to setup the broadcast timer. Remove the timer broadcast initialization from init and at the cpu hotplug time. Remove the timer broadcast activation in the idle loop. Remove the bitmap LAPIC_TIMER_ALWAYS_RELIABLE. Set the CPUIDLE_FLAG_TIMER_STOP on the states when they are greater than C1 and the cpu has not X86_FEATURE_ARAT. Signed-off-by: Daniel Lezcano --- drivers/idle/intel_idle.c | 41 ++++------------------------------------- 1 file changed, 4 insertions(+), 37 deletions(-) diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c index fa6964d..a975868 100644 --- a/drivers/idle/intel_idle.c +++ b/drivers/idle/intel_idle.c @@ -55,7 +55,6 @@ #include #include -#include #include #include #include @@ -77,10 +76,6 @@ static int max_cstate = CPUIDLE_STATE_MAX - 1; static unsigned int mwait_substates; -#define LAPIC_TIMER_ALWAYS_RELIABLE 0xFFFFFFFF -/* Reliable LAPIC Timer States, bit 1 for C1 etc. */ -static unsigned int lapic_timer_reliable_states = (1 << 1); /* Default to only C1 */ - struct idle_cpu { struct cpuidle_state *state_table; @@ -356,9 +351,6 @@ static int intel_idle(struct cpuidle_device *dev, if (state->flags & CPUIDLE_FLAG_TLB_FLUSHED) leave_mm(cpu); - if (!(lapic_timer_reliable_states & (1 << (cstate)))) - clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &cpu); - if (!need_resched()) { __monitor((void *)¤t_thread_info()->flags, 0, 0); @@ -367,23 +359,9 @@ static int intel_idle(struct cpuidle_device *dev, __mwait(eax, ecx); } - if (!(lapic_timer_reliable_states & (1 << (cstate)))) - clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &cpu); - return index; } -static void __setup_broadcast_timer(void *arg) -{ - unsigned long reason = (unsigned long)arg; - int cpu = smp_processor_id(); - - reason = reason ? - CLOCK_EVT_NOTIFY_BROADCAST_ON : CLOCK_EVT_NOTIFY_BROADCAST_OFF; - - clockevents_notify(reason, &cpu); -} - static int cpu_hotplug_notify(struct notifier_block *n, unsigned long action, void *hcpu) { @@ -393,10 +371,6 @@ static int cpu_hotplug_notify(struct notifier_block *n, switch (action & 0xf) { case CPU_ONLINE: - if (lapic_timer_reliable_states != LAPIC_TIMER_ALWAYS_RELIABLE) - smp_call_function_single(hotcpu, __setup_broadcast_timer, - (void *)true, 1); - /* * Some systems can hotplug a cpu at runtime after * the kernel has booted, we have to initialize the @@ -524,16 +498,9 @@ static int intel_idle_probe(void) icpu = (const struct idle_cpu *)id->driver_data; cpuidle_state_table = icpu->state_table; - if (boot_cpu_has(X86_FEATURE_ARAT)) /* Always Reliable APIC Timer */ - lapic_timer_reliable_states = LAPIC_TIMER_ALWAYS_RELIABLE; - else - on_each_cpu(__setup_broadcast_timer, (void *)true, 1); - pr_debug(PREFIX "v" INTEL_IDLE_VERSION " model 0x%X\n", boot_cpu_data.x86_model); - pr_debug(PREFIX "lapic_timer_reliable_states 0x%x\n", - lapic_timer_reliable_states); return 0; } @@ -594,6 +561,10 @@ static int intel_idle_cpuidle_driver_init(void) mark_tsc_unstable("TSC halts in idle" " states deeper than C2"); + if (cstate > 1 && !boot_cpu_has(X86_FEATURE_ARAT)) + cpuidle_state_table[cstate].flags |= + CPUIDLE_FLAG_TIMER_STOP; + drv->states[drv->state_count] = /* structure copy */ cpuidle_state_table[cstate]; @@ -705,10 +676,6 @@ static void __exit intel_idle_exit(void) { intel_idle_cpuidle_devices_uninit(); cpuidle_unregister_driver(&intel_idle_driver); - - - if (lapic_timer_reliable_states != LAPIC_TIMER_ALWAYS_RELIABLE) - on_each_cpu(__setup_broadcast_timer, (void *)false, 1); unregister_cpu_notifier(&cpu_hotplug_notifier); return;