Skip to content

format-patch / patch replay missed merge-resolution change in drivers/gpu/drm/v3d/v3d_submit.c #7449

@joshuacov1

Description

@joshuacov1

Describe the bug

Exporting patches from repo_b/rpi-6.18.y and applying them onto linux-6.18.y does not reproduce the final tree state of repo_b/rpi-6.18.y. rpi-6.18.y refers to the official raspberry pi repo on github. linux-6.18.y is the official repo on kernel.org repo_b is a local copy of raspberrypi repo (git remote add repo_b https://github.com/raspberrypi/linux.git)

The specific observed mismatch is in:

drivers/gpu/drm/v3d/v3d_submit.c

The source branch repo_b/rpi-6.18.y contains:

ret = v3d_job_init(v3d, file_priv, &cpu_job->base,
                   v3d_cpu_job_free, 0, &se, V3D_CPU);

After exporting/applying the patch series onto linux-6.18.y, the resulting tree contains:

ret = v3d_job_init(v3d, file_priv, &cpu_job->base,
                   v3d_job_free, 0, &se, V3D_CPU);

This is incorrect relative to the source branch.

You can reproduce it with this steps:

Starting from the repository containing both branches:

git log --reverse --oneline linux-6.18.y..repo_b/rpi-6.18.y -- drivers/gpu/drm/v3d/v3d_submit.c

Observed output:

e741376342f0 drm/v3d: Clock V3D down when not in use.
37c0c660d4d8 [DOWNSTREAM] drm/v3d: Delete downstream CLK management
8a87e9a48987 [BACKPORTED] drm/v3d: Introduce Runtime Power Management
b9ec35c5945b Merge remote-tracking branch 'stable/linux-6.18.y' into rpi-6.18.y
3d40d37b968c Merge remote-tracking branch 'stable/linux-6.18.y' into rpi-6.18.y

After applying the exported patches onto linux-6.18.y, the corresponding applied branch shows no commit touching this file:

git log --reverse --oneline linux-6.18.y..HEAD -- drivers/gpu/drm/v3d/v3d_submit.c

Observed output:

<no output>

The final source branch differs from linux-6.18.y for this file:

git diff --stat linux-6.18.y..repo_b/rpi-6.18.y -- drivers/gpu/drm/v3d/v3d_submit.c

Observed output:

drivers/gpu/drm/v3d/v3d_submit.c | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)

Commit-level analysis

The relevant source history is:

e741376342f0  drm/v3d: Clock V3D down when not in use.
37c0c660d4d8  [DOWNSTREAM] drm/v3d: Delete downstream CLK management
3d40d37b968c  Merge remote-tracking branch 'stable/linux-6.18.y' into rpi-6.18.y

Commit e741376342f0 changes the CPU job free callback from:

v3d_job_free

to:

v3d_cpu_job_free

Commit 37c0c660d4d8 later changes it back from:

v3d_cpu_job_free

to:

v3d_job_free

The source branch is corrected again by merge commit:

3d40d37b968c590b949cb732e0d435c0dccd8ed0

This can be reproduced with:

git log --reverse -m -p -G 'v3d_(cpu_)?job_free.*V3D_CPU' linux-6.18.y..repo_b/rpi-6.18.y -- drivers/gpu/drm/v3d/v3d_submit.c

Relevant observed output from merge commit 3d40d37b968c:

+static void
+v3d_cpu_job_free(struct kref *ref)
+{
+       struct v3d_cpu_job *job = container_of(ref, struct v3d_cpu_job,
+                                              base.refcount);
+
+       v3d_timestamp_query_info_free(&job->timestamp_query,
+                                     job->timestamp_query.count);
+
+       v3d_performance_query_info_free(&job->performance_query,
+                                       job->performance_query.count);
+
+       if (job->indirect_csd.indirect)
+               drm_gem_object_put(job->indirect_csd.indirect);
+
+       v3d_job_free(ref);
+}

and:

 ret = v3d_job_init(v3d, file_priv, &cpu_job->base,
-                   v3d_job_free, 0, &se, V3D_CPU);
+                   v3d_cpu_job_free, 0, &se, V3D_CPU);

Therefore, the correction exists in the source branch as part of a merge-resolution diff, not as a normal non-merge commit.

Cause

The exported patch series did not preserve the merge-resolution change from:

3d40d37b968c590b949cb732e0d435c0dccd8ed0

As a result, replaying the exported patches reproduces the earlier bad state introduced by:

37c0c660d4d8 [DOWNSTREAM] drm/v3d: Delete downstream CLK management

but does not reproduce the later correction made by the merge.

Expected result

After exporting patches from:

linux-6.18.y..repo_b/rpi-6.18.y

and applying them onto linux-6.18.y, the resulting tree should match repo_b/rpi-6.18.y, at least for:

drivers/gpu/drm/v3d/v3d_submit.c

The expected call is:

ret = v3d_job_init(v3d, file_priv, &cpu_job->base,
                   v3d_cpu_job_free, 0, &se, V3D_CPU);

Actual result

The applied patch series leaves the file with:

ret = v3d_job_init(v3d, file_priv, &cpu_job->base,
                   v3d_job_free, 0, &se, V3D_CPU);

This misses the final source-branch correction from merge commit 3d40d37b968c.

Verification commands

The missing merge-resolution change can be verified with:

git show -m --cc 3d40d37b968c -- drivers/gpu/drm/v3d/v3d_submit.c

or:

git log --reverse -m -p -G 'v3d_(cpu_)?job_free.*V3D_CPU' linux-6.18.y..repo_b/rpi-6.18.y -- drivers/gpu/drm/v3d/v3d_submit.c

The applied branch can be checked with:

grep -n -A4 -B4 'v3d_job_init(v3d, file_priv, &cpu_job->base' drivers/gpu/drm/v3d/v3d_submit.c

Expected source branch result:

v3d_cpu_job_free

Incorrect replayed result:

v3d_job_free

The missing merge-resolution hunk from 3d40d37b968c should be preserved when exporting/replaying the downstream patch series, or the correction should be represented as an explicit non-merge commit before patch export.

Steps to reproduce the behaviour

see above

Device (s)

Other

System

n.a.

Logs

n.a.

Additional context

n.a.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions