* [Intel-gfx] [PATCH 0/1] Fix i915 error_state_read ptr use
@ 2022-02-25 21:57 Alan Previn
2022-02-25 21:57 ` [Intel-gfx] [PATCH 1/1] drm/i915/reset: Fix error_state_read ptr + offset use Alan Previn
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Alan Previn @ 2022-02-25 21:57 UTC (permalink / raw)
To: intel-gfx; +Cc: dri-devel, Alan Previn
Fix pointer offset usage in error_state_read
when there is no i915_gpu_coredump but buf offset
is non-zero.
Alan Previn (1):
drm/i915/reset: Fix error_state_read ptr + offset use
drivers/gpu/drm/i915/i915_sysfs.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
--
2.25.1
^ permalink raw reply [flat|nested] 5+ messages in thread* [Intel-gfx] [PATCH 1/1] drm/i915/reset: Fix error_state_read ptr + offset use 2022-02-25 21:57 [Intel-gfx] [PATCH 0/1] Fix i915 error_state_read ptr use Alan Previn @ 2022-02-25 21:57 ` Alan Previn 2022-02-26 2:12 ` kernel test robot 2022-02-26 2:16 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for Fix i915 error_state_read ptr use Patchwork 2022-02-26 2:50 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork 2 siblings, 1 reply; 5+ messages in thread From: Alan Previn @ 2022-02-25 21:57 UTC (permalink / raw) To: intel-gfx; +Cc: Alan Previn Fix our pointer offset usage in error_state_read when there is no i915_gpu_coredump but buf offset is non-zero. This fixes a kernel page fault can happen when multiple tests are running concurrently in a loop and one is producing engine resets and consuming the i915 error_state dump while the other is forcing full GT resets. (takes a while to trigger). The dmesg call trace: 5014 [ 5590.803000] BUG: unable to handle page fault for address: ffffffffa0b0e000 5015 [ 5590.803009] #PF: supervisor read access in kernel mode 5016 [ 5590.803013] #PF: error_code(0x0000) - not-present page 5017 [ 5590.803016] PGD 5814067 P4D 5814067 PUD 5815063 PMD 109de4067 PTE 0 5018 [ 5590.803022] Oops: 0000 [#1] PREEMPT SMP NOPTI 5019 [ 5590.803026] CPU: 5 PID: 13656 Comm: i915_hangman Tainted: G U 5.17.0-rc5-ups69-guc-err-capt-rev6+ #136 5020 [ 5590.803033] Hardware name: Intel Corporation Alder Lake Client Platform/AlderLake-M LP4x RVP, BIOS ADLPFWI1.R00.3031.A02.2201171222 01/17/2022 5021 [ 5590.803039] RIP: 0010:memcpy_erms+0x6/0x10 5022 [ 5590.803045] Code: fe ff ff cc eb 1e 0f 1f 00 48 89 f8 48 89 d1 48 c1 e9 03 83 e2 07 f3 48 a5 89 d1 f3 a4 c3 66 0f 1f 44 00 00 48 89 f8 48 89 d1 <f3> a4 c3 0f 1f 80 00 00 00 00 48 89 f8 48 83 fa 20 72 7e 40 38 fe 5023 [ 5590.803054] RSP: 0018:ffffc90003a8fdf0 EFLAGS: 00010282 5024 [ 5590.803057] RAX: ffff888107ee9000 RBX: ffff888108cb1a00 RCX: 0000000000000f8f 5025 [ 5590.803061] RDX: 0000000000001000 RSI: ffffffffa0b0e000 RDI: ffff888107ee9071 5026 [ 5590.803065] RBP: 0000000000000000 R08: 0000000000000001 R09: 0000000000000001 5027 [ 5590.803069] R10: 0000000000000001 R11: 0000000000000002 R12: 0000000000000019 5028 [ 5590.803073] R13: 0000000000174fff R14: 0000000000001000 R15: ffff888107ee9000 5029 [ 5590.803077] FS: 00007f62a99bee80(0000) GS:ffff88849f880000(0000) knlGS:0000000000000000 5030 [ 5590.803082] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 5031 [ 5590.803085] CR2: ffffffffa0b0e000 CR3: 000000010a1a8004 CR4: 0000000000770ee0 5032 [ 5590.803089] PKRU: 55555554 5033 [ 5590.803091] Call Trace: 5034 [ 5590.803093] <TASK> 5035 [ 5590.803096] error_state_read+0xa1/0xd0 [i915] 5036 [ 5590.803175] kernfs_fop_read_iter+0xb2/0x1b0 5037 [ 5590.803180] new_sync_read+0x116/0x1a0 5038 [ 5590.803185] vfs_read+0x114/0x1b0 5039 [ 5590.803189] ksys_read+0x63/0xe0 5040 [ 5590.803193] do_syscall_64+0x38/0xc0 5041 [ 5590.803197] entry_SYSCALL_64_after_hwframe+0x44/0xae 5042 [ 5590.803201] RIP: 0033:0x7f62aaea5912 5043 [ 5590.803204] Code: c0 e9 b2 fe ff ff 50 48 8d 3d 5a b9 0c 00 e8 05 19 02 00 0f 1f 44 00 00 f3 0f 1e fa 64 8b 04 25 18 00 00 00 85 c0 75 10 0f 05 <48> 3d 00 f0 ff ff 77 56 c3 0f 1f 44 00 00 48 83 ec 28 48 89 54 24 5044 [ 5590.803213] RSP: 002b:00007fff5b659ae8 EFLAGS: 00000246 ORIG_RAX: 0000000000000000 5045 [ 5590.803218] RAX: ffffffffffffffda RBX: 0000000000100000 RCX: 00007f62aaea5912 5046 [ 5590.803221] RDX: 000000000008b000 RSI: 00007f62a8c4000f RDI: 0000000000000006 5047 [ 5590.803225] RBP: 00007f62a8bcb00f R08: 0000000000200010 R09: 0000000000101000 5048 [ 5590.803229] R10: 0000000000000001 R11: 0000000000000246 R12: 0000000000000006 5049 [ 5590.803233] R13: 0000000000075000 R14: 00007f62a8acb010 R15: 0000000000200000 5050 [ 5590.803238] </TASK> 5051 [ 5590.803240] Modules linked in: i915 ttm drm_buddy drm_dp_helper drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops prime_numbers nfnetlink br_netfilter overlay mei_pxp mei_hdcp x86_pkg_temp_thermal coretemp kvm_intel snd_hda_codec_hdmi snd_hda_intel snd_intel_dspcfg snd_hda_codec snd_hwdep snd_hda_core snd_pcm mei_me mei fuse ip_tables x_tables crct10dif_pclmul e1000e crc32_pclmul ptp i2c_i801 ghash_clmulni_intel i2c_smbus pps_core [last unloa ded: ttm] 5052 [ 5590.803277] CR2: ffffffffa0b0e000 5053 [ 5590.803280] ---[ end trace 0000000000000000 ]--- Signed-off-by: Alan Previn <alan.previn.teres.alexis@intel.com> --- drivers/gpu/drm/i915/i915_sysfs.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_sysfs.c b/drivers/gpu/drm/i915/i915_sysfs.c index a4d1759375b9..9171c340c41e 100644 --- a/drivers/gpu/drm/i915/i915_sysfs.c +++ b/drivers/gpu/drm/i915/i915_sysfs.c @@ -444,8 +444,10 @@ static ssize_t error_state_read(struct file *filp, struct kobject *kobj, const char *str = "No error state collected\n"; size_t len = strlen(str); - ret = min_t(size_t, count, len - off); - memcpy(buf, str + off, ret); + if (off < len) { + ret = min_t(size_t, count, len - off); + memcpy(buf, str + off, ret); + } } return ret; -- 2.25.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Intel-gfx] [PATCH 1/1] drm/i915/reset: Fix error_state_read ptr + offset use 2022-02-25 21:57 ` [Intel-gfx] [PATCH 1/1] drm/i915/reset: Fix error_state_read ptr + offset use Alan Previn @ 2022-02-26 2:12 ` kernel test robot 0 siblings, 0 replies; 5+ messages in thread From: kernel test robot @ 2022-02-26 2:12 UTC (permalink / raw) To: Alan Previn, intel-gfx; +Cc: llvm, kbuild-all, Alan Previn Hi Alan, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on drm-intel/for-linux-next] [also build test WARNING on drm-tip/drm-tip drm-exynos/exynos-drm-next drm/drm-next tegra-drm/drm/tegra/for-next v5.17-rc5 next-20220224] [cannot apply to airlied/drm-next] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Alan-Previn/Fix-i915-error_state_read-ptr-use/20220226-055549 base: git://anongit.freedesktop.org/drm-intel for-linux-next config: i386-randconfig-a011 (https://download.01.org/0day-ci/archive/20220226/202202261049.pxCmgeWV-lkp@intel.com/config) compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project d271fc04d5b97b12e6b797c6067d3c96a8d7470e) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/0day-ci/linux/commit/4ae08e2ae5d3ff4e465a35b05010e44d02b59aab git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Alan-Previn/Fix-i915-error_state_read-ptr-use/20220226-055549 git checkout 4ae08e2ae5d3ff4e465a35b05010e44d02b59aab # save the config file to linux build tree mkdir build_dir COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/gpu/drm/i915/ If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> All warnings (new ones prefixed by >>): >> drivers/gpu/drm/i915/i915_sysfs.c:447:3: warning: variable 'ret' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] if (off < len) { ^~~~~~~~~~~~~~ include/linux/compiler.h:56:28: note: expanded from macro 'if' #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) ) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/compiler.h:58:30: note: expanded from macro '__trace_if_var' #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond)) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/gpu/drm/i915/i915_sysfs.c:453:9: note: uninitialized use occurs here return ret; ^~~ drivers/gpu/drm/i915/i915_sysfs.c:447:3: note: remove the 'if' if its condition is always true if (off < len) { ^~~~~~~~~~~~~~~ include/linux/compiler.h:56:23: note: expanded from macro 'if' #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) ) ^ drivers/gpu/drm/i915/i915_sysfs.c:435:13: note: initialize the variable 'ret' to silence this warning ssize_t ret; ^ = 0 1 warning generated. vim +447 drivers/gpu/drm/i915/i915_sysfs.c 431 432 struct device *kdev = kobj_to_dev(kobj); 433 struct drm_i915_private *i915 = kdev_minor_to_i915(kdev); 434 struct i915_gpu_coredump *gpu; 435 ssize_t ret; 436 437 gpu = i915_first_error_state(i915); 438 if (IS_ERR(gpu)) { 439 ret = PTR_ERR(gpu); 440 } else if (gpu) { 441 ret = i915_gpu_coredump_copy_to_buffer(gpu, buf, off, count); 442 i915_gpu_coredump_put(gpu); 443 } else { 444 const char *str = "No error state collected\n"; 445 size_t len = strlen(str); 446 > 447 if (off < len) { 448 ret = min_t(size_t, count, len - off); 449 memcpy(buf, str + off, ret); 450 } 451 } 452 453 return ret; 454 } 455 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for Fix i915 error_state_read ptr use 2022-02-25 21:57 [Intel-gfx] [PATCH 0/1] Fix i915 error_state_read ptr use Alan Previn 2022-02-25 21:57 ` [Intel-gfx] [PATCH 1/1] drm/i915/reset: Fix error_state_read ptr + offset use Alan Previn @ 2022-02-26 2:16 ` Patchwork 2022-02-26 2:50 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork 2 siblings, 0 replies; 5+ messages in thread From: Patchwork @ 2022-02-26 2:16 UTC (permalink / raw) To: Alan Previn; +Cc: intel-gfx == Series Details == Series: Fix i915 error_state_read ptr use URL : https://patchwork.freedesktop.org/series/100768/ State : warning == Summary == $ dim checkpatch origin/drm-tip 58047d0313d7 drm/i915/reset: Fix error_state_read ptr + offset use -:18: WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line) #18: 5014 [ 5590.803000] BUG: unable to handle page fault for address: ffffffffa0b0e000 total: 0 errors, 1 warnings, 0 checks, 12 lines checked ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Intel-gfx] ✓ Fi.CI.BAT: success for Fix i915 error_state_read ptr use 2022-02-25 21:57 [Intel-gfx] [PATCH 0/1] Fix i915 error_state_read ptr use Alan Previn 2022-02-25 21:57 ` [Intel-gfx] [PATCH 1/1] drm/i915/reset: Fix error_state_read ptr + offset use Alan Previn 2022-02-26 2:16 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for Fix i915 error_state_read ptr use Patchwork @ 2022-02-26 2:50 ` Patchwork 2 siblings, 0 replies; 5+ messages in thread From: Patchwork @ 2022-02-26 2:50 UTC (permalink / raw) To: Alan Previn; +Cc: intel-gfx [-- Attachment #1: Type: text/plain, Size: 4071 bytes --] == Series Details == Series: Fix i915 error_state_read ptr use URL : https://patchwork.freedesktop.org/series/100768/ State : success == Summary == CI Bug Log - changes from CI_DRM_11290 -> Patchwork_22421 ==================================================== Summary ------- **SUCCESS** No regressions found. External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22421/index.html Participating hosts (41 -> 40) ------------------------------ Additional (1): fi-kbl-guc Missing (2): fi-bsw-cyan fi-pnv-d510 Known issues ------------ Here are the changes found in Patchwork_22421 that come from known issues: ### IGT changes ### #### Issues hit #### * igt@gem_lmem_swapping@basic: - fi-kbl-guc: NOTRUN -> [SKIP][1] ([fdo#109271] / [i915#4613]) +3 similar issues [1]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22421/fi-kbl-guc/igt@gem_lmem_swapping@basic.html * igt@kms_busy@basic: - fi-kbl-guc: NOTRUN -> [SKIP][2] ([fdo#109271] / [i915#1845]) [2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22421/fi-kbl-guc/igt@kms_busy@basic.html * igt@kms_chamelium@vga-hpd-fast: - fi-kbl-guc: NOTRUN -> [SKIP][3] ([fdo#109271] / [fdo#111827]) +8 similar issues [3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22421/fi-kbl-guc/igt@kms_chamelium@vga-hpd-fast.html * igt@kms_pipe_crc_basic@compare-crc-sanitycheck-pipe-d: - fi-kbl-guc: NOTRUN -> [SKIP][4] ([fdo#109271] / [i915#533]) [4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22421/fi-kbl-guc/igt@kms_pipe_crc_basic@compare-crc-sanitycheck-pipe-d.html * igt@kms_pipe_crc_basic@read-crc-pipe-c: - fi-kbl-guc: NOTRUN -> [SKIP][5] ([fdo#109271]) +40 similar issues [5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22421/fi-kbl-guc/igt@kms_pipe_crc_basic@read-crc-pipe-c.html #### Possible fixes #### * igt@i915_selftest@live@hangcheck: - bat-dg1-5: [DMESG-FAIL][6] ([i915#4494] / [i915#4957]) -> [PASS][7] [6]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11290/bat-dg1-5/igt@i915_selftest@live@hangcheck.html [7]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22421/bat-dg1-5/igt@i915_selftest@live@hangcheck.html * igt@kms_busy@basic@flip: - {bat-adlp-6}: [DMESG-WARN][8] ([i915#3576]) -> [PASS][9] [8]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11290/bat-adlp-6/igt@kms_busy@basic@flip.html [9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22421/bat-adlp-6/igt@kms_busy@basic@flip.html {name}: This element is suppressed. This means it is ignored when computing the status of the difference (SUCCESS, WARNING, or FAILURE). [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271 [fdo#109315]: https://bugs.freedesktop.org/show_bug.cgi?id=109315 [fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827 [i915#1759]: https://gitlab.freedesktop.org/drm/intel/issues/1759 [i915#1845]: https://gitlab.freedesktop.org/drm/intel/issues/1845 [i915#2575]: https://gitlab.freedesktop.org/drm/intel/issues/2575 [i915#3576]: https://gitlab.freedesktop.org/drm/intel/issues/3576 [i915#4494]: https://gitlab.freedesktop.org/drm/intel/issues/4494 [i915#4613]: https://gitlab.freedesktop.org/drm/intel/issues/4613 [i915#4957]: https://gitlab.freedesktop.org/drm/intel/issues/4957 [i915#533]: https://gitlab.freedesktop.org/drm/intel/issues/533 Build changes ------------- * Linux: CI_DRM_11290 -> Patchwork_22421 CI-20190529: 20190529 CI_DRM_11290: e4658cb77436a0a406de83fef483b52f84e17208 @ git://anongit.freedesktop.org/gfx-ci/linux IGT_6359: 57049558c452272b27eeb099fac07e55a924bbf9 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git Patchwork_22421: 58047d0313d7b46d97697eec67458275ecd1c8f7 @ git://anongit.freedesktop.org/gfx-ci/linux == Linux commits == 58047d0313d7 drm/i915/reset: Fix error_state_read ptr + offset use == Logs == For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22421/index.html [-- Attachment #2: Type: text/html, Size: 4913 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-02-26 2:50 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-02-25 21:57 [Intel-gfx] [PATCH 0/1] Fix i915 error_state_read ptr use Alan Previn 2022-02-25 21:57 ` [Intel-gfx] [PATCH 1/1] drm/i915/reset: Fix error_state_read ptr + offset use Alan Previn 2022-02-26 2:12 ` kernel test robot 2022-02-26 2:16 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for Fix i915 error_state_read ptr use Patchwork 2022-02-26 2:50 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox