* [PATCH] drm/i915: Fix vm reference leak in mock_gem_device()
@ 2026-09-16 17:19 Wentao Liang
2026-09-17 6:57 ` Joonas Lahtinen
0 siblings, 1 reply; 4+ messages in thread
From: Wentao Liang @ 2026-09-16 17:19 UTC (permalink / raw)
To: airlied
Cc: andi.shyti, dri-devel, intel-gfx, jani.nikula, joonas.lahtinen,
linux-kernel, matthew.d.roper, rodrigo.vivi, simona,
sujaritha.sundaresan, tursulin, Wentao Liang, stable
mock_gem_device() takes a reference on the GGTT vm for gt->vm, but
neither mock_device_release() nor the setup error paths drop it, unlike
the real teardown where intel_gt_driver_release() releases gt->vm.
Drop the reference before mock_fini_ggtt() and on the error paths.
Fixes: cdeea858d8df ("drm/i915: Remove unused i915->ggtt")
Cc: stable@vger.kernel.org
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
drivers/gpu/drm/i915/selftests/mock_gem_device.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/gpu/drm/i915/selftests/mock_gem_device.c b/drivers/gpu/drm/i915/selftests/mock_gem_device.c
index 27dc0e40a8d7..12cd252d9250 100644
--- a/drivers/gpu/drm/i915/selftests/mock_gem_device.c
+++ b/drivers/gpu/drm/i915/selftests/mock_gem_device.c
@@ -71,6 +71,7 @@ static void mock_device_release(struct drm_device *dev)
i915_gem_drain_workqueue(i915);
+ i915_vm_put(fetch_and_zero(&to_gt(i915)->vm));
mock_fini_ggtt(to_gt(i915)->ggtt);
destroy_workqueue(i915->unordered_wq);
destroy_workqueue(i915->wq);
@@ -145,6 +146,7 @@ struct drm_i915_private *mock_gem_device(void)
#endif
struct drm_i915_private *i915;
struct intel_display *display;
+ struct i915_address_space *vm;
struct pci_dev *pdev;
int ret;
@@ -263,6 +265,9 @@ struct drm_i915_private *mock_gem_device(void)
err_drv:
intel_region_ttm_device_fini(i915);
err_ttm:
+ vm = fetch_and_zero(&to_gt(i915)->vm);
+ if (vm)
+ i915_vm_put(vm);
intel_gt_driver_late_release_all(i915);
intel_memory_regions_driver_release(i915);
drm_mode_config_cleanup(&i915->drm);
--
2.34.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/i915: Fix vm reference leak in mock_gem_device()
2026-09-16 17:19 [PATCH] drm/i915: Fix vm reference leak in mock_gem_device() Wentao Liang
@ 2026-09-17 6:57 ` Joonas Lahtinen
2026-11-07 17:09 ` Wentao Liang
2026-11-07 17:10 ` [PATCH v2] drm/i915/selftests: Release GT VM reference on mock device teardown Wentao Liang
0 siblings, 2 replies; 4+ messages in thread
From: Joonas Lahtinen @ 2026-09-17 6:57 UTC (permalink / raw)
To: Wentao Liang, airlied
Cc: andi.shyti, dri-devel, intel-gfx, jani.nikula, linux-kernel,
matthew.d.roper, rodrigo.vivi, simona, sujaritha.sundaresan,
tursulin, Wentao Liang, stable
Quoting Wentao Liang (2026-09-16 20:19:35)
> mock_gem_device() takes a reference on the GGTT vm for gt->vm, but
> neither mock_device_release() nor the setup error paths drop it, unlike
> the real teardown where intel_gt_driver_release() releases gt->vm.
> Drop the reference before mock_fini_ggtt() and on the error paths.
>
> Fixes: cdeea858d8df ("drm/i915: Remove unused i915->ggtt")
> Cc: stable@vger.kernel.org
We're not putting Fixes and definitely not Cc: stable for selftest
improvements.
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
You clearly did not try to address any of the issues per the surrounding
coding style or understand the severity before Cc stable, but just generated
some static code fixes and commit messages with LLM.
Looking at your history of spamming the LKML with 30+ patches per day
and not a single response for requests to fix things or add the
Assisted-by tag, don't really expect you or even your LLM to read this.
So this reply is more for documentation purposes.
Doesn't really inspire any confidence to merge anything or look at any
further of your multiple patches which you send separately and not in
series in the hopes of getting some merged even when pushback in others.
If I happen to be wrong, let me know.
Regards, Joonas
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/i915: Fix vm reference leak in mock_gem_device()
2026-09-17 6:57 ` Joonas Lahtinen
@ 2026-11-07 17:09 ` Wentao Liang
2026-11-07 17:10 ` [PATCH v2] drm/i915/selftests: Release GT VM reference on mock device teardown Wentao Liang
1 sibling, 0 replies; 4+ messages in thread
From: Wentao Liang @ 2026-11-07 17:09 UTC (permalink / raw)
To: Joonas Lahtinen
Cc: Jani Nikula, Rodrigo Vivi, Tvrtko Ursulin, David Airlie,
Simona Vetter, intel-gfx, dri-devel, linux-kernel
Hi Joonas,
First of all, I sincerely apologize for my very late reply, and thank you
for taking the time to raise these concerns.
I have read your message carefully. Your criticism is justified, not only
regarding this particular patch, but also regarding the way I have been
submitting patches to the kernel community.
For this patch, I failed to properly assess the severity and scope of the
issue before submitting it. This is a selftest-only cleanup, and it should
never have been marked for stable backporting. I also failed to pay
sufficient attention to the subsystem's coding conventions and teardown
ordering. These are things I should have checked myself before asking
maintainers to review the change.
I have revisited the relevant code and revised the patch to address these
issues. The v2 removes the Fixes and stable tags, corrects the subject
prefix, and adjusts the cleanup ordering. I understand that correcting
these details now does not excuse the lack of care in the original
submission.
I also want to be transparent about the use of AI tools. The initial
finding came from static analysis, and I used DeepSeek and GPT 6.1 Sol to
help examine the finding and prepare the patch. However, I was the one
who decided to submit it, and I am fully responsible for its correctness,
testing, and presentation. Using these tools does not reduce that
responsibility, and I should not have submitted a patch without
sufficient independent verification.
More importantly, I owe you and the other maintainers an apology for my
broader submission practices. I submitted far too many patches in a short
period of time without giving each one the attention it deserved. I also
failed to respond to review comments and requests for changes, including
requests to acknowledge AI assistance. I understand how frustrating this
must have been, especially when maintainers are spending their own
limited time reviewing contributions.
You were right to question whether I was taking the review process
seriously. Looking back at how I handled those submissions, I can
understand why they gave that impression. I regret that my actions wasted
maintainers' time and undermined their trust in my contributions.
I am changing how I approach kernel contributions. I will stop submitting
patches in bulk, review outstanding feedback individually, and prioritize
resolving existing discussions over sending new patches. Going forward, I
will submit changes only after I have examined the relevant code paths,
checked the subsystem conventions, and performed appropriate validation. I
will also make sure that any AI assistance is properly acknowledged.
I understand that trust cannot be restored simply by writing an apology.
It will take consistent care and follow-through in future contributions,
and I intend to demonstrate that through my actions.
I have prepared a revised version of this patch, but I also understand if
you do not consider this particular cleanup worth pursuing. I will
respect that decision and will not continue pushing it if you would
prefer to leave it aside.
Thank you again for your feedback, and I am genuinely sorry for the
unnecessary review burden and for not responding sooner.
Regards,
Wentao
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2] drm/i915/selftests: Release GT VM reference on mock device teardown
2026-09-17 6:57 ` Joonas Lahtinen
2026-11-07 17:09 ` Wentao Liang
@ 2026-11-07 17:10 ` Wentao Liang
1 sibling, 0 replies; 4+ messages in thread
From: Wentao Liang @ 2026-11-07 17:10 UTC (permalink / raw)
To: Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, Tvrtko Ursulin
Cc: David Airlie, Simona Vetter, Andi Shyti, Matthew D Roper,
Sujaritha Sundaresan, intel-gfx, dri-devel, linux-kernel
mock_gem_device() takes an additional reference to the GGTT VM when
initializing gt->vm. However, the mock device cleanup does not release
this reference, either during normal teardown or when initialization
fails.
The regular i915 driver releases gt->vm through
intel_gt_driver_release(), but the mock device does not use that
teardown path. As a result, the additional VM reference can remain
held after the mock device has been cleaned up.
Release the reference during normal teardown after draining the GEM
workqueue and before finalizing the mock GGTT. Also release it during
initialization error unwinding, before destroying the workqueues.
This change is limited to the mock device used by the i915 selftests
and does not affect normal driver operation.
The issue was identified through static analysis, with AI assistance
used to examine the finding and prepare the fix. The resulting change
was manually reviewed and build-tested with
CONFIG_DRM_I915_SELFTEST=y.
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
Changes in v2:
- Remove the Fixes and Cc: stable tags, as this is a selftest-only
cleanup rather than a fix requiring stable backporting.
- Correct the subject prefix to drm/i915/selftests.
- Adjust the error-path cleanup ordering so the VM reference is
released before the workqueues are destroyed.
- Clarify the scope of the change and document the use of AI tools.
drivers/gpu/drm/i915/selftests/mock_gem_device.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/gpu/drm/i915/selftests/mock_gem_device.c b/drivers/gpu/drm/i915/selftests/mock_gem_device.c
index 796c9b070e41..88cd83f28586 100644
--- a/drivers/gpu/drm/i915/selftests/mock_gem_device.c
+++ b/drivers/gpu/drm/i915/selftests/mock_gem_device.c
@@ -71,6 +71,7 @@ static void mock_device_release(struct drm_device *dev)
i915_gem_drain_workqueue(i915);
+ i915_vm_put(fetch_and_zero(&to_gt(i915)->vm));
mock_fini_ggtt(to_gt(i915)->ggtt);
destroy_workqueue(i915->unordered_wq);
destroy_workqueue(i915->wq);
@@ -145,6 +146,7 @@ struct drm_i915_private *mock_gem_device(void)
#endif
struct drm_i915_private *i915;
struct intel_display *display;
+ struct i915_address_space *vm;
struct pci_dev *pdev;
int ret;
@@ -257,6 +259,9 @@ struct drm_i915_private *mock_gem_device(void)
err_context:
intel_gt_driver_remove(to_gt(i915));
err_unlock:
+ vm = fetch_and_zero(&to_gt(i915)->vm);
+ if (vm)
+ i915_vm_put(vm);
destroy_workqueue(i915->unordered_wq);
err_wq:
destroy_workqueue(i915->wq);
--
2.34.1
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-11-07 18:49 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-16 17:19 [PATCH] drm/i915: Fix vm reference leak in mock_gem_device() Wentao Liang
2026-09-17 6:57 ` Joonas Lahtinen
2026-11-07 17:09 ` Wentao Liang
2026-11-07 17:10 ` [PATCH v2] drm/i915/selftests: Release GT VM reference on mock device teardown Wentao Liang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®