Commit 9cebdc65 authored by Alessandro Rubini's avatar Alessandro Rubini Committed by Grzegorz Daniluk

stats: use a sequence number

If the host wants a consistent view (*if* it wants it), it
can wait for the sequence number to be even, read the lot and
then check it did not change.

If it is odd, it means the structure is being modified. If it changed
after reading it means a new modification started.

Not my invention: it's old stuff, though smart. See sequential locks
in the kernel for example.
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <>
parent bcbdbf02
......@@ -643,8 +643,9 @@ void spll_update()
/* currently we have statistics only in the switch */
if (is_wr_switch) {
/* currently we have statistics only in the switch */
stats.mode = softpll.mode;
stats.irq_cnt = irq_count;
stats.seq_state = softpll.seq_state;
......@@ -654,6 +655,7 @@ void spll_update()
stats.H_y = softpll.helper.pi.y;
stats.M_y = softpll.mpll.pi.y;
stats.del_cnt = softpll.delock_count;
......@@ -132,7 +132,8 @@ void check_vco_frequencies();
/* info reported through .stat section */
struct spll_stats {
int magic; /* 0x5b1157a7 = SPLLSTAT ?;)*/
int ver; /* version of the structure */
int ver; /* version of the structure */
int sequence; /* sequence number, so the host can retry */
int mode;
int irq_cnt;
int seq_state;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment