mirror of
https://github.com/mmueller41/genode.git
synced 2026-01-21 20:42:56 +01:00
WIP: scheduler
This commit is contained in:
@@ -32,6 +32,7 @@ void gpgpu::Session_component::register_vm(Genode::size_t size, Genode::Ram_data
|
||||
{
|
||||
ram_cap = _global_gpgpu_genode->allocRamCap(size, mapped_base, base);
|
||||
ram_cap_vm = ram_cap;
|
||||
// TODO: register vgpu to scheduler
|
||||
}
|
||||
|
||||
int gpgpu::Session_component::start_task(unsigned long kconf)
|
||||
@@ -65,7 +66,8 @@ int gpgpu::Session_component::start_task(unsigned long kconf)
|
||||
Kernel* kernel = (Kernel*)_global_gpgpu_genode->aligned_alloc(0, sizeof(Kernel));
|
||||
vgpu.add_kernel(kernel);
|
||||
|
||||
free this somewhere
|
||||
TODO: free this somewhere
|
||||
TODO: start scheduler if its idling
|
||||
*/
|
||||
|
||||
static int id = 0;
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
#include "../uos-intel-gpgpu/driver/gpgpu_driver.h"
|
||||
#include "../uos-intel-gpgpu/driver/ppgtt32.h"
|
||||
|
||||
void gpgpu::Scheduler::schedule_next() {
|
||||
void gpgpu::Scheduler::schedule_next()
|
||||
{
|
||||
VGpu *next;
|
||||
if ((next = static_cast<VGpu*>(_run_list.first()))) {
|
||||
this->dispatch(*next);
|
||||
@@ -17,7 +18,12 @@ void gpgpu::Scheduler::schedule_next() {
|
||||
_curr_vgpu = nullptr;
|
||||
}
|
||||
|
||||
void gpgpu::Scheduler::handle_gpu_event() {
|
||||
void gpgpu::Scheduler::handle_gpu_event()
|
||||
{
|
||||
// reduce frequency
|
||||
GPGPU_Driver& gpgpudriver = GPGPU_Driver::getInstance();
|
||||
gpgpudriver.setMinFreq();
|
||||
|
||||
/* Switch to next vGPU in the run list */
|
||||
schedule_next();
|
||||
|
||||
@@ -29,10 +35,12 @@ void gpgpu::Scheduler::handle_gpu_event() {
|
||||
Kernel *next = _curr_vgpu->take_kernel();
|
||||
|
||||
if (!next) /* If there is no kernel for the vGPU left */
|
||||
schedule_next(); /* pick the next vGPU, maybe it has got some kernels for us. */
|
||||
{
|
||||
// TODO: search for kernels in vgpu list
|
||||
return;
|
||||
}
|
||||
|
||||
// set frequency
|
||||
GPGPU_Driver& gpgpudriver = GPGPU_Driver::getInstance();
|
||||
gpgpudriver.setMaxFreq();
|
||||
|
||||
// run gpgpu task
|
||||
|
||||
@@ -41,6 +41,26 @@ namespace gpgpu {
|
||||
* a kernel has finished its execution.
|
||||
*/
|
||||
void handle_gpu_event();
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
* @param vgpu
|
||||
*/
|
||||
void add_vgpu(VGpu* vgpu)
|
||||
{
|
||||
_run_list.insert(vgpu);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
* @param vgpu
|
||||
*/
|
||||
void remove_vgpu(VGpu* vgpu)
|
||||
{
|
||||
_run_list.remove(vgpu);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,17 @@ namespace gpgpu {
|
||||
ready_list.insert(kernel);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
* @return true
|
||||
* @return false
|
||||
*/
|
||||
bool has_kernel() const
|
||||
{
|
||||
return ready_list.first() == nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Dequeue a kernel from the ready list
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user