Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752235AbbG0GHT (ORCPT ); Mon, 27 Jul 2015 02:07:19 -0400 Received: from mail9.hitachi.co.jp ([133.145.228.44]:52599 "EHLO mail9.hitachi.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751756AbbG0GGl (ORCPT ); Mon, 27 Jul 2015 02:06:41 -0400 X-AuditID: 85900ec0-9ebcbb9000001a57-61-55b5ca36d114 X-Mailbox-Line: From nobody Mon Jul 27 14:55:16 2015 Subject: [PATCH 7/7] ipmi/kcs: Don't run the KCS state machine when it is KCS_IDLE To: Corey Minyard From: Hidehiro Kawai Cc: openipmi-developer@lists.sourceforge.net, linux-kernel@vger.kernel.org Date: Mon, 27 Jul 2015 14:55:16 +0900 Message-ID: <20150727055516.4759.65106.stgit@softrs> In-Reply-To: <20150727055516.4759.34462.stgit@softrs> References: <20150727055516.4759.34462.stgit@softrs> User-Agent: StGit/0.16 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Brightmail-Tracker: AAAAAA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1619 Lines: 39 If a BMC is unresponsive for some reason, it ends up completing the requested message as an error, then kcs_event() is called once to advance the state machine. However, since the BMC is unresponsive now, the status of the KCS interface may not be idle. As the result, the state machine can continue to run and comsume CPU time indefinitely even if there is no more request message. Moreover, if this happens in run-to-completion mode (i.e. context of panic_event()), the kernel hangs up. To fix this problem, this patch ignores kcs_event() call if there is no request message to be processed. Signed-off-by: Hidehiro Kawai --- drivers/char/ipmi/ipmi_kcs_sm.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/char/ipmi/ipmi_kcs_sm.c b/drivers/char/ipmi/ipmi_kcs_sm.c index 8c25f59..0e187fb 100644 --- a/drivers/char/ipmi/ipmi_kcs_sm.c +++ b/drivers/char/ipmi/ipmi_kcs_sm.c @@ -353,6 +353,10 @@ static enum si_sm_result kcs_event(struct si_sm_data *kcs, long time) if (kcs_debug & KCS_DEBUG_STATES) printk(KERN_DEBUG "KCS: State = %d, %x\n", kcs->state, status); + /* We don't want to run the state machine when the state is IDLE */ + if (kcs->state == KCS_IDLE) + return SI_SM_IDLE; + /* All states wait for ibf, so just do it here. */ if (!check_ibf(kcs, status, time)) return SI_SM_CALL_WITH_DELAY; -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/