Hey folks,

while staring at PR 55415 and recently having learned that powerpc fast
softints are broken, I found a strange ancient line of code that I think
is not correct in the current world order any more:

Index: kern_synch.c
===================================================================
RCS file: /cvsroot/src/sys/kern/kern_synch.c,v
retrieving revision 1.351
diff -u -p -r1.351 kern_synch.c
--- kern_synch.c        29 Jun 2022 22:27:01 -0000      1.351
+++ kern_synch.c        7 Jul 2022 19:16:13 -0000
@@ -553,7 +553,8 @@ nextlwp(struct cpu_info *ci, struct sche
         * the update to ci_want_resched will become globally visible before
         * the release of spc_mutex becomes globally visible.
         */
-       ci->ci_want_resched = ci->ci_data.cpu_softints;
+       if (ci->ci_data.cpu_softints == 0)
+               ci->ci_want_resched = 0;
 
        return newl;
 }


I guess in older times ci->ci_want_resched was used as a boolean flag, so only
0 or !0 did matter - but nowadays it is a flag word of various bits:

#define     RESCHED_REMOTE          0x01    /* request is for a remote CPU */
#define     RESCHED_IDLE            0x02    /* idle LWP observed */
#define     RESCHED_UPREEMPT        0x04    /* immediate user ctx switch */
#define     RESCHED_KPREEMPT        0x08    /* immediate kernel ctx switch */


The MD usage of ci_data.cpu_softints on powerpc is a bitmask of pending
softint IPLs, which could easily collide with above flags.

I don't know if this has any bad consequences, but it seems cleaner
to avoid the possibility and either clear or leave alone.

Or am I overlooking some magic?

Martin

Reply via email to