public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Markus Boehme <markubo@amazon.com>
To: Corey Minyard <minyard@acm.org>,
	openipmi-developer@lists.sourceforge.net
Cc: Arnd Bergmann <arnd@arndb.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-kernel@vger.kernel.org, Stefan Nuernberger <snu@amazon.com>,
	SeongJae Park <sjpark@amazon.com>, Amit Shah <aams@amazon.com>,
	Markus Boehme <markubo@amazon.com>
Subject: [PATCH 2/3] ipmi: Add timeout waiting for device GUID
Date: Mon,  7 Sep 2020 18:25:36 +0200	[thread overview]
Message-ID: <1599495937-10654-2-git-send-email-markubo@amazon.com> (raw)
In-Reply-To: <1599495937-10654-1-git-send-email-markubo@amazon.com>

We have observed hosts with misbehaving BMCs that receive a Get Device
GUID command but don't respond. This leads to an indefinite wait in the
ipmi_msghandler's __get_guid function, showing up as hung task messages
for modprobe.

According to IPMI 2.0 specification chapter 20, the implementation of
the Get Device GUID command is optional. Therefore, add a timeout to
waiting for its response and treat the lack of one the same as missing a
device GUID.

Signed-off-by: Stefan Nuernberger <snu@amazon.com>
Signed-off-by: Markus Boehme <markubo@amazon.com>
---
 drivers/char/ipmi/ipmi_msghandler.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
index 2b213c9..2a2e8b2 100644
--- a/drivers/char/ipmi/ipmi_msghandler.c
+++ b/drivers/char/ipmi/ipmi_msghandler.c
@@ -3184,18 +3184,26 @@ static void guid_handler(struct ipmi_smi *intf, struct ipmi_recv_msg *msg)
 
 static void __get_guid(struct ipmi_smi *intf)
 {
-	int rv;
+	long rv;
 	struct bmc_device *bmc = intf->bmc;
 
 	bmc->dyn_guid_set = 2;
 	intf->null_user_handler = guid_handler;
 	rv = send_guid_cmd(intf, 0);
-	if (rv)
+	if (rv) {
 		/* Send failed, no GUID available. */
 		bmc->dyn_guid_set = 0;
-	else
-		wait_event(intf->waitq, bmc->dyn_guid_set != 2);
+		goto out;
+	}
 
+	rv = wait_event_timeout(intf->waitq, bmc->dyn_guid_set != 2, 5 * HZ);
+	if (rv == 0) {
+		dev_warn_once(intf->si_dev,
+			      "Timed out waiting for GUID. Assuming GUID is not available.\n");
+		bmc->dyn_guid_set = 0;
+	}
+
+out:
 	/* dyn_guid_set makes the guid data available. */
 	smp_rmb();
 
-- 
2.7.4


  reply	other threads:[~2020-09-07 16:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-07 16:25 [PATCH 1/3] ipmi: Reset response handler when failing to send the command Markus Boehme
2020-09-07 16:25 ` Markus Boehme [this message]
2020-09-08  0:07   ` [PATCH 2/3] ipmi: Add timeout waiting for device GUID Corey Minyard
2020-09-07 16:25 ` [PATCH 3/3] ipmi: Add timeout waiting for channel information Markus Boehme
2020-09-08  0:34   ` Corey Minyard
2020-09-10 11:08     ` Boehme, Markus
2020-10-07 18:42       ` [Openipmi-developer] " Corey Minyard
2020-09-08  0:03 ` [PATCH 1/3] ipmi: Reset response handler when failing to send the command Corey Minyard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1599495937-10654-2-git-send-email-markubo@amazon.com \
    --to=markubo@amazon.com \
    --cc=aams@amazon.com \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=minyard@acm.org \
    --cc=openipmi-developer@lists.sourceforge.net \
    --cc=sjpark@amazon.com \
    --cc=snu@amazon.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox