Changeset 33e15a0 in mainline


Ignore:
Timestamp:
2024-01-21T15:36:03Z (3 months ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
master
Children:
11909ce3
Parents:
7364e2d1
Message:

Make thread→btrace weakly atomic, to avoid need for thread lock

Location:
kernel/generic
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/include/proc/thread.h

    r7364e2d1 r33e15a0  
    170170         * to the kernel console upon scheduling this thread.
    171171         */
    172         bool btrace;
     172        atomic_int_fast8_t btrace;
    173173
    174174        /** Debugging stuff */
  • kernel/generic/src/proc/scheduler.c

    r7364e2d1 r33e15a0  
    340340
    341341#ifdef CONFIG_UDEBUG
    342         if (THREAD->btrace) {
     342        if (atomic_get_unordered(&THREAD->btrace)) {
    343343                istate_t *istate = THREAD->udebug.uspace_state;
    344344                if (istate != NULL) {
     
    349349                }
    350350
    351                 THREAD->btrace = false;
     351                atomic_set_unordered(&THREAD->btrace, false);
    352352        }
    353353#endif
  • kernel/generic/src/proc/thread.c

    r7364e2d1 r33e15a0  
    289289#ifdef CONFIG_UDEBUG
    290290        /* Initialize debugging stuff */
    291         thread->btrace = false;
     291        atomic_init(&thread->btrace, false);
    292292        udebug_thread_initialize(&thread->udebug);
    293293#endif
     
    908908
    909909        printf("Scheduling thread stack trace.\n");
    910         irq_spinlock_lock(&thread->lock, true);
    911         thread->btrace = true;
    912         irq_spinlock_unlock(&thread->lock, true);
     910        atomic_set_unordered(&thread->btrace, true);
    913911
    914912        thread_wakeup(thread);
Note: See TracChangeset for help on using the changeset viewer.