2023-11-06 07:38:09

by oushixiong

[permalink] [raw]
Subject: [PATCH] drm/atomic-helper: Call stall_checks() before allocate drm_crtc_commit

From: Shixiong Ou <[email protected]>

Calling stall_checks() before allocating drm_crtc_commit not after that.

Signed-off-by: Shixiong Ou <[email protected]>
---
drivers/gpu/drm/drm_atomic_helper.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index 2444fc33dd7c..94ea878b240d 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -2283,6 +2283,10 @@ int drm_atomic_helper_setup_commit(struct drm_atomic_state *state,
funcs = state->dev->mode_config.helper_private;

for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) {
+ ret = stall_checks(crtc, nonblock);
+ if (ret)
+ return ret;
+
commit = kzalloc(sizeof(*commit), GFP_KERNEL);
if (!commit)
return -ENOMEM;
@@ -2291,10 +2295,6 @@ int drm_atomic_helper_setup_commit(struct drm_atomic_state *state,

new_crtc_state->commit = commit;

- ret = stall_checks(crtc, nonblock);
- if (ret)
- return ret;
-
/*
* Drivers only send out events when at least either current or
* new CRTC state is active. Complete right away if everything
--
2.25.1


2023-11-06 10:32:49

by Maxime Ripard

[permalink] [raw]
Subject: Re: [PATCH] drm/atomic-helper: Call stall_checks() before allocate drm_crtc_commit

Hi,

On Mon, Nov 06, 2023 at 03:37:42PM +0800, oushixiong wrote:
> From: Shixiong Ou <[email protected]>
>
> Calling stall_checks() before allocating drm_crtc_commit not after that.
>
> Signed-off-by: Shixiong Ou <[email protected]>

Generally speaking, we need much more context than that.

What bug did you encounter that makes you say that it should be moved?
How can we reproduce it? How long has that issue been in the code? What
makes you say that this is the right solution?

Maxime


Attachments:
(No filename) (516.00 B)
signature.asc (235.00 B)
Download all attachments

2023-11-06 13:26:52

by oushixiong

[permalink] [raw]
Subject: 回复: [PATCH] drm/atomic-helper: Call st all_checks() before allocate drm_crtc_commit

Hi,
I think it will cause memory leaks if too many nonblock commit works return
-EBUSY.
You can try to send large number of nonblock commits by
drmModeAtomicCommit().

-----?ʼ?ԭ??-----
??????: Maxime Ripard <[email protected]>
????ʱ??: 2023??11??6?? 18:33
?ռ???: oushixiong <[email protected]>
????: Maarten Lankhorst <[email protected]>; Thomas
Zimmermann <[email protected]>; David Airlie <[email protected]>; Daniel
Vetter <[email protected]>; [email protected];
[email protected]
????: Re: [PATCH] drm/atomic-helper: Call stall_checks() before allocate
drm_crtc_commit

Hi,

On Mon, Nov 06, 2023 at 03:37:42PM +0800, oushixiong wrote:
> From: Shixiong Ou <[email protected]>
>
> Calling stall_checks() before allocating drm_crtc_commit not after that.
>
> Signed-off-by: Shixiong Ou <[email protected]>

Generally speaking, we need much more context than that.

What bug did you encounter that makes you say that it should be moved?
How can we reproduce it? How long has that issue been in the code? What
makes you say that this is the right solution?

Maxime

2023-11-06 15:37:37

by Maxime Ripard

[permalink] [raw]
Subject: Re: 回复: [PATCH] drm/atomic-helper : Call stall_checks() before allocate drm_crtc_commit

Hi,

On Mon, Nov 06, 2023 at 09:26:15PM +0800, [email protected] wrote:
> I think it will cause memory leaks if too many nonblock commit works return
> -EBUSY.

Do you *think* or are you sure?

If you are sure, then please write down everything I mentioned earlier
in the commit log and resend the patch.

Maxime


Attachments:
(No filename) (329.00 B)
signature.asc (235.00 B)
Download all attachments