All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: "Christian König" <christian.koenig@amd.com>
Cc: Mikhail Gavrilov <mikhail.v.gavrilov@gmail.com>,
	kernel test robot <lkp@intel.com>,
	jpoimboe@kernel.org, llvm@lists.linux.dev,
	oe-kbuild-all@lists.linux.dev,
	Alex Deucher <alexander.deucher@amd.com>,
	Linux List Kernel Mailing <linux-kernel@vger.kernel.org>
Subject: Re: [linux-next:master 14191/14955] vmlinux.o: error: objtool: amdgpu_vm_handle_fault+0x186: sibling call from callable instruction with modified stack frame
Date: Wed, 24 Jun 2026 13:16:11 +0200	[thread overview]
Message-ID: <20260624111611.GC48970@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <0ff5f3f7-c2d3-4b56-95ad-400626d8abb9@amd.com>

On Wed, Jun 24, 2026 at 01:04:36PM +0200, Christian König wrote:

> > Best I can come up with is something like this. Not exactly nice, but
> > should be fairly trivial to do.
> 
> Yeah, definitely not nice. The macro was created exactly because
> people messed this approach up more than once.
> 
> I could live with some other hack/workaround, but clearly not with
> changing all users.
> 
> Maybe we can goto the fixed named label but have an extra variable to
> check that we are in the right scope or something like that.

The fixed name will break test_multiple_loops() and any other user that
actually does that (couldn't find one in a hurry).

That would look like so; by making the drm_exec_retry*() helpers depend
on __drm_exec_loop, it can only be used inside
drm_exec_until_all_locked().



---
diff --git a/drivers/gpu/drm/tests/drm_exec_test.c b/drivers/gpu/drm/tests/drm_exec_test.c
index 2fc47f3b463b..fbb887930e6d 100644
--- a/drivers/gpu/drm/tests/drm_exec_test.c
+++ b/drivers/gpu/drm/tests/drm_exec_test.c
@@ -166,9 +166,9 @@ static void test_prepare_array(struct kunit *test)
 	drm_gem_private_object_init(priv->drm, gobj2, PAGE_SIZE);
 
 	drm_exec_init(&exec, DRM_EXEC_INTERRUPTIBLE_WAIT, 0);
-	drm_exec_until_all_locked(&exec)
-		ret = drm_exec_prepare_array(&exec, array, ARRAY_SIZE(array),
-					     1);
+	drm_exec_until_all_locked(&exec) {
+		ret = drm_exec_prepare_array(&exec, array, ARRAY_SIZE(array), 1);
+	}
 	KUNIT_EXPECT_EQ(test, ret, 0);
 	drm_exec_fini(&exec);
 
@@ -176,26 +176,6 @@ static void test_prepare_array(struct kunit *test)
 	drm_gem_private_object_fini(gobj2);
 }
 
-static void test_multiple_loops(struct kunit *test)
-{
-	struct drm_exec exec;
-
-	drm_exec_init(&exec, DRM_EXEC_INTERRUPTIBLE_WAIT, 0);
-	drm_exec_until_all_locked(&exec)
-	{
-		break;
-	}
-	drm_exec_fini(&exec);
-
-	drm_exec_init(&exec, DRM_EXEC_INTERRUPTIBLE_WAIT, 0);
-	drm_exec_until_all_locked(&exec)
-	{
-		break;
-	}
-	drm_exec_fini(&exec);
-	KUNIT_SUCCEED(test);
-}
-
 static struct kunit_case drm_exec_tests[] = {
 	KUNIT_CASE(sanitycheck),
 	KUNIT_CASE(test_lock),
@@ -203,7 +183,6 @@ static struct kunit_case drm_exec_tests[] = {
 	KUNIT_CASE(test_duplicates),
 	KUNIT_CASE(test_prepare),
 	KUNIT_CASE(test_prepare_array),
-	KUNIT_CASE(test_multiple_loops),
 	{}
 };
 
diff --git a/include/drm/drm_exec.h b/include/drm/drm_exec.h
index 8725ba92ff91..4a6b6aba4f15 100644
--- a/include/drm/drm_exec.h
+++ b/include/drm/drm_exec.h
@@ -101,17 +101,6 @@ drm_exec_obj(struct drm_exec *exec, unsigned long index)
 #define drm_exec_for_each_locked_object_reverse(exec, obj)		\
 	__drm_exec_for_each_locked_object_reverse(exec, obj, __UNIQUE_ID(drm_exec))
 
-/*
- * Helper to drm_exec_until_all_locked(). Don't use directly.
- *
- * Since labels can't be defined local to the loop's body we use a jump pointer
- * to make sure that the retry is only used from within the loop's body.
- */
-#define __drm_exec_until_all_locked(exec, _label)			 \
-_label:									 \
-	for (void *const __maybe_unused __drm_exec_retry_ptr = &&_label; \
-	     drm_exec_cleanup(exec);)
-
 /**
  * drm_exec_until_all_locked - loop until all GEM objects are locked
  * @exec: drm_exec object
@@ -121,7 +110,8 @@ _label:									 \
  * guaranteed that no GEM object is locked.
  */
 #define drm_exec_until_all_locked(exec)					\
-	__drm_exec_until_all_locked(exec, __UNIQUE_ID(drm_exec))
+	__drm_exec_retry: __maybe_unused;				\
+	for (bool __drm_exec_loop __maybe_unused = true; drm_exec_cleanup(exec);)
 
 /**
  * drm_exec_retry_on_contention - restart the loop to grap all locks
@@ -132,8 +122,9 @@ _label:									 \
  */
 #define drm_exec_retry_on_contention(exec)			\
 	do {							\
-		if (unlikely(drm_exec_is_contended(exec)))	\
-			goto *__drm_exec_retry_ptr;		\
+		if (unlikely(__drm_exec_loop &&			\
+			     drm_exec_is_contended(exec)))	\
+			goto __drm_exec_retry;			\
 	} while (0)
 
 /**
@@ -157,8 +148,9 @@ static inline bool drm_exec_is_contended(struct drm_exec *exec)
  */
 #define drm_exec_retry(_exec)					\
 	do {							\
-		WARN_ON((_exec)->contended != DRM_EXEC_DUMMY);	\
-		goto *__drm_exec_retry_ptr;			\
+		WARN_ON(__drm_exec_loop &&			\
+			(_exec)->contended != DRM_EXEC_DUMMY);	\
+		goto __drm_exec_retry;				\
 	} while (0)
 
 /**

  reply	other threads:[~2026-06-24 11:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-23 15:15 [linux-next:master 14191/14955] vmlinux.o: error: objtool: amdgpu_vm_handle_fault+0x186: sibling call from callable instruction with modified stack frame kernel test robot
2026-06-23 20:57 ` Mikhail Gavrilov
2026-06-24  9:28   ` Peter Zijlstra
2026-06-24  9:48     ` Christian König
2026-06-24 10:56       ` Peter Zijlstra
2026-06-24 11:04         ` Christian König
2026-06-24 11:16           ` Peter Zijlstra [this message]
2026-06-24 11:21             ` Peter Zijlstra
2026-06-24 12:36     ` Mikhail Gavrilov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260624111611.GC48970@noisy.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=alexander.deucher@amd.com \
    --cc=christian.koenig@amd.com \
    --cc=jpoimboe@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=llvm@lists.linux.dev \
    --cc=mikhail.v.gavrilov@gmail.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.