linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ipmi: rate limit ipmi smi_event failure message
@ 2021-07-29  9:32 Wen Yang
  2021-07-29 13:37 ` Corey Minyard
  0 siblings, 1 reply; 2+ messages in thread
From: Wen Yang @ 2021-07-29  9:32 UTC (permalink / raw)
  To: Corey Minyard; +Cc: Wen Yang, Baoyou Xie, openipmi-developer, linux-kernel

Sometimes we can't get a valid si_sm_data, and we print an error
message accordingly. But the ipmi module seem to like retrying a lot,
in which case we flood the kernel log with a lot of messages, eg:

[46318019.164726] ipmi_si IPI0001:00: Could not set the global enables: 0xc1.
[46318020.109700] ipmi_si IPI0001:00: Could not set the global enables: 0xc1.
[46318021.158677] ipmi_si IPI0001:00: Could not set the global enables: 0xc1.
[46318022.212598] ipmi_si IPI0001:00: Could not set the global enables: 0xc1.
[46318023.258564] ipmi_si IPI0001:00: Could not set the global enables: 0xc1.
[46318024.210455] ipmi_si IPI0001:00: Could not set the global enables: 0xc1.
[46318025.260473] ipmi_si IPI0001:00: Could not set the global enables: 0xc1.
[46318026.308445] ipmi_si IPI0001:00: Could not set the global enables: 0xc1.
[46318027.356389] ipmi_si IPI0001:00: Could not set the global enables: 0xc1.
[46318028.298288] ipmi_si IPI0001:00: Could not set the global enables: 0xc1.
[46318029.363302] ipmi_si IPI0001:00: Could not set the global enables: 0xc1.

Signed-off-by: Wen Yang <wenyang@linux.alibaba.com>
Cc: Baoyou Xie <baoyou.xie@alibaba-inc.com>
Cc: Corey Minyard <minyard@acm.org>
Cc: openipmi-developer@lists.sourceforge.net
Cc: linux-kernel@vger.kernel.org
---
 drivers/char/ipmi/ipmi_si_intf.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index 62929a3..f64c3ac 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -591,7 +591,7 @@ static void handle_transaction_done(struct smi_info *smi_info)
 		smi_info->handlers->get_result(smi_info->si_sm, msg, 3);
 		if (msg[2] != 0) {
 			/* Error clearing flags */
-			dev_warn(smi_info->io.dev,
+			dev_warn_ratelimited(smi_info->io.dev,
 				 "Error clearing flags: %2.2x\n", msg[2]);
 		}
 		smi_info->si_state = SI_NORMAL;
@@ -683,10 +683,11 @@ static void handle_transaction_done(struct smi_info *smi_info)
 		/* We got the flags from the SMI, now handle them. */
 		smi_info->handlers->get_result(smi_info->si_sm, msg, 4);
 		if (msg[2] != 0) {
-			dev_warn(smi_info->io.dev,
-				 "Couldn't get irq info: %x.\n", msg[2]);
-			dev_warn(smi_info->io.dev,
-				 "Maybe ok, but ipmi might run very slowly.\n");
+#define IPMI_WARN_CHECKING_ENABLES "Maybe ok, but ipmi might run very slowly."
+
+			dev_warn_ratelimited(smi_info->io.dev,
+				"Couldn't get irq info: %x, %s\n",
+				msg[2], IPMI_WARN_CHECKING_ENABLES);
 			smi_info->si_state = SI_NORMAL;
 			break;
 		}
@@ -721,7 +722,7 @@ static void handle_transaction_done(struct smi_info *smi_info)
 
 		smi_info->handlers->get_result(smi_info->si_sm, msg, 4);
 		if (msg[2] != 0)
-			dev_warn(smi_info->io.dev,
+			dev_warn_ratelimited(smi_info->io.dev,
 				 "Could not set the global enables: 0x%x.\n",
 				 msg[2]);
 
@@ -1343,7 +1344,7 @@ static int try_get_dev_id(struct smi_info *smi_info)
 
 		if (cc != IPMI_CC_NO_ERROR &&
 		    ++retry_count <= GET_DEVICE_ID_MAX_RETRY) {
-			dev_warn(smi_info->io.dev,
+			dev_warn_ratelimited(smi_info->io.dev,
 			    "BMC returned 0x%2.2x, retry get bmc device id\n",
 			    cc);
 			goto retry;
-- 
1.8.3.1


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

* Re: [PATCH] ipmi: rate limit ipmi smi_event failure message
  2021-07-29  9:32 [PATCH] ipmi: rate limit ipmi smi_event failure message Wen Yang
@ 2021-07-29 13:37 ` Corey Minyard
  0 siblings, 0 replies; 2+ messages in thread
From: Corey Minyard @ 2021-07-29 13:37 UTC (permalink / raw)
  To: Wen Yang; +Cc: Baoyou Xie, openipmi-developer, linux-kernel

On Thu, Jul 29, 2021 at 05:32:28PM +0800, Wen Yang wrote:
> Sometimes we can't get a valid si_sm_data, and we print an error
> message accordingly. But the ipmi module seem to like retrying a lot,
> in which case we flood the kernel log with a lot of messages, eg:

This is reasonable.  I moved the #define into the dev_warn_ratelimited
because that looked a little strange, and having the #define really
didn't add any value.  But that's it, queued for next release.

Thanks,

-corey

> 
> [46318019.164726] ipmi_si IPI0001:00: Could not set the global enables: 0xc1.
> [46318020.109700] ipmi_si IPI0001:00: Could not set the global enables: 0xc1.
> [46318021.158677] ipmi_si IPI0001:00: Could not set the global enables: 0xc1.
> [46318022.212598] ipmi_si IPI0001:00: Could not set the global enables: 0xc1.
> [46318023.258564] ipmi_si IPI0001:00: Could not set the global enables: 0xc1.
> [46318024.210455] ipmi_si IPI0001:00: Could not set the global enables: 0xc1.
> [46318025.260473] ipmi_si IPI0001:00: Could not set the global enables: 0xc1.
> [46318026.308445] ipmi_si IPI0001:00: Could not set the global enables: 0xc1.
> [46318027.356389] ipmi_si IPI0001:00: Could not set the global enables: 0xc1.
> [46318028.298288] ipmi_si IPI0001:00: Could not set the global enables: 0xc1.
> [46318029.363302] ipmi_si IPI0001:00: Could not set the global enables: 0xc1.
> 
> Signed-off-by: Wen Yang <wenyang@linux.alibaba.com>
> Cc: Baoyou Xie <baoyou.xie@alibaba-inc.com>
> Cc: Corey Minyard <minyard@acm.org>
> Cc: openipmi-developer@lists.sourceforge.net
> Cc: linux-kernel@vger.kernel.org
> ---
>  drivers/char/ipmi/ipmi_si_intf.c | 15 ++++++++-------
>  1 file changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
> index 62929a3..f64c3ac 100644
> --- a/drivers/char/ipmi/ipmi_si_intf.c
> +++ b/drivers/char/ipmi/ipmi_si_intf.c
> @@ -591,7 +591,7 @@ static void handle_transaction_done(struct smi_info *smi_info)
>  		smi_info->handlers->get_result(smi_info->si_sm, msg, 3);
>  		if (msg[2] != 0) {
>  			/* Error clearing flags */
> -			dev_warn(smi_info->io.dev,
> +			dev_warn_ratelimited(smi_info->io.dev,
>  				 "Error clearing flags: %2.2x\n", msg[2]);
>  		}
>  		smi_info->si_state = SI_NORMAL;
> @@ -683,10 +683,11 @@ static void handle_transaction_done(struct smi_info *smi_info)
>  		/* We got the flags from the SMI, now handle them. */
>  		smi_info->handlers->get_result(smi_info->si_sm, msg, 4);
>  		if (msg[2] != 0) {
> -			dev_warn(smi_info->io.dev,
> -				 "Couldn't get irq info: %x.\n", msg[2]);
> -			dev_warn(smi_info->io.dev,
> -				 "Maybe ok, but ipmi might run very slowly.\n");
> +#define IPMI_WARN_CHECKING_ENABLES "Maybe ok, but ipmi might run very slowly."
> +
> +			dev_warn_ratelimited(smi_info->io.dev,
> +				"Couldn't get irq info: %x, %s\n",
> +				msg[2], IPMI_WARN_CHECKING_ENABLES);
>  			smi_info->si_state = SI_NORMAL;
>  			break;
>  		}
> @@ -721,7 +722,7 @@ static void handle_transaction_done(struct smi_info *smi_info)
>  
>  		smi_info->handlers->get_result(smi_info->si_sm, msg, 4);
>  		if (msg[2] != 0)
> -			dev_warn(smi_info->io.dev,
> +			dev_warn_ratelimited(smi_info->io.dev,
>  				 "Could not set the global enables: 0x%x.\n",
>  				 msg[2]);
>  
> @@ -1343,7 +1344,7 @@ static int try_get_dev_id(struct smi_info *smi_info)
>  
>  		if (cc != IPMI_CC_NO_ERROR &&
>  		    ++retry_count <= GET_DEVICE_ID_MAX_RETRY) {
> -			dev_warn(smi_info->io.dev,
> +			dev_warn_ratelimited(smi_info->io.dev,
>  			    "BMC returned 0x%2.2x, retry get bmc device id\n",
>  			    cc);
>  			goto retry;
> -- 
> 1.8.3.1
> 

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

end of thread, other threads:[~2021-07-29 13:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-29  9:32 [PATCH] ipmi: rate limit ipmi smi_event failure message Wen Yang
2021-07-29 13:37 ` Corey Minyard

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