Exemplo n.º 1
0
static void r600_end_query(struct pipe_context *ctx, struct pipe_query *query)
{
	struct r600_context *rctx = (struct r600_context *)ctx;
	struct r600_query *rquery = (struct r600_query *)query;

	r600_query_end(rctx, rquery);
	LIST_DELINIT(&rquery->list);
}
Exemplo n.º 2
0
/**
 * Main scheduler routine in RR policy implmentation
 *
 * @param
 * @return next_vcpuid
 */
int sched_rr_do_schedule(uint64_t *expiration)
{
    uint32_t pcpu = smp_processor_id();
    /* TODO:(igkang) change type to bool */
    struct rq_entry_rr *next_entry = NULL;
    bool is_switching_needed = false;
    int next_vcpuid = VCPUID_INVALID;

    /* check pending attach list
     *      then attach them to runqueue_rr */
    /* TODO:(igkang) write code to attach pending attach requests */

    /* TODO:(igkang) improve logical code structure to make it easier to read */
    /* determine next vcpu to be run
     *  - if there is an detach-pending vcpu than detach it. */
    if (current[pcpu] == NULL) { /* No vCPU is running */
        if (!LIST_IS_EMPTY(&runqueue_rr[pcpu])) { /* and there are some vcpus waiting */
            is_switching_needed = true;
        }
    } else { /* There's a vCPU currently running */
        struct rq_entry_rr *current_entry = NULL;
        /* put current entry back to runqueue_rr */
        current_entry = LIST_ENTRY(struct rq_entry_rr, current[pcpu], head);
        LIST_ADDTAIL(current[pcpu], &runqueue_rr[pcpu]);

        /* let's switch as tick is over */
        current_entry->state = WAITING;
        current[pcpu] = NULL;

        is_switching_needed = true;
    }

    /* update scheduling-related data (like tick) */
    if (is_switching_needed) {
        /* move entry from runqueue_rr to current */
        current[pcpu] = runqueue_rr[pcpu].next;
        LIST_DELINIT(current[pcpu]);

        next_entry = LIST_ENTRY(struct rq_entry_rr, current[pcpu], head);

        *expiration =
            timer_get_timenow() + MSEC(1) * (uint64_t) next_entry->tick_reset_val;
    }

    /* vcpu of current entry will be the next vcpu */
    if (current[pcpu] != NULL) {
        next_entry = LIST_ENTRY(struct rq_entry_rr, current[pcpu], head);
        next_entry->state = RUNNING;

        /* set return next_vcpuid value */
        next_vcpuid = next_entry->vcpuid;
    }
Exemplo n.º 3
0
static void r600_end_query(struct pipe_context *ctx, struct pipe_query *query)
{
    struct r600_context *rctx = (struct r600_context *)ctx;
    struct r600_query *rquery = (struct r600_query *)query;

    if (!si_query_needs_begin(rquery->type)) {
        memset(&rquery->result, 0, sizeof(rquery->result));
    }

    r600_query_end(rctx, rquery);

    if (si_query_needs_begin(rquery->type) && !si_is_timer_query(rquery->type)) {
        LIST_DELINIT(&rquery->list);
    }
}