davidker / unisys

Master repository for new changes to drivers/staging/unisys and drivers/visorbus
Other
2 stars 1 forks source link

Explain polling frequency variation logic in controlvm_periodic_work() #129

Open wadgaonkarsam opened 7 years ago

wadgaonkarsam commented 7 years ago

Kanboard:29386

    if (!got_command) {
        if (controlvm_pending_msg_valid) {
            /*
             * we throttled processing of a prior
             * msg, so try to process it again
             * rather than reading a new one
             */
            inmsg = controlvm_pending_msg;
            controlvm_pending_msg_valid = false;
            got_command = true;
        } else {
            got_command = read_controlvm_event(&inmsg);
        }
    }

    handle_command_failed = false;
    while (got_command && (!handle_command_failed)) {
        most_recent_message_jiffies = jiffies;
        if (handle_command(inmsg,
                   visorchannel_get_physaddr
                   (controlvm_channel)))
            got_command = read_controlvm_event(&inmsg);
        else {
            /*
             * this is a scenario where throttling
             * is required, but probably NOT an
             * error...; we stash the current
             * controlvm msg so we will attempt to
             * reprocess it on our next loop
             */
            handle_command_failed = true;
            controlvm_pending_msg = inmsg;
            controlvm_pending_msg_valid = true;
        }
    }

    /* parahotplug_worker */
    parahotplug_process_list();

    if (time_after(jiffies,
               most_recent_message_jiffies + (HZ * MIN_IDLE_SECONDS))) {
        /*
         * it's been longer than MIN_IDLE_SECONDS since we
         * processed our last controlvm message; slow down the
         * polling
         */
        if (poll_jiffies != POLLJIFFIES_CONTROLVMCHANNEL_SLOW)
            poll_jiffies = POLLJIFFIES_CONTROLVMCHANNEL_SLOW;
    } else {
        if (poll_jiffies != POLLJIFFIES_CONTROLVMCHANNEL_FAST)
            poll_jiffies = POLLJIFFIES_CONTROLVMCHANNEL_FAST;
    }

So newer hardware will run faster which will always cause the fast mode to happen? I don't understand the logic here, what are you trying to throttle?