Lines Matching +full:smp +full:- +full:offset
1 // SPDX-License-Identifier: GPL-2.0
3 * Smp timebase synchronization for ppc.
11 #include <linux/smp.h>
15 #include <asm/smp.h>
42 tbsync->race_result = add; in enter_contest()
57 tbsync->ack = 1; in smp_generic_take_timebase()
58 while (!tbsync->handshake) in smp_generic_take_timebase()
62 cmd = tbsync->cmd; in smp_generic_take_timebase()
63 tb = tbsync->tb; in smp_generic_take_timebase()
65 tbsync->ack = 0; in smp_generic_take_timebase()
69 while (tbsync->handshake) in smp_generic_take_timebase()
73 enter_contest(tbsync->mark, -1); in smp_generic_take_timebase()
78 static int start_contest(int cmd, long offset, int num) in start_contest() argument
84 tbsync->cmd = cmd; in start_contest()
87 for (i = -3; i < num; ) { in start_contest()
89 tbsync->tb = tb + offset; in start_contest()
90 tbsync->mark = mark = tb + 400; in start_contest()
94 tbsync->handshake = 1; in start_contest()
95 while (tbsync->ack) in start_contest()
100 tbsync->handshake = 0; in start_contest()
103 while (!tbsync->ack) in start_contest()
107 score += tbsync->race_result; in start_contest()
115 int i, score, score2, old, min=0, max=5000, offset=1000; in smp_generic_give_timebase() local
124 while (!tbsync->ack) in smp_generic_give_timebase()
130 for (old = -1; old != offset ; offset = (min+max) / 2) { in smp_generic_give_timebase()
131 score = start_contest(kSetAndTest, offset, NUM_ITER); in smp_generic_give_timebase()
133 pr_debug("score %d, offset %d\n", score, offset ); in smp_generic_give_timebase()
136 max = offset; in smp_generic_give_timebase()
138 min = offset; in smp_generic_give_timebase()
139 old = offset; in smp_generic_give_timebase()
148 offset = (score < score2) ? min : max; in smp_generic_give_timebase()
152 start_contest(kSetAndTest, offset, NUM_ITER/10); in smp_generic_give_timebase()
154 if ((score2 = start_contest(kTest, offset, NUM_ITER)) < 0) in smp_generic_give_timebase()
155 score2 = -score2; in smp_generic_give_timebase()
159 pr_debug("Final offset: %d (%d/%d)\n", offset, score2, NUM_ITER ); in smp_generic_give_timebase()
162 tbsync->cmd = kExit; in smp_generic_give_timebase()
164 tbsync->handshake = 1; in smp_generic_give_timebase()
165 while (tbsync->ack) in smp_generic_give_timebase()
167 tbsync->handshake = 0; in smp_generic_give_timebase()