public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] ipmi: fix timeout calculation when bmc is disconnected
@ 2013-12-13  2:36 Xie XiuQi
  2013-12-13  2:38 ` [PATCH 1/2] ipmi: use USEC_PER_SEC instead of 1000000 for more meaningful Xie XiuQi
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Xie XiuQi @ 2013-12-13  2:36 UTC (permalink / raw)
  To: Corey Minyard
  Cc: Hushiyuan, openipmi-developer, linux-kernel@vger.kernel.org,
	Zhangdianfang

Hu Shiyuan report, when loading ipmi_si module while bmc is
disconnected, we found the timeout is longer than 5 secs.
Actually it takes about 3 mins and 20 secs (HZ=250).

error message as below:
Dec 12 19:08:59 linux kernel: IPMI BT: timeout in RD_WAIT [ ] 1 retries left
Dec 12 19:08:59 linux kernel: BT: write 4 bytes seq=0x01 03 18 00 01
[...]
Dec 12 19:12:19 linux kernel: IPMI BT: timeout in RD_WAIT [ ]
Dec 12 19:12:19 linux kernel: failed 2 retries, sending error response
Dec 12 19:12:19 linux kernel: IPMI: BT reset (takes 5 secs)
Dec 12 19:12:19 linux kernel: IPMI BT: flag reset [ ]

Function wait_for_msg_done() use schedule_timeout_uninterruptible(1)
to sleep 1 tick, so we should subtract jiffies_to_usecs(1) usecs
instead of 100 usecs from timeout.

For more clearly, I used USEC_PER_SEC instead of 1000000.

Xie XiuQi (2):
  ipmi: use USEC_PER_SEC instead of 1000000 for more meaningful
  ipmi: fix timeout calculation when bmc is disconnected

 drivers/char/ipmi/ipmi_bt_sm.c   | 8 ++++----
 drivers/char/ipmi/ipmi_kcs_sm.c  | 4 ++--
 drivers/char/ipmi/ipmi_si_intf.c | 2 +-
 drivers/char/ipmi/ipmi_smic_sm.c | 2 +-
 4 files changed, 8 insertions(+), 8 deletions(-)

-- 
1.8.2.2



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

* [PATCH 1/2] ipmi: use USEC_PER_SEC instead of 1000000 for more meaningful
  2013-12-13  2:36 [PATCH 0/2] ipmi: fix timeout calculation when bmc is disconnected Xie XiuQi
@ 2013-12-13  2:38 ` Xie XiuQi
  2013-12-13  2:39 ` [PATCH 2/2] ipmi: fix timeout calculation when bmc is disconnected Xie XiuQi
  2013-12-13  3:15 ` [PATCH 0/2] " Corey Minyard
  2 siblings, 0 replies; 4+ messages in thread
From: Xie XiuQi @ 2013-12-13  2:38 UTC (permalink / raw)
  To: Corey Minyard
  Cc: Hushiyuan, openipmi-developer, linux-kernel@vger.kernel.org,
	Zhangdianfang

Use USEC_PER_SEC instead of 1000000, that making the later bugfix
more clearly.

Signed-off-by: Xie XiuQi <xiexiuqi@huawei.com>
---
 drivers/char/ipmi/ipmi_bt_sm.c   | 8 ++++----
 drivers/char/ipmi/ipmi_kcs_sm.c  | 4 ++--
 drivers/char/ipmi/ipmi_smic_sm.c | 2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/char/ipmi/ipmi_bt_sm.c b/drivers/char/ipmi/ipmi_bt_sm.c
index a22a7a5..f5e4cd7 100644
--- a/drivers/char/ipmi/ipmi_bt_sm.c
+++ b/drivers/char/ipmi/ipmi_bt_sm.c
@@ -201,7 +201,7 @@ static unsigned int bt_init_data(struct si_sm_data *bt, struct si_sm_io *io)
 	}
 	bt->state = BT_STATE_IDLE;	/* start here */
 	bt->complete = BT_STATE_IDLE;	/* end here */
-	bt->BT_CAP_req2rsp = BT_NORMAL_TIMEOUT * 1000000;
+	bt->BT_CAP_req2rsp = BT_NORMAL_TIMEOUT * USEC_PER_SEC;
 	bt->BT_CAP_retries = BT_NORMAL_RETRY_LIMIT;
 	/* BT_CAP_outreqs == zero is a flag to read BT Capabilities */
 	return 3; /* We claim 3 bytes of space; ought to check SPMI table */
@@ -613,7 +613,7 @@ static enum si_sm_result bt_event(struct si_sm_data *bt, long time)
 		HOST2BMC(42);		/* Sequence number */
 		HOST2BMC(3);		/* Cmd == Soft reset */
 		BT_CONTROL(BT_H2B_ATN);
-		bt->timeout = BT_RESET_DELAY * 1000000;
+		bt->timeout = BT_RESET_DELAY * USEC_PER_SEC;
 		BT_STATE_CHANGE(BT_STATE_RESET3,
 				SI_SM_CALL_WITH_DELAY);

@@ -651,14 +651,14 @@ static enum si_sm_result bt_event(struct si_sm_data *bt, long time)
 		bt_init_data(bt, bt->io);
 		if ((i == 8) && !BT_CAP[2]) {
 			bt->BT_CAP_outreqs = BT_CAP[3];
-			bt->BT_CAP_req2rsp = BT_CAP[6] * 1000000;
+			bt->BT_CAP_req2rsp = BT_CAP[6] * USEC_PER_SEC;
 			bt->BT_CAP_retries = BT_CAP[7];
 		} else
 			printk(KERN_WARNING "IPMI BT: using default values\n");
 		if (!bt->BT_CAP_outreqs)
 			bt->BT_CAP_outreqs = 1;
 		printk(KERN_WARNING "IPMI BT: req2rsp=%ld secs retries=%d\n",
-			bt->BT_CAP_req2rsp / 1000000L, bt->BT_CAP_retries);
+			bt->BT_CAP_req2rsp / USEC_PER_SEC, bt->BT_CAP_retries);
 		bt->timeout = bt->BT_CAP_req2rsp;
 		return SI_SM_CALL_WITHOUT_DELAY;

diff --git a/drivers/char/ipmi/ipmi_kcs_sm.c b/drivers/char/ipmi/ipmi_kcs_sm.c
index e53fc24..6a4bdc1 100644
--- a/drivers/char/ipmi/ipmi_kcs_sm.c
+++ b/drivers/char/ipmi/ipmi_kcs_sm.c
@@ -118,8 +118,8 @@ enum kcs_states {
 #define MAX_KCS_WRITE_SIZE IPMI_MAX_MSG_LENGTH

 /* Timeouts in microseconds. */
-#define IBF_RETRY_TIMEOUT 5000000
-#define OBF_RETRY_TIMEOUT 5000000
+#define IBF_RETRY_TIMEOUT (5*USEC_PER_SEC)
+#define OBF_RETRY_TIMEOUT (5*USEC_PER_SEC)
 #define MAX_ERROR_RETRIES 10
 #define ERROR0_OBF_WAIT_JIFFIES (2*HZ)

diff --git a/drivers/char/ipmi/ipmi_smic_sm.c b/drivers/char/ipmi/ipmi_smic_sm.c
index faed929..c8e77af 100644
--- a/drivers/char/ipmi/ipmi_smic_sm.c
+++ b/drivers/char/ipmi/ipmi_smic_sm.c
@@ -80,7 +80,7 @@ enum smic_states {
 #define SMIC_MAX_ERROR_RETRIES 3

 /* Timeouts in microseconds. */
-#define SMIC_RETRY_TIMEOUT 2000000
+#define SMIC_RETRY_TIMEOUT (2*USEC_PER_SEC)

 /* SMIC Flags Register Bits */
 #define SMIC_RX_DATA_READY	0x80
-- 
1.8.2.2



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

* [PATCH 2/2] ipmi: fix timeout calculation when bmc is disconnected
  2013-12-13  2:36 [PATCH 0/2] ipmi: fix timeout calculation when bmc is disconnected Xie XiuQi
  2013-12-13  2:38 ` [PATCH 1/2] ipmi: use USEC_PER_SEC instead of 1000000 for more meaningful Xie XiuQi
@ 2013-12-13  2:39 ` Xie XiuQi
  2013-12-13  3:15 ` [PATCH 0/2] " Corey Minyard
  2 siblings, 0 replies; 4+ messages in thread
From: Xie XiuQi @ 2013-12-13  2:39 UTC (permalink / raw)
  To: Corey Minyard
  Cc: Hushiyuan, openipmi-developer, linux-kernel@vger.kernel.org,
	Zhangdianfang

Loading ipmi_si module while bmc is disconnected, we found the timeout
is longer than 5 secs. Actually it takes about 3 mins and 20 secs.(HZ=250)

error message as below:
Dec 12 19:08:59 linux kernel: IPMI BT: timeout in RD_WAIT [ ] 1 retries left
Dec 12 19:08:59 linux kernel: BT: write 4 bytes seq=0x01 03 18 00 01
[...]
Dec 12 19:12:19 linux kernel: IPMI BT: timeout in RD_WAIT [ ]
Dec 12 19:12:19 linux kernel: failed 2 retries, sending error response
Dec 12 19:12:19 linux kernel: IPMI: BT reset (takes 5 secs)
Dec 12 19:12:19 linux kernel: IPMI BT: flag reset [ ]

Function wait_for_msg_done() use schedule_timeout_uninterruptible(1) to
sleep 1 tick, so we should subtract jiffies_to_usecs(1) instead of 100
usecs from timeout.

Reported-by: Hu Shiyuan <hushiyuan@huawei.com>
Signed-off-by: Xie XiuQi <xiexiuqi@huawei.com>
---
 drivers/char/ipmi/ipmi_si_intf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index af4b23f..e086d82 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -2707,7 +2707,7 @@ static int wait_for_msg_done(struct smi_info *smi_info)
 		    smi_result == SI_SM_CALL_WITH_TICK_DELAY) {
 			schedule_timeout_uninterruptible(1);
 			smi_result = smi_info->handlers->event(
-				smi_info->si_sm, 100);
+				smi_info->si_sm, jiffies_to_usecs(1));
 		} else if (smi_result == SI_SM_CALL_WITHOUT_DELAY) {
 			smi_result = smi_info->handlers->event(
 				smi_info->si_sm, 0);
-- 
1.8.2.2



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

* Re: [PATCH 0/2] ipmi: fix timeout calculation when bmc is disconnected
  2013-12-13  2:36 [PATCH 0/2] ipmi: fix timeout calculation when bmc is disconnected Xie XiuQi
  2013-12-13  2:38 ` [PATCH 1/2] ipmi: use USEC_PER_SEC instead of 1000000 for more meaningful Xie XiuQi
  2013-12-13  2:39 ` [PATCH 2/2] ipmi: fix timeout calculation when bmc is disconnected Xie XiuQi
@ 2013-12-13  3:15 ` Corey Minyard
  2 siblings, 0 replies; 4+ messages in thread
From: Corey Minyard @ 2013-12-13  3:15 UTC (permalink / raw)
  To: Xie XiuQi
  Cc: Hushiyuan, openipmi-developer, linux-kernel@vger.kernel.org,
	Zhangdianfang

Both look good, thank you.  I've queued them for the next window.

-corey

On 12/12/2013 08:36 PM, Xie XiuQi wrote:
> Hu Shiyuan report, when loading ipmi_si module while bmc is
> disconnected, we found the timeout is longer than 5 secs.
> Actually it takes about 3 mins and 20 secs (HZ=250).
>
> error message as below:
> Dec 12 19:08:59 linux kernel: IPMI BT: timeout in RD_WAIT [ ] 1 retries left
> Dec 12 19:08:59 linux kernel: BT: write 4 bytes seq=0x01 03 18 00 01
> [...]
> Dec 12 19:12:19 linux kernel: IPMI BT: timeout in RD_WAIT [ ]
> Dec 12 19:12:19 linux kernel: failed 2 retries, sending error response
> Dec 12 19:12:19 linux kernel: IPMI: BT reset (takes 5 secs)
> Dec 12 19:12:19 linux kernel: IPMI BT: flag reset [ ]
>
> Function wait_for_msg_done() use schedule_timeout_uninterruptible(1)
> to sleep 1 tick, so we should subtract jiffies_to_usecs(1) usecs
> instead of 100 usecs from timeout.
>
> For more clearly, I used USEC_PER_SEC instead of 1000000.
>
> Xie XiuQi (2):
>   ipmi: use USEC_PER_SEC instead of 1000000 for more meaningful
>   ipmi: fix timeout calculation when bmc is disconnected
>
>  drivers/char/ipmi/ipmi_bt_sm.c   | 8 ++++----
>  drivers/char/ipmi/ipmi_kcs_sm.c  | 4 ++--
>  drivers/char/ipmi/ipmi_si_intf.c | 2 +-
>  drivers/char/ipmi/ipmi_smic_sm.c | 2 +-
>  4 files changed, 8 insertions(+), 8 deletions(-)
>


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

end of thread, other threads:[~2013-12-13  3:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-13  2:36 [PATCH 0/2] ipmi: fix timeout calculation when bmc is disconnected Xie XiuQi
2013-12-13  2:38 ` [PATCH 1/2] ipmi: use USEC_PER_SEC instead of 1000000 for more meaningful Xie XiuQi
2013-12-13  2:39 ` [PATCH 2/2] ipmi: fix timeout calculation when bmc is disconnected Xie XiuQi
2013-12-13  3:15 ` [PATCH 0/2] " Corey Minyard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox