Пример #1
0
void manager_jenkins()
{
#ifdef CONFIG_KERNEL_TESTING
    printk("<-- BEGIN_KERNEL_TESTS -->\n");
    run_registered_ktest_suites();
    printk("<-- END_KERNEL_TESTS -->\n");
#endif

    // Run userspace tests (from config specified path).
#ifdef CONFIG_USERSPACE_TESTING
    if (strlen(CONFIG_USERSPACE_TESTING_SCRIPT) != 0) {
        char exec[] = "/bin/ash";
        char *p_argv[] = {exec, CONFIG_USERSPACE_TESTING_SCRIPT, 0};

        struct file *program = do_file_open(exec, 0, 0);
        struct proc *p = proc_create(program, p_argv, NULL);
        proc_wakeup(p);
        proc_decref(p); /* let go of the reference created in proc_create() */
        kref_put(&program->f_kref);
        run_scheduler();
        // Need a way to wait for p to finish
    } else {
        printk("No user-space launcher file specified.\n");
    }
#endif
    smp_idle();
    assert(0);
}
Пример #2
0
/* RKM alarm, to run the scheduler tick (not in interrupt context) and reset the
 * alarm.  Note that interrupts will be disabled, but this is not the same as
 * interrupt context.  We're a routine kmsg, which means the core is in a
 * quiescent state. */
static void __ksched_tick(struct alarm_waiter *waiter)
{
	/* TODO: imagine doing some accounting here */
	run_scheduler();
	/* Set our alarm to go off, incrementing from our last tick (instead of
	 * setting it relative to now, since some time has passed since the alarm
	 * first went off.  Note, this may be now or in the past! */
	set_awaiter_inc(&ksched_waiter, TIMER_TICK_USEC);
	set_alarm(&per_cpu_info[core_id()].tchain, &ksched_waiter);
}
Пример #3
0
/**
 * grss_feeds_pool_switch:
 * @pool: a #GrssFeedsPool.
 * @run: %TRUE to run the pool, %FALSE to pause it.
 *
 * Permits to pause or resume the @pool fetching feeds. If @run is %TRUE, the
 * @pool starts immediately.
 */
void
grss_feeds_pool_switch (GrssFeedsPool *pool, gboolean run)
{
	if (pool->priv->running != run) {
		pool->priv->running = run;

		if (run == TRUE) {
			run_scheduler (pool);
		}
		else {
			if (pool->priv->scheduler != 0)
				g_source_remove (pool->priv->scheduler);
			cancel_all_pending (pool);
		}
	}
}
Пример #4
0
void manager_klueska()
{
    static struct proc *envs[256];
    static volatile uint8_t progress = 0;

    if (progress == 0) {
        progress++;
        panic("what do you want to do?");
        //envs[0] = kfs_proc_create(kfs_lookup_path("fillmeup"));
        __proc_set_state(envs[0], PROC_RUNNABLE_S);
        proc_run_s(envs[0]);
        warn("DEPRECATED");
    }
    run_scheduler();

    panic("DON'T PANIC");
}
Пример #5
0
void Check_Scheduler()
{
	static uint8_t previous_ticks=0;

	if(previous_ticks != Get_System_Tick())
	{
		run_scheduler(previous_ticks);
		Run_5MS_Task();
		previous_ticks++;

	}

	Run_Default_Task();
	Handle_USB();
	//Set_Pin(&RED_PIN,0);
	//IMU_Filter();
	//Set_Pin(&RED_PIN,1);
}
Пример #6
0
/* all clocks in the 1.8 V domain are stopped,
 * the PLL, the HSI and the HSE RC oscillators are disabled.
 * SRAM and register contents are preserved.
 * all I/O pins keep the same state as in the Run mode.
 * ADC, DAC, WDG, RTC, LSI_RC, and LSE_OSC can consume power. */
void __enter_stop_mode()
{
	unsigned int irqflag;

	irq_save(irqflag);
	local_irq_disable();

	PWRCLK_ENABLE();
	SCB_SCR |= 4; /* Set SLEEPDEEP bit */
	/* Clear PDDS bit in Power Control register (PWR_CR) */
	PWR_CR |= 1; /* configure LPDS bit in PWR_CR */

	stop_scheduler();
	dsb();
	__wfi();
	clock_init();
	run_scheduler();

	SCB_SCR &= ~4;
	PWR_CR &= ~1;
	PWRCLK_DISABLE();

	irq_restore(irqflag);

	/* wakeup latency:
	 * HSI RC wakeup time + regulator wakeup time from Low-power mode */

	/* Note from reference manual:
	 * If the application needs to disable the external clock before
	 * entering Stop mode, the HSEON bit must first be disabled and the
	 * system clock switched to HSI. Otherwise, if the HSEON bit remains
	 * enabled and the external clock (external oscillator) is removed when
	 * entering Stop mode, the clock security system (CSS) feature must be
	 * enabled to detect any external oscillator failure and avoid a
	 * malfunction behavior when entering stop mode. */
	//BITBAND(&RCC_CR, CSSON, ON);
}
Пример #7
0
/* Need a kmsg to just run the sched, but not to rearm */
static void __just_sched(uint32_t srcid, long a0, long a1, long a2)
{
	run_scheduler();
}
Пример #8
0
void manager_brho(void)
{
    static bool first = TRUE;
    struct per_cpu_info *pcpui = &per_cpu_info[core_id()];

    if (first) {
        printk("*** IRQs must be enabled for input emergency codes ***\n");
#ifdef CONFIG_X86
        printk("*** Hit ctrl-g to enter the monitor. ***\n");
        printk("*** Hit ctrl-q to force-enter the monitor. ***\n");
        printk("*** Hit ctrl-b for a backtrace of core 0 ***\n");
#else
        printk("*** Hit ctrl-g to enter the monitor. ***\n");
#warning "***** ctrl-g untested on riscv, check k/a/r/trap.c *****"
#endif
        first = FALSE;
    }
    /* just idle, and deal with things via interrupts.  or via face. */
    smp_idle();
    /* whatever we do in the manager, keep in mind that we need to not do
     * anything too soon (like make processes), since we'll drop in here during
     * boot if the boot sequence required any I/O (like EXT2), and we need to
     * PRKM() */
    assert(0);

#if 0 /* ancient tests below: (keeping around til we ditch the manager) */
    // for testing taking cores, check in case 1 for usage
    uint32_t corelist[MAX_NUM_CORES];
    uint32_t num = 3;
    struct file *temp_f;
    static struct proc *p;

    static uint8_t RACY progress = 0;	/* this will wrap around. */
    switch (progress++) {
    case 0:
        printk("Top of the manager to ya!\n");
        /* 124 is half of the available boxboro colors (with the kernel
         * getting 8) */
        //quick_proc_color_run("msr_dumb_while", p, 124, temp_f);
        quick_proc_run("/bin/hello", p, temp_f);
#if 0
        // this is how you can transition to a parallel process manually
        // make sure you don't proc run first
        __proc_set_state(p, PROC_RUNNING_S);
        __proc_set_state(p, PROC_RUNNABLE_M);
        p->resources[RES_CORES].amt_wanted = 5;
        spin_unlock(&p->proc_lock);
        core_request(p);
        panic("This is okay");
#endif
        break;
    case 1:
#if 0
        udelay(10000000);
        // this is a ghetto way to test restarting an _M
        printk("\nattempting to ghetto preempt...\n");
        spin_lock(&p->proc_lock);
        proc_take_allcores(p, __death);
        __proc_set_state(p, PROC_RUNNABLE_M);
        spin_unlock(&p->proc_lock);
        udelay(5000000);
        printk("\nattempting to restart...\n");
        core_request(p); // proc still wants the cores
        panic("This is okay");
        // this tests taking some cores, and later killing an _M
        printk("taking 3 cores from p\n");
        for (int i = 0; i < num; i++)
            corelist[i] = 7-i; // 7, 6, and 5
        spin_lock(&p->proc_lock);
        proc_take_cores(p, corelist, &num, __death);
        spin_unlock(&p->proc_lock);
        udelay(5000000);
        printk("Killing p\n");
        enable_irq();
        proc_destroy(p);
        printk("Killed p\n");
        panic("This is okay");

        envs[0] = kfs_proc_create(kfs_lookup_path("roslib_hello"));
        __proc_set_state(envs[0], PROC_RUNNABLE_S);
        proc_run(envs[0]);
        warn("DEPRECATED");
        break;
#endif
    case 2:
    /*
    test_smp_call_functions();
    test_checklists();
    test_barrier();
    test_print_info();
    test_lapic_status_bit();
    test_ipi_sending();
    test_pit();
    */
    default:
        printd("Manager Progress: %d\n", progress);
        // delay if you want to test rescheduling an MCP that yielded
        //udelay(15000000);
        run_scheduler();
    }
    panic("If you see me, then you probably screwed up");
    monitor(0);

    /*
    printk("Servicing syscalls from Core 0:\n\n");
    while (1) {
    	process_generic_syscalls(&envs[0], 1);
    	cpu_relax();
    }
    */
    return;
#endif
}