lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1381511957-29776-3-git-send-email-morten.rasmussen@arm.com>
Date:	Fri, 11 Oct 2013 18:19:12 +0100
From:	Morten Rasmussen <morten.rasmussen@....com>
To:	mingo@...nel.org, peterz@...radead.org
Cc:	pjt@...gle.com, arjan@...ux.intel.com, rjw@...k.pl,
	dirk.j.brandewie@...el.com, vincent.guittot@...aro.org,
	alex.shi@...aro.org, preeti@...ux.vnet.ibm.com, efault@....de,
	corbet@....net, tglx@...utronix.de, catalin.marinas@....com,
	morten.rasmussen@....com, linux-kernel@...r.kernel.org,
	linaro-kernel@...ts.linaro.org
Subject: [RFC][PATCH 2/7] sched: power: Power driver late callback interface

Adds a late callback to the power driver interface which is called
with irq enabled and no locks held. The power driver may postpone
work that can't be done in schedule context (irq disabled and rq
locks held) and let the late callback handle it.

Signed-off-by: Morten Rasmussen <morten.rasmussen@....com>
---
 include/linux/sched/power.h |    3 +++
 kernel/sched/core.c         |    1 +
 kernel/sched/fair.c         |    2 ++
 kernel/sched/power.c        |    6 ++++++
 kernel/sched/sched.h        |    8 ++++++++
 5 files changed, 20 insertions(+)

diff --git a/include/linux/sched/power.h b/include/linux/sched/power.h
index cb2cf37..aba5f47 100644
--- a/include/linux/sched/power.h
+++ b/include/linux/sched/power.h
@@ -25,6 +25,9 @@ struct power_driver {
 	int (*go_faster)	(int cpu, int hint);
 	/* Decrease cpu capacity hint */
 	int (*go_slower)	(int cpu, int hint);
+
+	/* Scheduler call-back without rq lock held and with irq enabled */
+	void (*late_callback)	(int cpu);
 };
 
 int power_driver_register(struct power_driver *driver);
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 05c39f0..12b4753 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -1913,6 +1913,7 @@ static void finish_task_switch(struct rq *rq, struct task_struct *prev)
 		put_task_struct(prev);
 	}
 
+	power_late_callback(raw_smp_processor_id());
 	tick_nohz_task_switch(current);
 }
 
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 68f1609..edba1bb 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -5742,6 +5742,8 @@ static void run_rebalance_domains(struct softirq_action *h)
 	 * stopped.
 	 */
 	nohz_idle_balance(this_cpu, idle);
+
+	power_late_callback(this_cpu);
 }
 
 static inline int on_null_domain(int cpu)
diff --git a/kernel/sched/power.c b/kernel/sched/power.c
index b82965a..f70b563 100644
--- a/kernel/sched/power.c
+++ b/kernel/sched/power.c
@@ -56,3 +56,9 @@ int go_slower(int cpu, int hint)
 	return power_driver->go_slower(cpu, hint);
 }
 
+void power_late_callback(int cpu)
+{
+	if (!power_driver)
+		return;
+	power_driver->late_callback(cpu);
+}
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index ef0a7b2..907a967 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -1364,3 +1364,11 @@ static inline u64 irq_time_read(int cpu)
 }
 #endif /* CONFIG_64BIT */
 #endif /* CONFIG_IRQ_TIME_ACCOUNTING */
+
+#ifdef CONFIG_SCHED_POWER
+extern void power_late_callback(int cpu);
+#else
+static inline void power_late_callback(int cpu)
+{
+}
+#endif /* CONFIG_SCHED_POWER */
-- 
1.7.9.5


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ