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: <1299970786-8075-3-git-send-email-jolsa@redhat.com>
Date:	Sat, 12 Mar 2011 23:59:46 +0100
From:	Jiri Olsa <jolsa@...hat.com>
To:	rostedt@...dmis.org, fweisbec@...il.com, mingo@...hat.com
Cc:	linux-kernel@...r.kernel.org, oleg@...hat.com,
	Jiri Olsa <jolsa@...hat.com>
Subject: [PATCH 2/2] tracing - putting cond_resched into tace_pipe loop

Adding cond_resched call to the tracing_read_pipe while loop.
Plus check for signal to leave the loop.

This will protect us from soft lockup on NON preemptive kernels
and improve latency.

Thanks a lot to Oleg Nestorov for helping me to nail this down.

wbr,
jirka


Signed-off-by: Jiri Olsa <jolsa@...hat.com>
---
 kernel/trace/trace.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 20d84f8..7d66476 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -3237,10 +3237,23 @@ waitagain:
 		 * One of the trace_seq_* functions is not used properly.
 		 */
 		WARN_ON(iter->seq.full);
+
+		/*
+		 * There's a chance this loop might get quite tight,
+		 * causing latency in non preemptive kernel.
+		 */
+		cond_resched();
+		if (signal_pending(current)) {
+			sret = -EINTR;
+			break;
+		}
 	}
 	trace_access_unlock(iter->cpu_file);
 	trace_event_read_unlock();
 
+	if (sret == -EINTR)
+		goto out;
+
 	/* Now copy what we have to the user */
 	sret = trace_seq_to_user(&iter->seq, ubuf, cnt);
 	if (iter->seq.readpos >= iter->seq.len)
-- 
1.7.1

--
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