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-next>] [day] [month] [year] [list]
Message-ID: <20090430145425.GA5974@nowhere>
Date:	Thu, 30 Apr 2009 16:54:26 +0200
From:	Frederic Weisbecker <fweisbec@...il.com>
To:	Ingo Molnar <mingo@...e.hu>
Cc:	KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>,
	Oleg Nesterov <oleg@...hat.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Steven Rostedt <rostedt@...dmis.org>,
	Zhao Lei <zhaolei@...fujitsu.com>,
	LKML <linux-kernel@...r.kernel.org>
Subject: [PATCH] [GIT PULL] tracing/workqueue: fix 32 bits unfriendly 64
	bits division

Hi Ingo,

Here is a fix for the build error you reported.
This branch can be pulled independantly or on top of tracing/workqueue
from the previous pull-request.

Thanks.


The following changes since commit 10c494ea1b75f96d5fca78178732d79e68129cc0:
  Frederic Weisbecker (1):
        tracing/workqueue: fix 32 bits unfriendly 64 bits division

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing.git tracing/workqueue-2

---

>From 10c494ea1b75f96d5fca78178732d79e68129cc0 Mon Sep 17 00:00:00 2001
From: Frederic Weisbecker <fweisbec@...il.com>
Date: Thu, 30 Apr 2009 16:07:59 +0200
Subject: [PATCH] tracing/workqueue: fix 32 bits unfriendly 64 bits division

To get the average of time consumed by each worklets, we do
a direct 64 bits division on wfstat->total_time. This is fine
on a 64 bits arch but not on a 32 one on which we can get the
following warning:

kernel/built-in.o: In function `workqueue_stat_show':
trace_workqueue.c:(.text+0x74f57): undefined reference to `__udivdi3'

We must use do_div() here to ensure the division is supported on
every archs.

[ Impact: fix a build error on 32 bits archs ]

Reported-by: Ingo Molnar <mingo@...e.hu>
Signed-off-by: Frederic Weisbecker <fweisbec@...il.com>
---
 kernel/trace/trace_workqueue.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/kernel/trace/trace_workqueue.c b/kernel/trace/trace_workqueue.c
index eafb4a5..c67be60 100644
--- a/kernel/trace/trace_workqueue.c
+++ b/kernel/trace/trace_workqueue.c
@@ -399,13 +399,22 @@ static int workqueue_stat_show(struct seq_file *s, void *p)
 	} else {
 		/* It is effect node, need to print workfunc info */
 		int lastwf = list_is_last(&wfstat->list, &cws->workfunclist);
+		unsigned long long avg_time;
+
+		if (wfstat->executed) {
+			avg_time = wfstat->total_time;
+			do_div(avg_time, wfstat->executed);
+			avg_time = ns2usecs(avg_time);
+		} else {
+			avg_time = 0;
+		}
+
 		seq_printf(s, "  %3d   %6d   %6u   %6llu   %6llu   %c-%pF\n",
 			cws->cpu,
 			wfstat->inserted,
 			wfstat->executed,
 			ns2usecs(wfstat->max_executed_time),
-			!wfstat->executed ? 0 :
-				ns2usecs(wfstat->total_time / wfstat->executed),
+			avg_time,
 			lastwf ? '`' : '|',
 			wfstat->func);
 	}
-- 
1.6.2.3


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