diff mbox series

[6.12] Revert "um: work around sched_yield not yielding in time-travel mode"

Message ID 20250509095040.33355-1-chunkeey@gmail.com
State Not Applicable
Headers show
Series [6.12] Revert "um: work around sched_yield not yielding in time-travel mode" | expand

Commit Message

Christian Lamparter May 9, 2025, 9:50 a.m. UTC
This reverts commit 887c5c12e80c ("um: work around sched_yield not yielding in time-travel mode")
added with v6.12.25.

Reason being that the patch depends on at least
commit 0b8b2668f998 ("um: insert scheduler ticks when userspace does not yield")
in order to build. Otherwise it fails with:

| /usr/bin/ld: arch/um/kernel/skas/syscall.o: in function `handle_syscall':
|      linux-6.12.27/arch/um/kernel/skas/syscall.c:43:(.text+0xa2): undefined
| reference to `tt_extra_sched_jiffies'
| collect2: error: ld returned 1 exit status

The author Benjamin Berg commented: "I think it is better to just not backport
commit 0b8b2668f998 ("um: insert scheduler ticks when userspace does not yield")
"

Link: https://lore.kernel.org/linux-um/8ce0b6056a9726e540f61bce77311278654219eb.camel@sipsolutions.net/
Cc: <stable@vger.kernel.org> # 6.12.y
Cc: Benjamin Berg <benjamin.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>

---

Just in case, this throws someone else for a space-time loop:

What's interessting/very strange strange about this time-travel stuff:
|commit 0b8b2668f998 ("um: insert scheduler ticks when userspace does not yield")

 $ git describe 0b8b2668f998
=> v6.12-rc2-43-g0b8b2668f998
(from what I know this is 43 patches on top of v6.12-rc2 as per the man page:
"The command finds the most recent tag that is reachable from a commit. [...]
it suffixes the tag name with the number of additional commits on top of the tagged
object and the abbreviated object name of the most recent commit."

But it was merged as part of: uml-for-linus-6.13-rc1 :
https://lore.kernel.org/lkml/1155823186.11802667.1732921581257.JavaMail.zimbra@nod.at/
---
 arch/um/include/linux/time-internal.h |  2 --
 arch/um/kernel/skas/syscall.c         | 11 -----------
 2 files changed, 13 deletions(-)

Comments

Johannes Berg May 9, 2025, 10:03 a.m. UTC | #1
On Fri, 2025-05-09 at 11:50 +0200, Christian Lamparter wrote:
> 
> What's interessting/very strange strange about this time-travel stuff:
> > commit 0b8b2668f998 ("um: insert scheduler ticks when userspace does not yield")
> 
>  $ git describe 0b8b2668f998
> => v6.12-rc2-43-g0b8b2668f998
> (from what I know this is 43 patches on top of v6.12-rc2 as per the man page:
> "The command finds the most recent tag that is reachable from a commit. [...]
> it suffixes the tag name with the number of additional commits on top of the tagged
> object and the abbreviated object name of the most recent commit."
> 
> But it was merged as part of: uml-for-linus-6.13-rc1 :
> https://lore.kernel.org/lkml/1155823186.11802667.1732921581257.JavaMail.zimbra@nod.at/

That's not all that implausible - UML maintenance is slow and we all
have a lot of things to do... so chances are we just didn't send a pull
request for 6.12-rc even though the tree was already there. I'm trying
to improve that but it's not really a focus for any of us.

johannes
Johannes Berg May 11, 2025, 7:23 p.m. UTC | #2
On Fri, 2025-05-09 at 11:50 +0200, Christian Lamparter wrote:
> 
> What's interessting/very strange strange about this time-travel stuff:
> > commit 0b8b2668f998 ("um: insert scheduler ticks when userspace does not yield")
> 
>  $ git describe 0b8b2668f998
> => v6.12-rc2-43-g0b8b2668f998
> 

Come to think of it, often you just want "git describe --contains":

$ git describe --contains --match=v* 0b8b2668f998
v6.13-rc1~18^2~25

johannes
Christian Lamparter May 11, 2025, 8:04 p.m. UTC | #3
On 5/11/25 9:23 PM, Johannes Berg wrote:
> On Fri, 2025-05-09 at 11:50 +0200, Christian Lamparter wrote:
>>
>> What's interesting/very strange strange about this time-travel stuff:
>>> commit 0b8b2668f998 ("um: insert scheduler ticks when userspace does not yield")
>>
>>   $ git describe 0b8b2668f998
>> => v6.12-rc2-43-g0b8b2668f998
>>
> 
> Come to think of it, often you just want "git describe --contains":
> 
> $ git describe --contains --match=v* 0b8b2668f998
> v6.13-rc1~18^2~25

yeah, I'm wondering if this 'git describe vs git describe --contains' could be the
reason why the patch was AUTOSEL'd? I have no idea how Sasha's helper works though.

As for UML: Your work is greatly appreciated. I've ran into this because OpenWrt is
currently in the process of adapting to the 6.12 LTS:
https://github.com/openwrt/openwrt/pull/18666

Cheers,
Christian
diff mbox series

Patch

diff --git a/arch/um/include/linux/time-internal.h b/arch/um/include/linux/time-internal.h
index 138908b999d7..b22226634ff6 100644
--- a/arch/um/include/linux/time-internal.h
+++ b/arch/um/include/linux/time-internal.h
@@ -83,8 +83,6 @@  extern void time_travel_not_configured(void);
 #define time_travel_del_event(...) time_travel_not_configured()
 #endif /* CONFIG_UML_TIME_TRAVEL_SUPPORT */
 
-extern unsigned long tt_extra_sched_jiffies;
-
 /*
  * Without CONFIG_UML_TIME_TRAVEL_SUPPORT this is a linker error if used,
  * which is intentional since we really shouldn't link it in that case.
diff --git a/arch/um/kernel/skas/syscall.c b/arch/um/kernel/skas/syscall.c
index a5beaea2967e..b09e85279d2b 100644
--- a/arch/um/kernel/skas/syscall.c
+++ b/arch/um/kernel/skas/syscall.c
@@ -31,17 +31,6 @@  void handle_syscall(struct uml_pt_regs *r)
 		goto out;
 
 	syscall = UPT_SYSCALL_NR(r);
-
-	/*
-	 * If no time passes, then sched_yield may not actually yield, causing
-	 * broken spinlock implementations in userspace (ASAN) to hang for long
-	 * periods of time.
-	 */
-	if ((time_travel_mode == TT_MODE_INFCPU ||
-	     time_travel_mode == TT_MODE_EXTERNAL) &&
-	    syscall == __NR_sched_yield)
-		tt_extra_sched_jiffies += 1;
-
 	if (syscall >= 0 && syscall < __NR_syscalls) {
 		unsigned long ret = EXECUTE_SYSCALL(syscall, regs);