mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Sudeep Holla <sudeep.holla@arm.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Ingo Molnar <mingo@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Preeti U Murthy <preeti@linux.vnet.ibm.com>,
	Suzuki Poulose <Suzuki.Poulose@arm.com>,
	Lorenzo Pieralisi <Lorenzo.Pieralisi@arm.com>,
	Catalin Marinas <Catalin.Marinas@arm.com>,
	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
Subject: Re: [patch 1/2] tick/broadcast: Prevent deep idle states if no broadcast device available
Date: Mon, 6 Jul 2015 18:53:28 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.11.1507061838160.3916@nanos> (raw)
In-Reply-To: <559AAC73.6010105@arm.com>

On Mon, 6 Jul 2015, Sudeep Holla wrote:
> On 06/07/15 17:06, Thomas Gleixner wrote:
> 2. After boot I am seeing the below warning:
> 
> ------------[ cut here ]------------
> WARNING: CPU: 1 PID: 0 at kernel/time/hrtimer.c:1247 
> __hrtimer_run_queues+0x148/0x150()
> Modules linked in:
> CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.2.0-rc1 #573
> Hardware name: ARM Juno development board (r0) (DT)
> Call trace:
> [<ffffffc000089954>] dump_backtrace+0x0/0x124
> [<ffffffc000089a88>] show_stack+0x10/0x1c
> [<ffffffc0005d100c>] dump_stack+0x84/0xc8
> [<ffffffc0000b3f34>] warn_slowpath_common+0x98/0xd0
> [<ffffffc0000b402c>] warn_slowpath_null+0x14/0x20
> [<ffffffc000101eec>] __hrtimer_run_queues+0x144/0x150
> [<ffffffc0001028b4>] hrtimer_run_queues+0xb8/0xe8
> [<ffffffc000101714>] update_process_times+0x28/0x6c
> [<ffffffc00010d978>] tick_periodic+0x3c/0xb8
> [<ffffffc00010da1c>] tick_handle_periodic+0x28/0x94
> [<ffffffc0004d6154>] arch_timer_handler_phys+0x28/0x38
> [<ffffffc0000f5964>] handle_percpu_devid_irq+0x74/0x9c
> [<ffffffc0000f1668>] generic_handle_irq+0x30/0x4c
> [<ffffffc0000f1984>] __handle_domain_irq+0x5c/0xac
> [<ffffffc0000824a8>] gic_handle_irq+0x30/0x80

Bah. I fear Preeti's hrtimer-broadcast stuff recurses in the hrtimer
code.

tick_periodic()
  expire broadcast timer()
    handle_broadcast() {
      tick_periodic()
	 expire_other_timer()
    }

  warning triggers	 

Crap. Patch below should cure that.

Thanks,

	tglx
---
Index: tip/kernel/time/tick-broadcast.c
===================================================================
--- tip.orig/kernel/time/tick-broadcast.c
+++ tip/kernel/time/tick-broadcast.c
@@ -358,18 +358,21 @@ void tick_broadcast_control(enum tick_br
 		tick_broadcast_forced = 1;
 	case TICK_BROADCAST_ON:
 		cpumask_set_cpu(cpu, tick_broadcast_on);
-		if (!cpumask_test_and_set_cpu(cpu, tick_broadcast_mask)) {
-			/*
-			 * Only shutdown the cpu local device, if the
-			 * broadcast device exists and is in periodic
-			 * mode. The latter check prevents a hickup
-			 * during the switch from periodic to oneshot
-			 * mode.
-			 */
-			if (bc != NULL && tick_broadcast_device.mode ==
-			    TICKDEV_MODE_PERIODIC)
-				clockevents_shutdown(dev);
-		}
+
+		/*
+		 * Only shutdown the cpu local device, if:
+		 *
+		 * - the broadcast device exists
+		 * - the broadcast device is not a hrtimer based one
+		 * - the broadcast device is in periodic mode to
+		 *   avoid a hickup during switch to oneshot mode
+		 */
+		if (!bc || (bc->features & CLOCK_EVT_FEAT_HRTIMER) ||
+		    tick_broadcast_device.mode != TICKDEV_MODE_PERIODIC)
+			break;
+
+		if (!cpumask_test_and_set_cpu(cpu, tick_broadcast_mask))
+			clockevents_shutdown(dev);
 		break;
 
 	case TICK_BROADCAST_OFF:
@@ -697,14 +700,18 @@ int __tick_broadcast_oneshot_control(enu
 		 * shutdown.
 		 */
 		ret = broadcast_needs_cpu(bc, cpu);
+		if (ret)
+			goto out;
 
 		/*
-		 * If the hrtimer broadcast check tells us that the
-		 * cpu cannot go deep idle, or if the broadcast device
-		 * is in periodic mode, we just return.
+		 * If the broadcast device is in periodic mode, we
+		 * return.
 		 */
-		if (ret || tick_broadcast_device.mode == TICKDEV_MODE_PERIODIC)
-			goto out;
+		if (tick_broadcast_device.mode == TICKDEV_MODE_PERIODIC) {
+			/* If it is a hrtimer based broadcast, return busy */
+			if (bc->features & CLOCK_EVT_FEAT_HRTIMER)
+				ret = -EBUSY;
+		}
 
 		if (!cpumask_test_and_set_cpu(cpu, tick_broadcast_oneshot_mask)) {
 			WARN_ON_ONCE(cpumask_test_cpu(cpu, tick_broadcast_pending_mask));



  reply	other threads:[~2015-07-06 16:53 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-05 20:53 [patch 0/2] tic/broadcast: Plug a few corner cases which cause malfunction Thomas Gleixner
2015-07-05 20:53 ` [patch 1/2] tick/broadcast: Prevent deep idle states if no broadcast device available Thomas Gleixner
2015-07-06 15:09   ` Sudeep Holla
2015-07-06 15:35     ` Thomas Gleixner
2015-07-06 15:44       ` Sudeep Holla
2015-07-06 16:06         ` Thomas Gleixner
2015-07-06 16:27           ` Sudeep Holla
2015-07-06 16:53             ` Thomas Gleixner [this message]
2015-07-06 17:57               ` Sudeep Holla
2015-07-06 19:56                 ` Thomas Gleixner
2015-07-07  7:31                   ` Thomas Gleixner
2015-07-07 11:25                     ` Sudeep Holla
2015-07-07 11:55                       ` Thomas Gleixner
2015-07-07 17:12                     ` [tip:timers/urgent] tick/broadcast: Prevent hrtimer recursion tip-bot for Thomas Gleixner
2015-07-07 17:12                     ` [tip:timers/urgent] tick/broadcast: Sanity check the shutdown of the local clock_event tip-bot for Thomas Gleixner
2015-07-07 17:13                     ` [tip:timers/urgent] tick/broadcast: Make idle check independent from mode and config tip-bot for Thomas Gleixner
2015-07-07 17:13                     ` [tip:timers/urgent] tick/broadcast: Prevent deep idle if no broadcast device available tip-bot for Thomas Gleixner
2015-07-07 17:13                     ` [tip:timers/urgent] tick/broadcast: Move the check for periodic mode inside state handling tip-bot for Thomas Gleixner
2015-07-07 17:14                     ` [tip:timers/urgent] tick/broadcast: Return busy if periodic mode and hrtimer broadcast tip-bot for Thomas Gleixner
2015-07-07 17:14                     ` [tip:timers/urgent] tick/broadcast: Return busy when IPI is pending tip-bot for Thomas Gleixner
2015-07-07 17:14                     ` [tip:timers/urgent] tick/broadcast: Check for hrtimer broadcast active early tip-bot for Thomas Gleixner
2015-07-05 20:53 ` [patch 2/2] tick/broadcast: Handle spurious interrupts gracefully Thomas Gleixner
2015-07-06 15:17   ` Sudeep Holla
2015-07-06 15:36     ` Thomas Gleixner
2015-07-07 17:15   ` [tip:timers/urgent] " tip-bot for Thomas Gleixner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.11.1507061838160.3916@nanos \
    --to=tglx@linutronix.de \
    --cc=Catalin.Marinas@arm.com \
    --cc=Lorenzo.Pieralisi@arm.com \
    --cc=Suzuki.Poulose@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=preeti@linux.vnet.ibm.com \
    --cc=rafael.j.wysocki@intel.com \
    --cc=sudeep.holla@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®