Example #1
0
int main(int argc,
         char **argv)
{
    errval_t err;

    debug_printf("Inter Card Transfer Test started.\n");

    coreid_t core = 2;
    char *name = "k1om/sbin/xeon_phi_inter";

    xphi_dom_id_t domid0;

    err = xeon_phi_client_spawn(0, core, name, NULL, NULL_CAP, &domid0);
    if (err_is_fail(err)) {
        USER_PANIC_ERR(err, "could not send the spawn message");
    }

    xphi_dom_id_t domid1;
    err = xeon_phi_client_spawn(1, core, name, NULL, NULL_CAP, &domid1);
    if (err_is_fail(err)) {
        USER_PANIC_ERR(err, "could not send the spawn message");
    }

    debug_printf("Inter Card Transfer Test: Main Loop\n");

    messages_handler_loop();

    debug_printf("Terminated.\n");

}
Example #2
0
int main(int argc, const char *argv[])
{
    errval_t err;

    printf("Spawnd up.\n");


    vfs_init();
    
    my_core_id = disp_get_core_id();


    // read in the bootmodules file so that we know what to start
    get_bootmodules();

    // construct sane inital environment
    init_environ();

    err = start_service();
    if (err_is_fail(err)) {
            USER_PANIC_ERR(err, "failed to start spawnd service loop");
    }

    messages_handler_loop();
}
Example #3
0
int main(int argc, char *argv[])
{
    // Request multiboot caps and bootinfo from monitor
    bootstrap();

    messages_handler_loop();
    return 0;
}
Example #4
0
int main(int argc, char *argv[])
{
    errval_t err;

    /* Set my core id */
    my_core_id = disp_get_core_id();
    strcpy(my_name, argv[0]);

    printf("entered\n");
    bench_init();
    printf("bench_init done\n");

    if (argc == 1) { /* server */

        /*
         1. spawn domain,
         2. setup a server,
         3. wait for client to connect,
         4. run experiment
         */

        char *xargv[] = { my_name, "dummy", "dummy", "dummy", NULL };
        err = spawn_program(1, my_name, xargv, NULL, SPAWN_FLAGS_DEFAULT, NULL);
        assert(err_is_ok(err));

        /* Setup a server */
        err = bench_export(NULL, export_cb, connect_cb, get_default_waitset(),
                IDC_BIND_FLAGS_DEFAULT);
        assert(err_is_ok(err));

    } else {
        /* Connect to the server */

        printf("ns lookup\n");
        err = nameservice_blocking_lookup("multihop_server", &iref);
        if (err_is_fail(err)) {
            DEBUG_ERR(err, "nameservice_blocking_lookup failed");
            abort();
        }

        printf("bench_bind\n");
        // bind a first time for signaling
        err = bench_bind(iref, bind_signal_cb, NULL, get_default_waitset(),
                IDC_BIND_FLAGS_DEFAULT);
        if (err_is_fail(err)) {
            DEBUG_ERR(err, "bind failed");
            abort();
        }
    }
    messages_handler_loop();
    return 0;
}
Example #5
0
int main(int argc, char *argv[])
{
    errval_t err;
    if (argc != 2) {
        printf("Usage %s: <Num additional threads>\n", argv[0]);
        exit(-1);
    }


    //printf("main running on %d\n", disp_get_core_id());

    int cores = strtol(argv[1], NULL, 10) + 1;

    NPROC = cores -1;
    BARINIT(barrier, NPROC);

    uint64_t before = rdtsc();
    times[0] = before;

    trace_event(TRACE_SUBSYS_BENCH, TRACE_EVENT_BENCH_PCBENCH, 1);
    for (int i = 1; i < cores; i++) {
        err = domain_new_dispatcher(i + disp_get_core_id(),
                                    domain_spanned_callback,
                                    (void*)(uintptr_t)i);
        if (err_is_fail(err)) {
            USER_PANIC_ERR(err, "domain_new_dispatcher failed");
        }
    }

    while (ndispatchers < cores) {
        thread_yield();
    }
    uint64_t finish = rdtsc();

    trace_event(TRACE_SUBSYS_BENCH, TRACE_EVENT_BENCH_PCBENCH, 0);

    //sys_print("\nDone\n", 6);
    printf("spantest: Done in %"PRIu64" cycles\n", finish-before);

    //trace_dump();

    for(int i = 1; i < cores; i++) {
        err = domain_thread_create_on(i, remote, NULL);
        assert(err_is_ok(err));
    }

    messages_handler_loop();
    return 0;
}
Example #6
0
int main(int argc, const char *argv[])
{
    errval_t err;

    printf("Spawnd up.\n");


    vfs_init();

    my_core_id = disp_get_core_id();


#if 0
    debug_printf("spawnd invoked on core %d as:", my_core_id);
    for (int i = 0; i < argc; i++) {
        printf(" %s", argv[i]);
    }
    printf("\n");
#endif

    // read in the bootmodules file so that we know what to start
    get_bootmodules();

    // construct sane inital environment
    init_environ();

    if (argc >= 2 && strcmp(argv[1],"boot") == 0) {
        debug_printf("we're bsp. start other cores.\n");
        // if we're the BSP, bring up the other cores
        is_bsp_core = true;
#if defined(USE_KALUGA_DVM) && (!defined(__arm__) && !defined(__scc__) &&!defined(__k1om__))
        err = start_service();
#else
        bsp_bootup(gbootmodules, argc, argv);
#endif
    } else {
        // otherwise offer the spawn service
        err = start_service();
        if (err_is_fail(err)) {
            USER_PANIC_ERR(err, "failed to start spawnd service loop");
        }
    }

    messages_handler_loop();
}
Example #7
0
int main (int argc, char *argv[])
{
    errval_t err;
    char *cardName = NULL;

    const char *imagefile = IMAGEFILE;

    vfs_init();
    
    err = timer_init();
    if (err_is_fail(err)) {
        USER_PANIC_ERR(err, "error initialising timer client library\n");
    }

    if (argc < 3) {
        printf("Usage: %s <Network card Name> <vfs mount URI> [disk image path]\n",
               argv[0]);
        printf("<Network card Name> value is ignored in this version\n");
        return 1;
    }

    if(argc > 3) {
        imagefile = argv[3];
    }

    cardName = argv[1];
    printf("vmkitmon: start\n");
    printf("Ignoring the cardname [%s], and using the default one from vfs_mount\n",
            cardName);
    vfs_mkdir(VFS_MOUNTPOINT);
    err = vfs_mount(VFS_MOUNTPOINT, argv[2]);
    if (err_is_fail(err)) {
        printf("vmkitmon: error mounting %s: %s\n", argv[2], err_getstring(err));
        return 1;
    }

    /* Initialization */
    err = realmode_init();
    assert_err(err, "realmode_init");
    // fetch all relevant multiboot data
    //load_multiboot_files();

    // aquire the standard input
#if 1
    err = terminal_want_stdin(TERMINAL_SOURCE_SERIAL);
    assert_err(err, "terminal_want_stdin");
#endif

    // load files
    // FIXME: use a dynamic way to specify those arguments
    printf("Loading file [%s]\n", GRUB_IMG_PATH);
    vfs_load_file_to_memory(GRUB_IMG_PATH, &grub_image, &grub_image_size);
    printf("Loading file [%s]\n", imagefile);
    vfs_load_file_to_memory(imagefile, &hdd0_image, &hdd0_image_size);
    printf("Done with file loading\n");

    /* Guest execution */
    // perform some sanity checks
    if (grub_image == NULL) {
        printf("vmkitmon: no grub image available, abort\n");
        return 1;
    }

    guest = guest_create ();
    assert(guest != NULL);
    err = guest_make_runnable(guest, true);
    assert_err(err, "guest_make_runnable");

    printf("vmkitmon: end\n");

    messages_handler_loop();
}
int main (int argc, char* argv[]) 
{    
    errval_t err;
    my_coreid = disp_get_core_id();

    exported  = false;
    connected = false;
    start_sending_caps  = false;
    start_retyping_caps = false;

    // munge up a bunch of caps
    create_caps();

    assert (argc >= 2);
    if (!strncmp(argv[1], "client", sizeof("client"))) {
        is_bsp = false;
        assert (argc >= 3);
        num_cores = atoi(argv[2]);
        ram_hack();
    } else {
        is_bsp = true;
        num_cores = atoi(argv[1]);
    }

    // export our binding
    exported = false;
    err = xcorecapbench_export(NULL, export_cb, connect_cb, 
                               get_default_waitset(), IDC_EXPORT_FLAGS_DEFAULT);
    while(!exported) {
        messages_wait_and_handle_next();
    }

    if (is_bsp) {
        wait_for = num_cores;
        // spawn other cores
        printf("Core %d starting xcorecapbench on %i cores\n", my_coreid, 
               num_cores);
        assert(disp_get_core_id() == 0);
        spawn_other_cores(argc, argv);
    } else {
        printf("Starting xcorecapbench on core %i \n", my_coreid);
    }

    // connect to other cores
    connected = false;
    for(int i=0; i<num_cores; i++) {
        if (i != my_coreid) {
            bind_core(i);
        }
    }
    while(!connected) {
        messages_wait_and_handle_next();
    }

    if (is_bsp) {
        wait_for--;
        // wait for cores to connect
        while(wait_for) {
            messages_wait_and_handle_next();
        }
    } else {
        err = bindings[0]->tx_vtbl.barrier_done(bindings[0], NOP_CONT, 0);
        assert(err_is_ok(err));
    }

    if (is_bsp) {
        do_experiment_bsp();
    } else {
        do_experiment_client();
    }

    messages_handler_loop();

    return 0;
}
Example #9
0
int main(int argc, char *argv[])
{
    errval_t err;

    // Parse CMD Arguments
    bool got_apic_id = false;
    bool do_video_init = false;
    vtd_force_off = false;
    for (int i = 1; i < argc; i++) {
        if(sscanf(argv[i], "apicid=%" PRIuPTR, &my_apic_id) == 1) {
            got_apic_id = true;
        }

        if (strcmp(argv[i], "video_init") == 0) {
            do_video_init = true;
        } else if (strncmp(argv[i], "vtd_force_off", strlen("vtd_force_off")) == 0) {
            vtd_force_off = true;
 	}
    }

    if(got_apic_id == false) {
        fprintf(stderr, "Usage: %s APIC_ID\n", argv[0]);
        fprintf(stderr, "Wrong monitor version?\n");
        return EXIT_FAILURE;
    }

    err = oct_init();
    if (err_is_fail(err)) {
        USER_PANIC_ERR(err, "Initialize dist");
    }

    //connect to the SKB
    ACPI_DEBUG("acpi: connecting to the SKB...\n");
    skb_client_connect();
    skb_execute("[pci_queries].");


    err = setup_skb_info();
    if (err_is_fail(err)) {
        USER_PANIC_ERR(err, "Populating SKB failed.");
    }

    err = init_allocators();
    if (err_is_fail(err)) {
        USER_PANIC_ERR(err, "Init memory allocator");
    }

    err = copy_bios_mem();
    if (err_is_fail(err)) {
        USER_PANIC_ERR(err, "Copy BIOS Memory");
    }

    int r = init_acpi();
    assert(r == 0);

    buttons_init();

    if (do_video_init) {
        video_init();
    }

    start_service();

    messages_handler_loop();
}
Example #10
0
int main(int argc, char *argv[])
{
    errval_t err;
    my_core_id = disp_get_core_id();
    bench_init();

    if (argc == 1) { /* server */
        struct monitor_binding *mb = get_monitor_binding();
        mb->rx_vtbl.num_cores_reply = num_cores_reply;

        // Get number of cores in the system
        err = mb->tx_vtbl.num_cores_request(mb, NOP_CONT);
        if (err_is_fail(err)) {
            USER_PANIC_ERR(err, "error sending num_core_request");
        }

        // Spawn client on another core
        char *xargv[] = {"shared_mem_clock_bench", "dummy", NULL};
        err = spawn_program_on_all_cores(false, xargv[0], xargv, NULL,
                                         SPAWN_FLAGS_DEFAULT, NULL);
        if (err_is_fail(err)) {
            USER_PANIC_ERR(err, "error spawning on other cores");
        }

        // Export service
        err = bench_export(NULL, export_cb, connect_cb, get_default_waitset(),
                          IDC_EXPORT_FLAGS_DEFAULT);
        if (err_is_fail(err)) {
            USER_PANIC_ERR(err, "export failed");
        }

        // Allocate a cap for the shared memory
        err = frame_alloc(&clock_frame, BASE_PAGE_SIZE, NULL);
        if (err_is_fail(err)) {
            USER_PANIC_ERR(err, "frame_alloc failed");
        }
        err = clock_init(clock_frame);
        if (err_is_fail(err)) {
            USER_PANIC_ERR(err, "clock_init failed");
        }

        // Wait for all connections to be established
        start_experiment_flag = false;
        while(!start_experiment_flag) {
            messages_wait_and_handle_next();
        }

        // Start experiments
        start_experiment();

    } else { /* client */
        // Lookup service
        iref_t iref;
        err = nameservice_blocking_lookup("server", &iref);
        if (err_is_fail(err)) {
            USER_PANIC_ERR(err, "nameservice_blocking_lookup failed");
        }

        // Bind to service
        err = bench_bind(iref, bind_cb, NULL, get_default_waitset(),
                         IDC_BIND_FLAGS_DEFAULT);
        if (err_is_fail(err)) {
            USER_PANIC_ERR(err, "bind failed");
        }
    }

    messages_handler_loop();
}