Re: [BUG] Something goes wrong with timer statistics.

From: Ian Kumlien
Date: Thu May 31 2007 - 18:59:37 EST


On tor, 2007-05-31 at 17:27 +0200, BjÃrn Steinbrink wrote:
> On 2007.05.31 17:10:07 +0200, Eric Dumazet wrote:
> > Well... :) , there is still a memory barrier missing it seems.
> >
> > Another cpu might see a bad value if 'active=1' is set before tstat_hash_table is really cleared.
>
> Hm, that even makes the assumption in my first try valid ;-)
> Just for the record, this time I thought that the barrier from the
> spinlock in timer_stats_update_stats (right before the check for active)
> would be enough, but that's obviously running on the wrong cpu if we
> race... *sigh*
>
> Thanks,
> BjÃrn
>
>
>
> Fix two races in the timer stats lookup code. One by ensuring that the
> initialization of a new entry is finished upon insertion of that entry.
> The other by cleaning up the hash table when the entries array is
> cleared, so that we don't have "pre-inserted" entries.
>
> Thanks to Eric Dumazet for reminding me of the memory barriers.

Fix the comment below and you can add:
Signed-off-by: Ian Kumlien <pomac@xxxxxxxxx>

It's currently been running for the longest period ever, ie, 11 minutes
=)

I'm gonna leave it running during the night and send a status update
when the evil daystar reaches it's peak CET. (i haven't been able to
stop since linus mentioned it... damn it... =))

> Signed-off-by: BjÃrn Steinbrink <B.Steinbrink@xxxxxx>
> ---

> @@ -360,6 +364,7 @@ static ssize_t tstats_write(struct file *file, const char __user *buf,
> if (!active) {
> reset_entries();
> time_start = ktime_get();
> + smb_mb();

smb? you mean smp =)

> active = 1;
> }
> break;

--
Ian Kumlien <pomac () vapor ! com> -- http://pomac.netswarm.net
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/