projects
/
lttv.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
update
[lttv.git]
/
tests
/
kernel
/
test-tsc-sync.c
diff --git
a/tests/kernel/test-tsc-sync.c
b/tests/kernel/test-tsc-sync.c
index 5ca7e57e9e27391467d060b65f40aa8b3da7cc87..14cd008b3c59372acad35148ad88fa706bbbe79f 100644
(file)
--- a/
tests/kernel/test-tsc-sync.c
+++ b/
tests/kernel/test-tsc-sync.c
@@
-13,18
+13,29
@@
static DEFINE_PER_CPU(cycles_t, count) = 0;
static struct timer_list test_timer;
static struct timer_list test_timer;
+static atomic_t kernel_threads_to_run;
+
+
/* IPI called on each CPU. */
static void test_each(void *info)
{
/* IPI called on each CPU. */
static void test_each(void *info)
{
- __get_cpu_var(count) = get_cycles();
+ unsigned long flags;
+ local_irq_save(flags);
+ atomic_dec(&kernel_threads_to_run);
+ while(atomic_read(&kernel_threads_to_run))
+ cpu_relax();
+ __get_cpu_var(count) = get_cycles_sync();
+ local_irq_restore(flags);
}
static void do_test_timer(unsigned long data)
{
int cpu;
}
static void do_test_timer(unsigned long data)
{
int cpu;
- /* Increment the counters */
- on_each_cpu(test_each, NULL, 0, 1);
+ atomic_set(&kernel_threads_to_run, num_online_cpus());
+
+ smp_call_function(test_each, NULL, 0, 0);
+ test_each(NULL);
/* Read all the counters */
printk("Counters read from CPU %d\n", smp_processor_id());
for_each_online_cpu(cpu) {
/* Read all the counters */
printk("Counters read from CPU %d\n", smp_processor_id());
for_each_online_cpu(cpu) {
This page took
0.024442 seconds
and
4
git commands to generate.