]> git.baikalelectronics.ru Git - kernel.git/commit
drm/i915/perf: Do not clear pollin for small user read buffers
authorAshutosh Dixit <ashutosh.dixit@intel.com>
Fri, 3 Apr 2020 01:01:20 +0000 (18:01 -0700)
committerChris Wilson <chris@chris-wilson.co.uk>
Fri, 3 Apr 2020 17:55:02 +0000 (18:55 +0100)
commit1252968f013be144f6db0f495f336d1e9cfbf110
treea18a8015df6b642e5dfe97d15a9db42228741da2
parentbad1219b5276ab3499c7c498dc8ecaadfc9375b5
drm/i915/perf: Do not clear pollin for small user read buffers

It is wrong to block the user thread in the next poll when OA data is
already available which could not fit in the user buffer provided in
the previous read. In several cases the exact user buffer size is not
known. Blocking user space in poll can lead to data loss when the
buffer size used is smaller than the available data.

This change fixes this issue and allows user space to read all OA data
even when using a buffer size smaller than the available data using
multiple non-blocking reads rather than staying blocked in poll till
the next timer interrupt.

v2: Fix ret value for blocking reads (Umesh)
v3: Mistake during patch send (Ashutosh)
v4: Remove -EAGAIN from comment (Umesh)
v5: Improve condition for clearing pollin and return (Lionel)
v6: Improve blocking read loop and other cleanups (Lionel)
v7: Added Cc stable

Testcase: igt/perf/polling-small-buf
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
Cc: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20200403010120.3067-1-ashutosh.dixit@intel.com
drivers/gpu/drm/i915/i915_perf.c