diff mbox series

ipmi/powernv: Fix spurious warnings at boot

Message ID 20180615183332.249253-1-wak@google.com (mailing list archive)
State Handled Elsewhere
Headers show
Series ipmi/powernv: Fix spurious warnings at boot | expand

Commit Message

William Kennington June 15, 2018, 6:33 p.m. UTC
Sometimes we have stale messages showing up in the recv queue that are
being processed by the pollers. We don't want to print out warnings for
these messages not having an outstanding request as they can be expected
when doing a kexec from the petitroot environment or from another
running kernel.

Signed-off-by: William A. Kennington III <wak@google.com>
---
 drivers/char/ipmi/ipmi_powernv.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

Comments

Jeremy Kerr July 18, 2018, 8:25 a.m. UTC | #1
Hi William,

> Sometimes we have stale messages showing up in the recv queue that are
> being processed by the pollers. We don't want to print out warnings for
> these messages not having an outstanding request as they can be expected
> when doing a kexec from the petitroot environment or from another
> running kernel.

OK, makes sense to do. The in_drain state partially shadows the value of
!smi->cur_msg; we may be able to use that instead.

This means that we'll no longer warn when getting an IPMI message after
the first successful send occurs, but do we really care about that
anyway? We could just drop those silently...

Cheers,


Jeremy
diff mbox series

Patch

diff --git a/drivers/char/ipmi/ipmi_powernv.c b/drivers/char/ipmi/ipmi_powernv.c
index e96500372ce20..36b07f26cebd9 100644
--- a/drivers/char/ipmi/ipmi_powernv.c
+++ b/drivers/char/ipmi/ipmi_powernv.c
@@ -31,6 +31,12 @@  struct ipmi_smi_powernv {
 	spinlock_t		msg_lock;
 	struct ipmi_smi_msg	*cur_msg;
 	struct opal_ipmi_msg	*opal_msg;
+
+	/**
+	 * Marker denoting if we should be draining the ipmi queue of any
+	 * outstanding messages
+	 */
+	bool			in_drain;
 };
 
 static int ipmi_powernv_start_processing(void *send_info, ipmi_smi_t intf)
@@ -96,6 +102,7 @@  static void ipmi_powernv_send(void *send_info, struct ipmi_smi_msg *msg)
 
 	if (!rc) {
 		smi->cur_msg = msg;
+		smi->in_drain = false;
 		spin_unlock_irqrestore(&smi->msg_lock, flags);
 		return;
 	}
@@ -121,8 +128,14 @@  static int ipmi_powernv_recv(struct ipmi_smi_powernv *smi)
 	spin_lock_irqsave(&smi->msg_lock, flags);
 
 	if (!smi->cur_msg) {
+		bool in_drain = READ_ONCE(smi->in_drain);
 		spin_unlock_irqrestore(&smi->msg_lock, flags);
-		pr_warn("no current message?\n");
+		/**
+		 * We don't want to print spurious errors if we are draining
+		 * leftover messages prior to sending our first message.
+		 */
+		if (!in_drain)
+			pr_warn("no current message?\n");
 		return 0;
 	}
 
@@ -226,6 +239,11 @@  static int ipmi_powernv_probe(struct platform_device *pdev)
 
 	spin_lock_init(&ipmi->msg_lock);
 
+	/* Our channel may have stale messages from a previous kernel
+	 * let the recv code know we haven't actually sent anything yet
+	 */
+	ipmi->in_drain = true;
+
 	rc = of_property_read_u32(dev->of_node, "ibm,ipmi-interface-id",
 			&prop);
 	if (rc) {