Changeset 571cc2d in mainline for kernel/generic/src/log/log.c


Ignore:
Timestamp:
2025-04-17T15:14:03Z (5 days ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
master
Children:
d5b37b6
Parents:
af77459
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2025-04-11 15:56:15)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2025-04-17 15:14:03)
Message:

Use irq_spinlock_t instead of plain spinlock_t in console code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/log/log.c

    raf77459 r571cc2d  
    6060
    6161/** Cyclic buffer holding the data for kernel log */
    62 uint8_t log_buffer[LOG_LENGTH] __attribute__((aligned(PAGE_SIZE)));
     62static uint8_t log_buffer[LOG_LENGTH] __attribute__((aligned(PAGE_SIZE)));
    6363
    6464/** Kernel log initialized */
     
    6666
    6767/** Position in the cyclic buffer where the first log entry starts */
    68 size_t log_start = 0;
     68static size_t log_start = 0;
    6969
    7070/** Sum of length of all log entries currently stored in the cyclic buffer */
    71 size_t log_used = 0;
     71static size_t log_used = 0;
    7272
    7373/** Log spinlock */
    74 SPINLOCK_STATIC_INITIALIZE_NAME(log_lock, "log_lock");
     74static IRQ_SPINLOCK_INITIALIZE(log_lock);
    7575
    7676/** Overall count of logged messages, which may overflow as needed */
     
    152152{
    153153        console_lock();
    154         spinlock_lock(&log_lock);
    155         spinlock_lock(&kio_lock);
     154        irq_spinlock_lock(&log_lock, true);
     155        irq_spinlock_lock(&kio_lock, true);
    156156
    157157        log_current_start = (log_start + log_used) % LOG_LENGTH;
     
    180180
    181181        kio_push_char('\n');
    182         spinlock_unlock(&kio_lock);
    183         spinlock_unlock(&log_lock);
     182        irq_spinlock_unlock(&kio_lock, true);
     183        irq_spinlock_unlock(&log_lock, true);
    184184
    185185        /* This has to be called after we released the locks above */
     
    195195                return;
    196196
    197         spinlock_lock(&log_lock);
     197        irq_spinlock_lock(&log_lock, true);
    198198        if (next_for_uspace < log_used)
    199199                event_notify_0(EVENT_KLOG, true);
    200         spinlock_unlock(&log_lock);
     200        irq_spinlock_unlock(&log_lock, true);
    201201}
    202202
     
    307307                rc = EOK;
    308308
    309                 spinlock_lock(&log_lock);
     309                irq_spinlock_lock(&log_lock, true);
    310310
    311311                while (next_for_uspace < log_used) {
     
    337337                }
    338338
    339                 spinlock_unlock(&log_lock);
     339                irq_spinlock_unlock(&log_lock, true);
    340340
    341341                if (rc != EOK) {
Note: See TracChangeset for help on using the changeset viewer.