Commit fbc1023a authored by David Kershner's avatar David Kershner Committed by Greg Kroah-Hartman

staging: unisys: visorbus: add error handling to controlvm_periodic_work

The function controlvm_periodic_work should handle errors appropriately.
Signed-off-by: default avatarDavid Kershner <david.kershner@unisys.com>
Reviewed-by: default avatarReviewed-by: Tim Sell <timothy.sell@unisys.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 25a5128e
...@@ -1727,14 +1727,18 @@ static void ...@@ -1727,14 +1727,18 @@ static void
controlvm_periodic_work(struct work_struct *work) controlvm_periodic_work(struct work_struct *work)
{ {
struct controlvm_message inmsg; struct controlvm_message inmsg;
bool got_command = false; int err;
bool handle_command_failed = false;
while (!visorchannel_signalremove(chipset_dev->controlvm_channel, /* Drain the RESPONSE queue make it empty */
do {
err = visorchannel_signalremove(chipset_dev->controlvm_channel,
CONTROLVM_QUEUE_RESPONSE, CONTROLVM_QUEUE_RESPONSE,
&inmsg)) &inmsg);
; } while (!err);
if (!got_command) {
if (err != -EAGAIN)
goto schedule_out;
if (chipset_dev->controlvm_pending_msg_valid) { if (chipset_dev->controlvm_pending_msg_valid) {
/* /*
* we throttled processing of a prior * we throttled processing of a prior
...@@ -1743,36 +1747,29 @@ controlvm_periodic_work(struct work_struct *work) ...@@ -1743,36 +1747,29 @@ controlvm_periodic_work(struct work_struct *work)
*/ */
inmsg = chipset_dev->controlvm_pending_msg; inmsg = chipset_dev->controlvm_pending_msg;
chipset_dev->controlvm_pending_msg_valid = false; chipset_dev->controlvm_pending_msg_valid = false;
got_command = true; err = 0;
} else { } else {
got_command = (read_controlvm_event(&inmsg) == 0); err = read_controlvm_event(&inmsg);
}
} }
handle_command_failed = false; while (!err) {
while (got_command && (!handle_command_failed)) {
chipset_dev->most_recent_message_jiffies = jiffies; chipset_dev->most_recent_message_jiffies = jiffies;
if (handle_command(inmsg, err = handle_command(inmsg,
visorchannel_get_physaddr visorchannel_get_physaddr
(chipset_dev->controlvm_channel) != -EAGAIN)) (chipset_dev->controlvm_channel));
got_command = (read_controlvm_event(&inmsg) == 0); if (err == -EAGAIN) {
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;
chipset_dev->controlvm_pending_msg = inmsg; chipset_dev->controlvm_pending_msg = inmsg;
chipset_dev->controlvm_pending_msg_valid = true; chipset_dev->controlvm_pending_msg_valid = true;
break;
} }
err = read_controlvm_event(&inmsg);
} }
/* parahotplug_worker */ /* parahotplug_worker */
parahotplug_process_list(); parahotplug_process_list();
schedule_out:
if (time_after(jiffies, chipset_dev->most_recent_message_jiffies + if (time_after(jiffies, chipset_dev->most_recent_message_jiffies +
(HZ * MIN_IDLE_SECONDS))) { (HZ * MIN_IDLE_SECONDS))) {
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment