Ignore:
Timestamp:
2022-08-15T16:31:58Z (3 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
46b305a
Parents:
742f95ec
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2022-08-15 16:26:16)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2022-08-15 16:31:58)
Message:

Make timeout→cpu immutable

We ensure timeout→cpu is only changed in timeout_register(),
which by its nature is externally synchronized with timeout_unregister(),
and internally synchronized with clock(). Thus in both those contexts,
timeout→cpu is always a valid constant pointing to the CPU of last
call to timeout_register().

Doing so removes the need for synchronization using timeout→lock.
Instead, timeout→link is synchronized by timeout→cpu→timeoutlock,
and all other fields of timeout_t are also immutable outside
timeout_register(), which means they are safely synchronized by
a combination of timeout→cpu→timoutlock and external sychronization
of timeout_register/unregister.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/include/time/timeout.h

    r742f95ec rad58fd2  
    4545        IRQ_SPINLOCK_DECLARE(lock);
    4646
    47         /** Link to the list of active timeouts on CURRENT->cpu */
     47        /** Link to the list of active timeouts on timeout->cpu */
    4848        link_t link;
    4949        /** Timeout will be activated when current clock tick reaches this value. */
     
    6161extern void timeout_init(void);
    6262extern void timeout_initialize(timeout_t *);
    63 extern void timeout_reinitialize(timeout_t *);
    6463extern void timeout_register(timeout_t *, uint64_t, timeout_handler_t, void *);
    6564extern bool timeout_unregister(timeout_t *);
Note: See TracChangeset for help on using the changeset viewer.