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>] [day] [month] [year] [list]
Date:   Tue, 24 Aug 2021 12:42:52 -0300
From:   Marcelo Tosatti <mtosatti@...hat.com>
To:     linux-kernel@...r.kernel.org
Cc:     Nitesh Narayan Lal <nitesh@...hat.com>,
        Nicolas Saenz Julienne <nsaenzju@...hat.com>,
        Juri Lelli <juri.lelli@...hat.com>,
        Frederic Weisbecker <frederic@...nel.org>,
        Peter Zijlstra <peterz@...radead.org>,
        Christoph Lameter <cl@...two.de>,
        Thomas Gleixner <tglx@...utronix.de>
Subject: rt-tests: add task isolation activation to cyclictest/oslat


Check whether task isolation is configured, right before the latency
sensitive loop, and if so, activate it.

Use chisol util-linux tool to configure task isolation externally.

Signed-off-by: Marcelo Tosatti <mtosatti@...hat.com>

Index: rt-tests/src/cyclictest/cyclictest.c
===================================================================
--- rt-tests.orig/src/cyclictest/cyclictest.c
+++ rt-tests/src/cyclictest/cyclictest.c
@@ -509,7 +509,7 @@ static void *timerthread(void *param)
 	struct itimerval itimer;
 	struct itimerspec tspec;
 	struct thread_stat *stat = par->stats;
-	int stopped = 0;
+	int ret, stopped = 0;
 	cpu_set_t mask;
 	pthread_t thread;
 	unsigned long smi_now, smi_old = 0;
@@ -617,11 +617,21 @@ static void *timerthread(void *param)
 
 	stat->threadstarted++;
 
+#ifdef PR_ISOL_GET
+        ret = prctl(PR_ISOL_GET, 0, 0, 0, 0);
+        if (ret != -1) {
+                unsigned long mask = ret;
+
+                ret = prctl(PR_ISOL_CTRL_SET, mask, 0, 0);
+                if (ret == -1)
+                        fatal("prctl PR_ISOL_CTRL_SET");
+        }
+#endif
 	while (!shutdown) {
 
 		uint64_t diff;
 		unsigned long diff_smi = 0;
-		int sigs, ret;
+		int sigs;
 
 		/* Wait for next period */
 		switch (par->mode) {
@@ -769,6 +779,12 @@ static void *timerthread(void *param)
 	}
 
 out:
+#ifdef PR_ISOL_GET
+	ret = prctl(PR_ISOL_CTRL_SET, 0, 0, 0);
+	if (ret == -1)
+		fatal("prctl PR_ISOL_CTRL_SET");
+#endif
+
 	if (refresh_on_max) {
 		pthread_mutex_lock(&refresh_on_max_lock);
 		/* We could reach here with both shutdown and allstopped unset (0).
Index: rt-tests/src/oslat/oslat.c
===================================================================
--- rt-tests.orig/src/oslat/oslat.c
+++ rt-tests/src/oslat/oslat.c
@@ -351,9 +351,21 @@ static void insert_bucket(struct thread
 
 static void doit(struct thread *t)
 {
+#ifdef PR_ISOL_GET
+	int ret;
+#endif
 	stamp_t ts1, ts2;
 	workload_fn workload_fn = g.workload->w_fn;
 
+#ifdef PR_ISOL_GET
+	ret = prctl(PR_ISOL_GET, 0, 0, 0, 0);
+	if (ret != -1) {
+		unsigned long mask = ret;
+
+		TEST0(prctl(PR_ISOL_CTRL_SET, mask, 0, 0, 0));
+	}
+#endif
+
 	frc(&ts2);
 	do {
 		workload_fn(t->dst_buf, t->src_buf, g.workload_mem_size);
@@ -361,6 +373,10 @@ static void doit(struct thread *t)
 		insert_bucket(t, ts1 - ts2);
 		ts2 = ts1;
 	} while (g.cmd == GO);
+
+#ifdef PR_ISOL_GET
+	TEST0(prctl(PR_ISOL_CTRL_SET, 0, 0, 0, 0));
+#endif
 }
 
 static int set_fifo_prio(int prio)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ