diff mbox series

hw/sbe-p9: Fix multi-line log messages

Message ID 20190729072804.30115-1-oohall@gmail.com
State Accepted
Headers show
Series hw/sbe-p9: Fix multi-line log messages | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success Successfully applied on branch master (1b638f899525da0f3185449114426b1eeb6ef4de)
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot success Test snowpatch/job/snowpatch-skiboot on branch master
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot-dco success Signed-off-by present

Commit Message

Oliver O'Halloran July 29, 2019, 7:28 a.m. UTC
When sending messages to the SBE we log the message using a multi-line
log message that looks like this:

[   96.390873752,8] SBE: Message queued [chip id = 0x0]:
         Reg0 : 000002010054d401
         Reg1 : 0000000000030d40
         Reg2 : 0000000000000000
         Reg3 : 0000000000000000

The lack of a common prefix makes the log messages annoying to deal with
since you can just grep for SBE: to get all the SBE related messages,
and you can't use grep -v to remove them. There's no real benifit to
squashing all this into a single prlog() call, so use a for loop to
print the registers. With this patch the output is:

[   93.253511545,8] SBE: Message queued [chip id = 0x0]:
[   93.253512343,8] SBE:     Reg0 : 000002010059d401
[   93.253513167,8] SBE:     Reg1 : 0000000000030d40
[   93.253513894,8] SBE:     Reg2 : 0000000000000000
[   93.253514627,8] SBE:     Reg3 : 0000000000000000

Cc: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
---
 hw/sbe-p9.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Stewart Smith July 30, 2019, 10:24 p.m. UTC | #1
"Oliver O'Halloran" <oohall@gmail.com> writes:
> When sending messages to the SBE we log the message using a multi-line
> log message that looks like this:
>
> [   96.390873752,8] SBE: Message queued [chip id = 0x0]:
>          Reg0 : 000002010054d401
>          Reg1 : 0000000000030d40
>          Reg2 : 0000000000000000
>          Reg3 : 0000000000000000
>
> The lack of a common prefix makes the log messages annoying to deal with
> since you can just grep for SBE: to get all the SBE related messages,
> and you can't use grep -v to remove them. There's no real benifit to
> squashing all this into a single prlog() call, so use a for loop to
> print the registers. With this patch the output is:
>
> [   93.253511545,8] SBE: Message queued [chip id = 0x0]:
> [   93.253512343,8] SBE:     Reg0 : 000002010059d401
> [   93.253513167,8] SBE:     Reg1 : 0000000000030d40
> [   93.253513894,8] SBE:     Reg2 : 0000000000000000
> [   93.253514627,8] SBE:     Reg3 : 0000000000000000
>
> Cc: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>

Acked-by: Stewart Smith <stewart@linux.ibm.com>
Vasant Hegde July 31, 2019, 4:40 a.m. UTC | #2
On 07/29/2019 12:58 PM, Oliver O'Halloran wrote:
> When sending messages to the SBE we log the message using a multi-line
> log message that looks like this:
> 
> [   96.390873752,8] SBE: Message queued [chip id = 0x0]:
>           Reg0 : 000002010054d401
>           Reg1 : 0000000000030d40
>           Reg2 : 0000000000000000
>           Reg3 : 0000000000000000
> 
> The lack of a common prefix makes the log messages annoying to deal with
> since you can just grep for SBE: to get all the SBE related messages,
> and you can't use grep -v to remove them. There's no real benifit to
> squashing all this into a single prlog() call, so use a for loop to
> print the registers. With this patch the output is:
> 
> [   93.253511545,8] SBE: Message queued [chip id = 0x0]:
> [   93.253512343,8] SBE:     Reg0 : 000002010059d401
> [   93.253513167,8] SBE:     Reg1 : 0000000000030d40
> [   93.253513894,8] SBE:     Reg2 : 0000000000000000
> [   93.253514627,8] SBE:     Reg3 : 0000000000000000
> 
> Cc: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>

Looks good.

Reviewed-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>

-Vasant
diff mbox series

Patch

diff --git a/hw/sbe-p9.c b/hw/sbe-p9.c
index c28dbb9d6f08..3b415c27e7c5 100644
--- a/hw/sbe-p9.c
+++ b/hw/sbe-p9.c
@@ -283,9 +283,9 @@  static int p9_sbe_msg_send(struct p9_sbe *sbe, struct p9_sbe_msg *msg)
 	if (rc != OPAL_SUCCESS)
 		return rc;
 
-	prlog(PR_TRACE, "Message queued [chip id = 0x%x]:\n\t Reg0 : %016llx"
-	      "\n\t Reg1 : %016llx\n\t Reg2 : %016llx\n\t Reg3 : %016llx\n",
-	      sbe->chip_id, msg->reg[0], msg->reg[1], msg->reg[2], msg->reg[3]);
+	prlog(PR_TRACE, "Message queued [chip id = 0x%x]:\n", sbe->chip_id);
+	for (i = 0; i < 4; i++)
+		prlog(PR_TRACE, "    Reg%d : %016llx\n", i, msg->reg[i]);
 
 	msg->timeout = mftb() + msecs_to_tb(SBE_CMD_TIMEOUT_MAX);
 	sbe->state = sbe_mbox_send;