Changeset 7364e2d1 in mainline


Ignore:
Timestamp:
2024-01-21T15:24:36Z (3 months ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
master
Children:
33e15a0
Parents:
41bfc64
Message:

Don't try to determine internal thread state when requesting stack trace

thread_wakeup() is idempotent, it can be called at an arbitrary time and
it will only wake up a thread when it's sleeping, with no chance of any
races. Checking if istate is present from "outside" the thread is just
an unnecessary and a wrong thing to do.

Location:
kernel/generic/src/proc
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/proc/scheduler.c

    r41bfc64 r7364e2d1  
    345345                        printf("Thread %" PRIu64 " stack trace:\n", THREAD->tid);
    346346                        stack_trace_istate(istate);
     347                } else {
     348                        printf("Thread %" PRIu64 " interrupt state not available\n", THREAD->tid);
    347349                }
    348350
  • kernel/generic/src/proc/thread.c

    r41bfc64 r7364e2d1  
    907907         */
    908908
     909        printf("Scheduling thread stack trace.\n");
    909910        irq_spinlock_lock(&thread->lock, true);
    910 
    911         bool sleeping = false;
    912         istate_t *istate = thread->udebug.uspace_state;
    913         if (istate != NULL) {
    914                 printf("Scheduling thread stack trace.\n");
    915                 thread->btrace = true;
    916                 if (atomic_get_unordered(&thread->state) == Sleeping)
    917                         sleeping = true;
    918         } else
    919                 printf("Thread interrupt state not available.\n");
    920 
     911        thread->btrace = true;
    921912        irq_spinlock_unlock(&thread->lock, true);
    922913
    923         if (sleeping)
    924                 thread_wakeup(thread);
    925 
     914        thread_wakeup(thread);
    926915        thread_put(thread);
    927916}
Note: See TracChangeset for help on using the changeset viewer.