Changeset f2cb80a in mainline for kernel/generic/include/cpu.h


Ignore:
Timestamp:
2024-02-23T17:57:23Z (3 months ago)
Author:
GitHub <noreply@…>
Children:
192019f
Parents:
86f862c (diff), 90ba06c (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
boba-buba <120932204+boba-buba@…> (2024-02-23 17:57:23)
git-committer:
GitHub <noreply@…> (2024-02-23 17:57:23)
Message:

Merge branch 'HelenOS:master' into topic/packet-capture

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/include/cpu.h

    r86f862c rf2cb80a  
    4444#include <arch.h>
    4545
    46 #define CPU                  CURRENT->cpu
     46#define CPU                  (CURRENT->cpu)
     47#define CPU_LOCAL            (&CPU->local)
     48
     49/**
     50 * Contents of CPU_LOCAL. These are variables that are only ever accessed by
     51 * the CPU they belong to, so they don't need any synchronization,
     52 * just locally disabled interrupts.
     53 */
     54typedef struct cpu_local {
     55        /**
     56         * When system clock loses a tick, it is
     57         * recorded here so that clock() can react.
     58         */
     59        size_t missed_clock_ticks;
     60
     61        uint64_t current_clock_tick;
     62        uint64_t preempt_deadline;  /* < when should the currently running thread be preempted */
     63        uint64_t relink_deadline;
     64
     65        /**
     66         * Stack used by scheduler when there is no running thread.
     67         * This field is unchanged after initialization.
     68         */
     69        uint8_t *stack;
     70
     71        /**
     72         * Processor cycle accounting.
     73         */
     74        bool idle;
     75        uint64_t last_cycle;
     76
     77        context_t scheduler_context;
     78
     79        struct thread *prev_thread;
     80} cpu_local_t;
    4781
    4882/** CPU structure.
     
    6397
    6498        /**
    65          * When system clock loses a tick, it is
    66          * recorded here so that clock() can react.
    67          * This variable is CPU-local and can be
    68          * only accessed when interrupts are
    69          * disabled.
    70          */
    71         size_t missed_clock_ticks;
    72 
    73         /** Can only be accessed by the CPU represented by this structure when interrupts are disabled. */
    74         uint64_t current_clock_tick;
    75         uint64_t preempt_deadline;  /* < when should the currently running thread be preempted */
    76         uint64_t relink_deadline;
    77 
    78         /**
    7999         * Processor cycle accounting.
    80100         */
    81         bool idle;
    82         uint64_t last_cycle;
    83101        atomic_time_stat_t idle_cycles;
    84102        atomic_time_stat_t busy_cycles;
     
    103121        _Atomic(struct thread *) fpu_owner;
    104122
    105         /**
    106          * Stack used by scheduler when there is no running thread.
    107          */
    108         uint8_t *stack;
     123        cpu_local_t local;
    109124} cpu_t;
    110125
Note: See TracChangeset for help on using the changeset viewer.