Skip to contentSkip to conversation

drm/i915/perf: Do not clear pollin for small user read buffers

PATCH In review Ashutosh Dixit 3 participants 6 messages Apr 3, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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

---
 drivers/gpu/drm/i915/i915_perf.c | 61 ++++++--------------------------
 1 file changed, 11 insertions(+), 50 deletions(-)
drivers/gpu/drm/i915/i915_perf.c +11 -50
index 28e3d76fa2e6..2f78b147bb2d 100644
@@ -2963,49 +2963,6 @@ void i915_oa_init_reg_state(const struct intel_context *ce,
 		gen8_update_reg_state_unlocked(ce, stream);
 }
 
-/**
- * i915_perf_read_locked - &i915_perf_stream_ops->read with error normalisation
- * @stream: An i915 perf stream
- * @file: An i915 perf stream file
- * @buf: destination buffer given by userspace
- * @count: the number of bytes userspace wants to read
- * @ppos: (inout) file seek position (unused)
- *
- * Besides wrapping &i915_perf_stream_ops->read this provides a common place to
- * ensure that if we've successfully copied any data then reporting that takes
- * precedence over any internal error status, so the data isn't lost.
- *
- * For example ret will be -ENOSPC whenever there is more buffered data than
- * can be copied to userspace, but that's only interesting if we weren't able
- * to copy some data because it implies the userspace buffer is too small to
- * receive a single record (and we never split records).
- *
- * Another case with ret == -EFAULT is more of a grey area since it would seem
- * like bad form for userspace to ask us to overrun its buffer, but the user
- * knows best:
- *
- *   http://yarchive.net/comp/linux/partial_reads_writes.html
- *
- * Returns: The number of bytes copied or a negative error code on failure.
- */
-static ssize_t i915_perf_read_locked(struct i915_perf_stream *stream,
-				     struct file *file,
-				     char __user *buf,
-				     size_t count,
-				     loff_t *ppos)
-{
-	/* Note we keep the offset (aka bytes read) separate from any
-	 * error status so that the final check for whether we return
-	 * the bytes read with a higher precedence than any error (see
-	 * comment below) doesn't need to be handled/duplicated in
-	 * stream->ops->read() implementations.
-	 */
-	size_t offset = 0;
-	int ret = stream->ops->read(stream, buf, count, &offset);
-
-	return offset ?: (ret ?: -EAGAIN);
-}
-
 /**
  * i915_perf_read - handles read() FOP for i915 perf stream FDs
  * @file: An i915 perf stream file
@@ -3031,7 +2988,8 @@ static ssize_t i915_perf_read(struct file *file,
 {
 	struct i915_perf_stream *stream = file->private_data;
 	struct i915_perf *perf = stream->perf;
-	ssize_t ret;
+	size_t offset = 0;
+	int ret;
 
 	/* To ensure it's handled consistently we simply treat all reads of a
 	 * disabled stream as an error. In particular it might otherwise lead
@@ -3054,13 +3012,12 @@ static ssize_t i915_perf_read(struct file *file,
 				return ret;
 
 			mutex_lock(&perf->lock);
-			ret = i915_perf_read_locked(stream, file,
-						    buf, count, ppos);
+			ret = stream->ops->read(stream, buf, count, &offset);
 			mutex_unlock(&perf->lock);
-		} while (ret == -EAGAIN);
+		} while (!offset && !ret);
 	} else {
 		mutex_lock(&perf->lock);
-		ret = i915_perf_read_locked(stream, file, buf, count, ppos);
+		ret = stream->ops->read(stream, buf, count, &offset);
 		mutex_unlock(&perf->lock);
 	}
 
@@ -3071,11 +3028,15 @@ static ssize_t i915_perf_read(struct file *file,
 	 * and read() returning -EAGAIN. Clearing the oa.pollin state here
 	 * effectively ensures we back off until the next hrtimer callback
 	 * before reporting another EPOLLIN event.
+	 * The exception to this is if ops->read() returned -ENOSPC which means
+	 * that more OA data is available than could fit in the user provided
+	 * buffer. In this case we want the next poll() call to not block.
 	 */
-	if (ret >= 0 || ret == -EAGAIN)
+	if (ret != -ENOSPC)
 		stream->pollin = false;
 
-	return ret;
+	/* Possible values for ret are 0, -EFAULT, -ENOSPC, -EIO, ... */
+	return offset ?: (ret ?: -EAGAIN);
 }
 
 static enum hrtimer_restart oa_poll_check_timer_cb(struct hrtimer *hrtimer)
Signature · 6 lines
2.25.2

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

[Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915/perf: Do not clear pollin for small user read buffers (rev7)

== Series Details ==

== Series Details ==

Series: drm/i915/perf: Do not clear pollin for small user read buffers (rev7)
URL : https://patchwork.freedesktop.org/series/75085/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_8242 -> Patchwork_17191
====================================================

Summary
-------

**SUCCESS**

No regressions found.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17191/index.html

Changes
-------

No changes found

Participating hosts (47 -> 37)
------------------------------

Missing (10): fi-ilk-m540 fi-hsw-4200u fi-hsw-peppy fi-byt-squawks fi-bwr-2160 fi-gdg-551 fi-cfl-8109u fi-kbl-7560u fi-bdw-samus fi-snb-2600

Build changes
-------------

* CI: CI-20190529 -> None
* Linux: CI_DRM_8242 -> Patchwork_17191

CI-20190529: 20190529
CI_DRM_8242: 07d20020ec328dc9858680651366425afa51cd59 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5560: 213062c7dcf0cbc8069cbb5f91acbc494def33fd @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_17191: 474c470267ad8965e4f82037aa367c5c025e88b2 @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

474c470267ad drm/i915/perf: Do not clear pollin for small user read buffers

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17191/index.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw

[Intel-gfx] ✗ Fi.CI.IGT: failure for drm/i915/perf: Do not clear pollin for small user read buffers (rev7)

In reply to Ashutosh Dixit
== Series Details ==

== Series Details ==

Series: drm/i915/perf: Do not clear pollin for small user read buffers (rev7)
URL : https://patchwork.freedesktop.org/series/75085/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_8242_full -> Patchwork_17191_full
====================================================

Summary
-------

**FAILURE**

Serious unknown changes coming with Patchwork_17191_full absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in Patchwork_17191_full, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in Patchwork_17191_full:

### IGT changes ###

#### Possible regressions ####

* igt@gem_mmap_gtt@cpuset-big-copy-odd:
- shard-skl: [PASS][1] -> [FAIL][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8242/shard-skl6/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17191/shard-skl8/igt@[email protected]

#### Suppressed ####

The following results come from untrusted machines, tests, or statuses. They do not affect the overall result.

* {igt@sysfs_timeslice_duration@timeout@vcs0}:
- shard-skl: [PASS][3] -> [FAIL][4]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8242/shard-skl1/igt@sysfs_timeslice_duration@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17191/shard-skl7/igt@sysfs_timeslice_duration@[email protected]

### Piglit changes ###

#### Possible regressions ####

* spec@!opengl 1.1@max-texture-size (NEW):
- pig-snb-2600: NOTRUN -> [INCOMPLETE][5]
[5]: None

New tests
---------

New tests have been introduced between CI_DRM_8242_full and Patchwork_17191_full:

### New IGT tests (1) ###

* igt@perf_pmu@faulting-read:
- Statuses :
- Exec time: [None] s

### New Piglit tests (1) ###

* spec@!opengl 1.1@max-texture-size:
- Statuses : 1 incomplete(s)
- Exec time: [0.0] s

Known issues
------------

Here are the changes found in Patchwork_17191_full that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@gem_tiled_swapping@non-threaded:
- shard-kbl: [PASS][6] -> [FAIL][7] ([i915#93] / [i915#95])
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8242/shard-kbl7/igt@[email protected]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17191/shard-kbl3/igt@[email protected]

* igt@gem_workarounds@suspend-resume-context:
- shard-apl: [PASS][8] -> [DMESG-WARN][9] ([i915#180] / [i915#95])
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8242/shard-apl2/igt@[email protected]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17191/shard-apl4/igt@[email protected]

* igt@i915_selftest@live@execlists:
- shard-apl: [PASS][10] -> [INCOMPLETE][11] ([i915#656])
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8242/shard-apl3/igt@i915_selftest@[email protected]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17191/shard-apl1/igt@i915_selftest@[email protected]

* igt@kms_cursor_crc@pipe-c-cursor-suspend:
- shard-apl: [PASS][12] -> [DMESG-WARN][13] ([i915#180]) +2 similar issues
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8242/shard-apl1/igt@[email protected]
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17191/shard-apl8/igt@[email protected]

* igt@kms_draw_crc@draw-method-xrgb8888-mmap-gtt-untiled:
- shard-apl: [PASS][14] -> [FAIL][15] ([i915#52] / [i915#54] / [i915#95]) +1 similar issue
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8242/shard-apl2/igt@[email protected]
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17191/shard-apl4/igt@[email protected]

* igt@kms_fbcon_fbt@fbc-suspend:
- shard-kbl: [PASS][16] -> [DMESG-WARN][17] ([i915#180] / [i915#93] / [i915#95])
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8242/shard-kbl1/igt@[email protected]
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17191/shard-kbl6/igt@[email protected]

* igt@kms_flip@2x-flip-vs-expired-vblank:
- shard-glk: [PASS][18] -> [FAIL][19] ([i915#79])
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8242/shard-glk1/igt@[email protected]
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17191/shard-glk2/igt@[email protected]

* igt@kms_flip@plain-flip-fb-recreate:
- shard-skl: [PASS][20] -> [FAIL][21] ([i915#34])
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8242/shard-skl3/igt@[email protected]
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17191/shard-skl9/igt@[email protected]

* igt@kms_psr@psr2_sprite_plane_move:
- shard-iclb: [PASS][22] -> [SKIP][23] ([fdo#109441]) +3 similar issues
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8242/shard-iclb2/igt@kms_psr@psr2_sprite_plane_move.html
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17191/shard-iclb5/igt@kms_psr@psr2_sprite_plane_move.html

* igt@kms_vblank@pipe-c-ts-continuation-suspend:
- shard-skl: [PASS][24] -> [INCOMPLETE][25] ([i915#69])
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8242/shard-skl1/igt@[email protected]
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17191/shard-skl9/igt@[email protected]

* igt@prime_busy@after-bsd2:
- shard-iclb: [PASS][26] -> [SKIP][27] ([fdo#109276]) +1 similar issue
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8242/shard-iclb4/igt@[email protected]
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17191/shard-iclb5/igt@[email protected]

#### Possible fixes ####

* {igt@gem_ctx_isolation@preservation-s3@bcs0}:
- shard-kbl: [DMESG-WARN][28] ([i915#180]) -> [PASS][29] +3 similar issues
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8242/shard-kbl4/igt@gem_ctx_isolation@[email protected]
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17191/shard-kbl6/igt@gem_ctx_isolation@[email protected]

* igt@gem_mmap_gtt@cpuset-big-copy-xy:
- shard-glk: [FAIL][30] -> [PASS][31]
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8242/shard-glk5/igt@[email protected]
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17191/shard-glk6/igt@[email protected]

* {igt@gem_wait@wait@vecs0}:
- shard-skl: [FAIL][32] -> [PASS][33]
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8242/shard-skl7/igt@gem_wait@[email protected]
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17191/shard-skl7/igt@gem_wait@[email protected]

* igt@kms_draw_crc@draw-method-rgb565-mmap-wc-xtiled:
- shard-glk: [FAIL][34] ([i915#52] / [i915#54]) -> [PASS][35] +1 similar issue
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8242/shard-glk7/igt@[email protected]
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17191/shard-glk2/igt@[email protected]

* igt@kms_draw_crc@draw-method-rgb565-pwrite-untiled:
- shard-glk: [FAIL][36] ([i915#177] / [i915#52] / [i915#54]) -> [PASS][37]
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8242/shard-glk9/igt@[email protected]
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17191/shard-glk5/igt@[email protected]

* igt@kms_flip@flip-vs-expired-vblank:
- shard-glk: [FAIL][38] ([i915#79]) -> [PASS][39]
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8242/shard-glk6/igt@[email protected]
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17191/shard-glk2/igt@[email protected]

* igt@kms_flip@plain-flip-fb-recreate-interruptible:
- shard-skl: [FAIL][40] ([i915#34]) -> [PASS][41]
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8242/shard-skl8/igt@[email protected]
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17191/shard-skl1/igt@[email protected]

* igt@kms_plane_alpha_blend@pipe-a-constant-alpha-min:
- shard-skl: [FAIL][42] ([fdo#108145] / [i915#265]) -> [PASS][43]
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8242/shard-skl3/igt@[email protected]
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17191/shard-skl4/igt@[email protected]

* igt@kms_psr@psr2_cursor_blt:
- shard-iclb: [SKIP][44] ([fdo#109441]) -> [PASS][45] +1 similar issue
[44]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8242/shard-iclb3/igt@kms_psr@psr2_cursor_blt.html
[45]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17191/shard-iclb2/igt@kms_psr@psr2_cursor_blt.html

* igt@kms_setmode@basic:
- shard-apl: [FAIL][46] ([i915#31]) -> [PASS][47]
[46]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8242/shard-apl8/igt@[email protected]
[47]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17191/shard-apl1/igt@[email protected]

* igt@kms_vblank@pipe-b-ts-continuation-suspend:
- shard-apl: [DMESG-WARN][48] ([i915#180]) -> [PASS][49]
[48]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8242/shard-apl2/igt@[email protected]
[49]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17191/shard-apl4/igt@[email protected]

* igt@prime_busy@before-bsd2:
- shard-iclb: [SKIP][50] ([fdo#109276]) -> [PASS][51]
[50]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8242/shard-iclb6/igt@[email protected]
[51]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17191/shard-iclb1/igt@[email protected]

* {igt@sysfs_heartbeat_interval@mixed@rcs0}:
- shard-skl: [FAIL][52] ([i915#1459]) -> [PASS][53]
[52]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8242/shard-skl6/igt@sysfs_heartbeat_interval@[email protected]
[53]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17191/shard-skl8/igt@sysfs_heartbeat_interval@[email protected]

#### Warnings ####

* igt@i915_pm_dc@dc6-psr:
- shard-tglb: [SKIP][54] ([i915#468]) -> [FAIL][55] ([i915#454])
[54]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8242/shard-tglb2/igt@[email protected]
[55]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17191/shard-tglb5/igt@[email protected]

* igt@kms_plane_alpha_blend@pipe-c-alpha-opaque-fb:
- shard-apl: [FAIL][56] ([fdo#108145] / [i915#265] / [i915#95]) -> [FAIL][57] ([fdo#108145] / [i915#265])
[56]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8242/shard-apl8/igt@[email protected]
[57]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17191/shard-apl2/igt@[email protected]

* igt@runner@aborted:
- shard-apl: [FAIL][58] ([i915#1423]) -> ([FAIL][59], [FAIL][60]) ([i915#1423] / [i915#529])
[58]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8242/shard-apl2/igt@[email protected]
[59]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17191/shard-apl1/igt@[email protected]
[60]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17191/shard-apl4/igt@[email protected]

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[fdo#108145]: https://bugs.freedesktop.org/show_bug.cgi?id=108145
[fdo#109276]: https://bugs.freedesktop.org/show_bug.cgi?id=109276
[fdo#109441]: https://bugs.freedesktop.org/show_bug.cgi?id=109441
[i915#1423]: https://gitlab.freedesktop.org/drm/intel/issues/1423
[i915#1459]: https://gitlab.freedesktop.org/drm/intel/issues/1459
[i915#177]: https://gitlab.freedesktop.org/drm/intel/issues/177
[i915#180]: https://gitlab.freedesktop.org/drm/intel/issues/180
[i915#265]: https://gitlab.freedesktop.org/drm/intel/issues/265
[i915#31]: https://gitlab.freedesktop.org/drm/intel/issues/31
[i915#34]: https://gitlab.freedesktop.org/drm/intel/issues/34
[i915#454]: https://gitlab.freedesktop.org/drm/intel/issues/454
[i915#468]: https://gitlab.freedesktop.org/drm/intel/issues/468
[i915#52]: https://gitlab.freedesktop.org/drm/intel/issues/52
[i915#529]: https://gitlab.freedesktop.org/drm/intel/issues/529
[i915#54]: https://gitlab.freedesktop.org/drm/intel/issues/54
[i915#656]: https://gitlab.freedesktop.org/drm/intel/issues/656
[i915#69]: https://gitlab.freedesktop.org/drm/intel/issues/69
[i915#79]: https://gitlab.freedesktop.org/drm/intel/issues/79
[i915#93]: https://gitlab.freedesktop.org/drm/intel/issues/93
[i915#95]: https://gitlab.freedesktop.org/drm/intel/issues/95

Participating hosts (10 -> 11)
------------------------------

Additional (1): pig-snb-2600

Build changes
-------------

* CI: CI-20190529 -> None
* Linux: CI_DRM_8242 -> Patchwork_17191

CI-20190529: 20190529
CI_DRM_8242: 07d20020ec328dc9858680651366425afa51cd59 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5560: 213062c7dcf0cbc8069cbb5f91acbc494def33fd @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_17191: 474c470267ad8965e4f82037aa367c5c025e88b2 @ git://anongit.freedesktop.org/gfx-ci/linux
piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17191/index.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw
In reply to Ashutosh Dixit

Quoting Ashutosh Dixit (2020-04-03 02:01:20)

Quoted 18 lines

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

Quoted 4 lines

Did you manage to devise a test case? It is nice (some might say important) to pair a patch for stable with its regression test. -Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#4 lore raw
Quoted 20 lines · Chris Wilson

Quoting Ashutosh Dixit (2020-04-03 02:01:20)

Quoted 18 lines

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

Quoted 7 lines
Quoted 4 lines

Did you manage to devise a test case? It is nice (some might say important) to pair a patch for stable with its regression test.

Yes there is a test case here:

https://patchwork.freedesktop.org/series/75100/#rev3

Lionel verified that it is fails on stable kernels here:

https://patchwork.freedesktop.org/patch/358873/?series=75100&rev=1

Thanks!
--
Ashutosh
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#5 lore raw

Quoting Dixit, Ashutosh (2020-04-03 18:45:09)

Quoted 29 lines · Chris Wilson
Quoted 20 lines

Quoting Ashutosh Dixit (2020-04-03 02:01:20)

Quoted 18 lines

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

Quoted 7 lines
Quoted 4 lines

Did you manage to devise a test case? It is nice (some might say important) to pair a patch for stable with its regression test.

Quoted 7 lines

Yes there is a test case here:

https://patchwork.freedesktop.org/series/75100/#rev3

Lionel verified that it is fails on stable kernels here:

https://patchwork.freedesktop.org/patch/358873/?series=75100&rev=1

Ta. Pushed both,
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx