powerpc/pseries: Duplicate dtl entries sometimes sent to userspace
authorAnton Blanchard <anton@samba.org>
Sun, 17 Nov 2013 00:39:05 +0000 (11:39 +1100)
committerBen Hutchings <ben@decadent.org.uk>
Fri, 3 Jan 2014 04:33:23 +0000 (04:33 +0000)
commit36d04a55f34ab580aab001e497b97410f0ad5079
tree9b061b1cad1c3532700f84e5a58c504a7e5be17c
parent22007773be6c56f9ad1891f3e680996f72386063
powerpc/pseries: Duplicate dtl entries sometimes sent to userspace

commit 84b073868b9d9e754ae48b828337633d1b386482 upstream.

When reading from the dispatch trace log (dtl) userspace interface, I
sometimes see duplicate entries. One example:

# hexdump -C dtl.out

00000000  07 04 00 0c 00 00 48 44  00 00 00 00 00 00 00 00
00000010  00 0c a0 b4 16 83 6d 68  00 00 00 00 00 00 00 00
00000020  00 00 00 00 10 00 13 50  80 00 00 00 00 00 d0 32

00000030  07 04 00 0c 00 00 48 44  00 00 00 00 00 00 00 00
00000040  00 0c a0 b4 16 83 6d 68  00 00 00 00 00 00 00 00
00000050  00 00 00 00 10 00 13 50  80 00 00 00 00 00 d0 32

The problem is in scan_dispatch_log() where we call dtl_consumer()
but bail out before incrementing the index.

To fix this I moved dtl_consumer() after the timebase comparison.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
[bwh: Backported to 3.2: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
arch/powerpc/kernel/time.c