From: Chris Wilson Date: Sat, 17 Aug 2013 17:09:40 +0000 (+0100) Subject: overlay: Fix wraparound handling of perf ringbuffer X-Git-Tag: intel-gpu-tools-1.4~193 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3e430a8b01ae13bac878863663bd3e2efd995c6d;p=platform%2Fupstream%2Fintel-gpu-tools.git overlay: Fix wraparound handling of perf ringbuffer Signed-off-by: Chris Wilson --- diff --git a/overlay/gpu-perf.c b/overlay/gpu-perf.c index d2f09f5..7751132 100644 --- a/overlay/gpu-perf.c +++ b/overlay/gpu-perf.c @@ -226,7 +226,7 @@ int gpu_perf_update(struct gpu_perf *gp) rmb(); if (head < tail) - tail = head; /* XXX */ + head += size; data = (uint8_t *)mmap + gp->page_size; while (head - tail >= sizeof (struct perf_event_header)) { @@ -262,7 +262,7 @@ int gpu_perf_update(struct gpu_perf *gp) tail += header->size; } - mmap->data_tail = tail; + mmap->data_tail = tail & mask; } free(buffer);