linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Cristian Marussi <cristian.marussi@arm.com>
To: Sudeep Holla <sudeep.holla@arm.com>
Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2 3/5] firmware: arm_scmi: Add message dump traces for bad and unexpected replies
Date: Tue, 26 Mar 2024 11:57:23 +0000	[thread overview]
Message-ID: <ZgK4I32LHbmqrhCN@pluto> (raw)
In-Reply-To: <ZgKwdhLQeYDd9SAl@bogus>

On Tue, Mar 26, 2024 at 11:24:38AM +0000, Sudeep Holla wrote:
> On Mon, Mar 25, 2024 at 08:46:18PM +0000, Cristian Marussi wrote:
> > Trace also late-timed-out, out-of-order and unexpected/spurious messages.
> > 
> > Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
> > ---
> >  drivers/firmware/arm_scmi/driver.c  | 10 ++++++++++
> >  drivers/firmware/arm_scmi/mailbox.c |  4 +++-
> >  2 files changed, 13 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c
> > index 7fc1c5b1a2a4..207ed1a52d69 100644
> > --- a/drivers/firmware/arm_scmi/driver.c
> > +++ b/drivers/firmware/arm_scmi/driver.c
> > @@ -861,6 +861,9 @@ scmi_xfer_command_acquire(struct scmi_chan_info *cinfo, u32 msg_hdr)
> >  			"Message for %d type %d is not expected!\n",
> >  			xfer_id, msg_type);
> >  		spin_unlock_irqrestore(&minfo->xfer_lock, flags);
> > +
> > +		scmi_bad_message_trace(cinfo, msg_hdr, MSG_UNEXPECTED);
> > +
> >  		return xfer;
> >  	}
> >  	refcount_inc(&xfer->users);
> > @@ -885,6 +888,9 @@ scmi_xfer_command_acquire(struct scmi_chan_info *cinfo, u32 msg_hdr)
> >  		dev_err(cinfo->dev,
> >  			"Invalid message type:%d for %d - HDR:0x%X  state:%d\n",
> >  			msg_type, xfer_id, msg_hdr, xfer->state);
> > +
> > +		scmi_bad_message_trace(cinfo, msg_hdr, MSG_INVALID);
> > +
> >  		/* On error the refcount incremented above has to be dropped */
> >  		__scmi_xfer_put(minfo, xfer);
> >  		xfer = ERR_PTR(-EINVAL);
> > @@ -921,6 +927,9 @@ static void scmi_handle_notification(struct scmi_chan_info *cinfo,
> >  	if (IS_ERR(xfer)) {
> >  		dev_err(dev, "failed to get free message slot (%ld)\n",
> >  			PTR_ERR(xfer));
> > +
> > +		scmi_bad_message_trace(cinfo, msg_hdr, MSG_NOMEM);
> > +
> >  		scmi_clear_channel(info, cinfo);
> >  		return;
> >  	}
> > @@ -1040,6 +1049,7 @@ void scmi_rx_callback(struct scmi_chan_info *cinfo, u32 msg_hdr, void *priv)
> >  		break;
> >  	default:
> >  		WARN_ONCE(1, "received unknown msg_type:%d\n", msg_type);
> > +		scmi_bad_message_trace(cinfo, msg_hdr, MSG_UNKNOWN);
> >  		break;
> >  	}
> >  }
> > diff --git a/drivers/firmware/arm_scmi/mailbox.c b/drivers/firmware/arm_scmi/mailbox.c
> > index b8d470417e8f..fb0824af7180 100644
> > --- a/drivers/firmware/arm_scmi/mailbox.c
> > +++ b/drivers/firmware/arm_scmi/mailbox.c
> > @@ -56,7 +56,9 @@ static void rx_callback(struct mbox_client *cl, void *m)
> >  	 */
> >  	if (cl->knows_txdone && !shmem_channel_free(smbox->shmem)) {
> >  		dev_warn(smbox->cinfo->dev, "Ignoring spurious A2P IRQ !\n");
> > -		return;
> > +		return scmi_bad_message_trace(smbox->cinfo,
> > +				     shmem_read_header(smbox->shmem),
> > +				     MSG_MBOX_SPURIOUS);
> 
> From previous patch, IIUC scmi_bad_message_trace is a void func and doesn't
> return anything. Did you not get any build error/warning for this ?
> 

No...I am building with W=1....but note that the caller itself here
rx_callback() is supposed to return a void...

...in V3 I may just split this into 2 lines and leave the return; alone on its
own line to avoid any confusion...

Thanks,
Cristian

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2024-03-26 11:57 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-25 20:46 [PATCH v2 0/5] SCMI misc small-updates Cristian Marussi
2024-03-25 20:46 ` [PATCH v2 1/5] include: trace: Widen the tag buffer in trace_scmi_dump_msg Cristian Marussi
2024-03-25 20:46 ` [PATCH v2 2/5] firmware: arm_scmi: Add helper to trace bad messages Cristian Marussi
2024-03-25 20:46 ` [PATCH v2 3/5] firmware: arm_scmi: Add message dump traces for bad and unexpected replies Cristian Marussi
2024-03-26 11:24   ` Sudeep Holla
2024-03-26 11:57     ` Cristian Marussi [this message]
2024-03-26 12:06       ` Sudeep Holla
2024-03-25 20:46 ` [PATCH v2 4/5] firmware: arm_scmi: Simplify scmi_devm_notifier_unregister Cristian Marussi
2024-03-25 20:46 ` [PATCH v2 5/5] firmware: arm_scmi: Use dev_err_probe to bail out Cristian Marussi
2024-04-04 14:10 ` [PATCH v2 0/5] SCMI misc small-updates Sudeep Holla

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZgK4I32LHbmqrhCN@pluto \
    --to=cristian.marussi@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sudeep.holla@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).