linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ipmi/powernv: Fix spurious warnings at boot
@ 2018-06-15 18:33 William A. Kennington III
  2018-07-18  8:25 ` Jeremy Kerr
  0 siblings, 1 reply; 2+ messages in thread
From: William A. Kennington III @ 2018-06-15 18:33 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: William A. Kennington III

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(-)

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) {
-- 
2.18.0.rc1.244.gcf134e6275-goog

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ipmi/powernv: Fix spurious warnings at boot
  2018-06-15 18:33 [PATCH] ipmi/powernv: Fix spurious warnings at boot William A. Kennington III
@ 2018-07-18  8:25 ` Jeremy Kerr
  0 siblings, 0 replies; 2+ messages in thread
From: Jeremy Kerr @ 2018-07-18  8:25 UTC (permalink / raw)
  To: William A. Kennington III, linuxppc-dev

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-07-18  8:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-15 18:33 [PATCH] ipmi/powernv: Fix spurious warnings at boot William A. Kennington III
2018-07-18  8:25 ` Jeremy Kerr

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).