Skip to contentSkip to conversation

2.4.19-pre3 s390 ret_from_fork patch

PATCH Pete Zaitcev 1 participant 1 message Mar 15, 2002 s390

lore
Share & tools
lore
#0 lore raw

Greetings:

The 2.4.19-pre3 works just dandy as it is without this patch, but it is needed for O(1) scheduler. I think Martin was going to forward this into 2.5.x tree, where O(1) is standard.

The problem is that schedule_tail() is supposed to unlock runqueue, but if interrupts are enabled before that happens, a timer tick may squeeze in and deadlock. I observed such situation myself.

So, I would like this to be in 2.4.19 for the sake of O(1) users. Any objections?

-- Pete

arch/s390/kernel/entry.S +4 -3
diff -ur -X dontdiff linux-2.4.19-pre3/arch/s390/kernel/entry.S linux-2.4.19-pre3-390/arch/s390/kernel/entry.S
@@ -254,13 +254,14 @@
 ret_from_fork:  
         basr    %r13,0
         l       %r13,.Lentry_base-.(%r13)  # setup base pointer to &entry_base
+	# not saving R14 here because we go to sysc_return ultimately
+	l	%r1,BASED(.Lschedtail)
+	basr	%r14,%r1          # call schedule_tail (unlock stuff)
         GET_CURRENT               # load pointer to task_struct to R9
         stosm   24(%r15),0x03     # reenable interrupts
         sr      %r0,%r0           # child returns 0
         st      %r0,SP_R2(%r15)   # store return value (change R2 on stack)
-        l       %r1,BASED(.Lschedtail)
-	la      %r14,BASED(sysc_return)
-        br      %r1               # call schedule_tail, return to sysc_return
+	b	BASED(sysc_return)
 
 #
 # clone, fork, vfork, exec and sigreturn need glue,
arch/s390x/kernel/entry.S +2 -2
diff -ur -X dontdiff linux-2.4.19-pre3/arch/s390x/kernel/entry.S linux-2.4.19-pre3-390/arch/s390x/kernel/entry.S
@@ -240,11 +240,11 @@
 #
         .globl  ret_from_fork
 ret_from_fork:  
+	brasl	%r14,schedule_tail
         GET_CURRENT               # load pointer to task_struct to R9
         stosm   48(%r15),0x03     # reenable interrupts
 	xc      SP_R2(8,%r15),SP_R2(%r15) # child returns 0
-	larl    %r14,sysc_return
-        jg      schedule_tail     # return to sysc_return
+	j	sysc_return
 
 #
 # clone, fork, vfork, exec and sigreturn need glue,