refactoring kernel: SMP and multithreading #225

Open
opened 2025-05-01 23:23:42 +02:00 by Doczom · 2 comments
Owner

Перед добавлением поддержки нескольких ядер(SMP) необходимо провести анализ кода и внести ряд изменений в ядро, для упрощения внедрения и предотвращения неопределённо поведения процессов.

Что входит в анализ кода?

  • выявление всех данных, уникальных для каждого ядра. На данный момент найдены:
    • current_slot
    • current_slot_idx
    • current_process
    • данные списка потоков планировщика
  • анализ макросов(например изменить спинлоки)
  • проверка актуальности всех драйверов и выявление возможных проблем для поддержки многоядерности.
    Что входит в изменения ядра и драйверов?
  • замена pushf cli - popf на макросы spin_lock_irqsave и spin_unlock_irqrestore
  • уменьшение кол-ва уникальных для ядра данных(например упразднение current_slot_idx)
  • добавление макросов для получения уникальных для ядра данных (через LAPIC).
  • дополнение API создания нового потока (выбор ядра запуска потока).
Перед добавлением поддержки нескольких ядер(SMP) необходимо провести анализ кода и внести ряд изменений в ядро, для упрощения внедрения и предотвращения неопределённо поведения процессов. Что входит в анализ кода? - выявление всех данных, уникальных для каждого ядра. На данный момент найдены: - current_slot - current_slot_idx - current_process - данные списка потоков планировщика - анализ макросов(например изменить спинлоки) - проверка актуальности всех драйверов и выявление возможных проблем для поддержки многоядерности. Что входит в изменения ядра и драйверов? - замена pushf cli - popf на макросы spin_lock_irqsave и spin_unlock_irqrestore - уменьшение кол-ва уникальных для ядра данных(например упразднение current_slot_idx) - добавление макросов для получения уникальных для ядра данных (через LAPIC). - дополнение API создания нового потока (выбор ядра запуска потока).
Member

Via Google Translate:

Before adding support for multiple cores (SMP), it is necessary to conduct a code analysis and make a number of changes to the kernel to simplify implementation and prevent undefined process behavior.

What is included in the code analysis?

  • identification of all data unique to each core. At the moment, the following have been found:
    current_slot
    current_slot_idx
    current_process
    scheduler thread list data
  • macro analysis (e.g. change spinlocks)
  • checking the relevance of all drivers and identifying possible problems for multi-core support. What is included in the kernel and driver changes?
  • replacing pushf cli - popf with spin_lock_irqsave and spin_unlock_irqrestore macros
  • reducing the amount of data unique to the kernel (e.g. eliminating current_slot_idx)
  • adding macros to obtain data unique to the kernel (via LAPIC).
  • supplementing the API for creating a new thread (selecting the thread launch kernel).
Via Google Translate: > Before adding support for multiple cores (SMP), it is necessary to conduct a code analysis and make a number of changes to the kernel to simplify implementation and prevent undefined process behavior. > > What is included in the code analysis? > > - identification of all data unique to each core. At the moment, the following have been found: > current_slot > current_slot_idx > current_process > scheduler thread list data > - macro analysis (e.g. change spinlocks) > - checking the relevance of all drivers and identifying possible problems for multi-core support. What is included in the kernel and driver changes? > - replacing pushf cli - popf with spin_lock_irqsave and spin_unlock_irqrestore macros > - reducing the amount of data unique to the kernel (e.g. eliminating current_slot_idx) > - adding macros to obtain data unique to the kernel (via LAPIC). > - supplementing the API for creating a new thread (selecting the thread launch kernel).
ace-dent added the
Category/Kernel
Kind
Feature
labels 2025-05-14 17:08:53 +02:00
Author
Owner
  • add current_tid/current_pid variables
  • switch current_slot_idx locks on current_tid/current_pid
- add current_tid/current_pid variables - switch current_slot_idx locks on current_tid/current_pid
Sign in to join this conversation.
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: KolibriOS/kolibrios#225
No description provided.