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: <20211027204319.22697-2-paul.gortmaker@windriver.com>
Date:   Wed, 27 Oct 2021 16:43:18 -0400
From:   Paul Gortmaker <paul.gortmaker@...driver.com>
To:     <linux-kernel@...r.kernel.org>
CC:     Paul Gortmaker <paul.gortmaker@...driver.com>,
        Ingo Molnar <mingo@...hat.com>,
        Steven Rostedt <rostedt@...dmis.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Peter Zijlstra <peterz@...radead.org>,
        Josh Triplett <josh@...htriplett.org>,
        "Paul E . McKenney" <paulmck@...nel.org>,
        "Frederic Weisbecker" <frederic@...nel.org>,
        Valentin Schneider <valentin.schneider@....com>
Subject: [PATCH 1/2] sched: isolation: cpu isolation handles for cpuset

Assuming we want to drive isolation from cpuset and not something
like /sys/devices/system/cpu/cpu*/hotplug/isolation then we'll
need some kind of handle for cpuset to drive it from.

These would also serve as a collection point for all the isolation
related operations - current and future.  While only RCU nocb toggle
is currently deployed, I've left some guesses at what is probably to
come in the future.

Cc: Ingo Molnar <mingo@...hat.com>
Cc: Steven Rostedt <rostedt@...dmis.org>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Josh Triplett <josh@...htriplett.org>
Cc: Paul E. McKenney <paulmck@...nel.org>
Cc: Frederic Weisbecker <frederic@...nel.org>
Cc: Valentin Schneider <valentin.schneider@....com>
[PG: RFC code - not for merge]
Signed-off-by: Paul Gortmaker <paul.gortmaker@...driver.com>
---
 include/linux/sched/isolation.h |  4 ++++
 kernel/sched/isolation.c        | 22 ++++++++++++++++++++++
 2 files changed, 26 insertions(+)

diff --git a/include/linux/sched/isolation.h b/include/linux/sched/isolation.h
index cc9f393e2a70..3ab9c667c441 100644
--- a/include/linux/sched/isolation.h
+++ b/include/linux/sched/isolation.h
@@ -25,6 +25,8 @@ extern bool housekeeping_enabled(enum hk_flags flags);
 extern void housekeeping_affine(struct task_struct *t, enum hk_flags flags);
 extern bool housekeeping_test_cpu(int cpu, enum hk_flags flags);
 extern void __init housekeeping_init(void);
+extern void isolate_cpu(int cpu);
+extern void deisolate_cpu(int cpu);
 
 #else
 
@@ -46,6 +48,8 @@ static inline bool housekeeping_enabled(enum hk_flags flags)
 static inline void housekeeping_affine(struct task_struct *t,
 				       enum hk_flags flags) { }
 static inline void housekeeping_init(void) { }
+static void isolate_cpu(int cpu) { }
+static void deisolate_cpu(int cpu) { }
 #endif /* CONFIG_CPU_ISOLATION */
 
 static inline bool housekeeping_cpu(int cpu, enum hk_flags flags)
diff --git a/kernel/sched/isolation.c b/kernel/sched/isolation.c
index 7f06eaf12818..57b105d42632 100644
--- a/kernel/sched/isolation.c
+++ b/kernel/sched/isolation.c
@@ -63,6 +63,28 @@ bool housekeeping_test_cpu(int cpu, enum hk_flags flags)
 }
 EXPORT_SYMBOL_GPL(housekeeping_test_cpu);
 
+void isolate_cpu(int cpu)
+{
+	pr_info("Isolating core %d\n", cpu);
+	if (rcu_nocb_cpu_offload(cpu))
+		pr_warn("RCU; unable to nocb offload CPU %d\n", cpu);
+#if 0	/* TODO */
+	housekeeping_clear_cpu(cpu);
+	tick_nohz_full_add_cpus_to(cpumask_of(cpu));
+#endif
+}
+
+void deisolate_cpu(int cpu)
+{
+	pr_info("Deisolating core %d\n", cpu);
+#if 0	/* TODO */
+	tick_nohz_full_clear_cpus_from(cpumask_of(cpu));
+	housekeeping_add_cpu(cpu);
+#endif
+	if (rcu_nocb_cpu_deoffload(cpu))
+		pr_warn("RCU: unable to nocb reload CPU %d\n", cpu);
+}
+
 void __init housekeeping_init(void)
 {
 	if (!housekeeping_flags)
-- 
2.15.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ