All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cristian Marussi <cristian.marussi@arm.com>
To: Luke Parkin <luke.parkin@arm.com>
Cc: linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, arm-scmi@vger.kernel.org,
	sudeep.holla@arm.com, cristian.marussi@arm.com
Subject: Re: [PATCH v3 3/5] firmware: arm_scmi: Track basic SCMI statistics
Date: Wed, 24 Jul 2024 15:21:31 +0100	[thread overview]
Message-ID: <ZqEN6w49zFSDMUIe@pluto> (raw)
In-Reply-To: <20240715133751.2877197-4-luke.parkin@arm.com>

On Mon, Jul 15, 2024 at 02:37:49PM +0100, Luke Parkin wrote:
> Add tracking of initial statistics
> 
> Signed-off-by: Luke Parkin <luke.parkin@arm.com>
> ---
> V2->V3
> Add more statistics
> Use new log_stats method.
> V1->V2
> Drop unneccesary atomic_set's
> Use new 'scmi_log_stats' to simplify incrementing of atomics
> Move scmi_log_stats to locations which mean no extra conditionals
> 	are needed
> ---
>  drivers/firmware/arm_scmi/driver.c | 39 ++++++++++++++++++++++++++----
>  1 file changed, 34 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c
> index 6edec6ec912d..b22f104cda36 100644
> --- a/drivers/firmware/arm_scmi/driver.c
> +++ b/drivers/firmware/arm_scmi/driver.c
> @@ -126,6 +126,20 @@ struct scmi_debug_info {
>  };
>  
>  enum debug_stat_counters {
> +	SENT_OK,
> +	SENT_FAIL,
> +	SENT_FAIL_POLLING_UNSUPPORTED,
> +	SENT_FAIL_CHANNEL_NOT_FOUND,
> +	RESPONSE_OK,
> +	NOTIF_OK,
> +	DLYD_RESPONSE_OK,
> +	XFERS_RESPONSE_TIMEOUT,
> +	XFERS_RESPONSE_POLLED_TIMEOUT,
> +	RESPONSE_POLLED_OK,
> +	ERR_MSG_UNEXPECTED,
> +	ERR_MSG_INVALID,
> +	ERR_MSG_NOMEM,
> +	ERR_PROTOCOL,
>  	LAST
>  };
>  
> @@ -994,6 +1008,7 @@ scmi_xfer_command_acquire(struct scmi_chan_info *cinfo, u32 msg_hdr)
>  		spin_unlock_irqrestore(&minfo->xfer_lock, flags);
>  
>  		scmi_bad_message_trace(cinfo, msg_hdr, MSG_UNEXPECTED);
> +		scmi_log_stats(info->dbg_stats, ERR_MSG_UNEXPECTED);

I'd be tempted to say why dont you wrap these scmi_log_stats() inside the
scmi_bad_message_trace() ... BUT in order to avoid an additional
conditional inside the scmi_bad_message_trace() you will need to somehow
remap the MSG_UNEXPECTED to ERR_MSG_UNEXPECTED inside scmi_bad_message_trace (lets say
with a local onstack array indexed by -err)...AND that would mean committing to keep
such mapping in-sync with the the above enum, so as to avoid that adding
a new definition into scmi_bad_msg BUT not to debug_stat_counters will
end up in a buffer overflow....so at the end probably better/safer to keep it
this way...

Thanks,
Cristian

  parent reply	other threads:[~2024-07-24 14:21 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-15 13:37 [PATCH v3 0/5] Add Per-transport SCMI debug statistics Luke Parkin
2024-07-15 13:37 ` [PATCH v3 1/5] firmware: arm_scmi: Remove superfluous handle_to_scmi_info Luke Parkin
2024-07-24 13:07   ` Cristian Marussi
2024-07-15 13:37 ` [PATCH v3 2/5] firmware: arm_scmi: Add support for tracking statistics Luke Parkin
2024-07-24 13:40   ` Cristian Marussi
2024-07-15 13:37 ` [PATCH v3 3/5] firmware: arm_scmi: Track basic SCMI statistics Luke Parkin
2024-07-16 12:29   ` Peng Fan
2024-07-22 12:21     ` Luke Parkin
2024-07-24 14:24       ` Cristian Marussi
2024-07-24 14:21   ` Cristian Marussi [this message]
2024-07-24 14:39     ` Luke Parkin
2024-07-15 13:37 ` [PATCH v3 4/5] firmware: arm_scmi: Create debugfs files for statistics Luke Parkin
2024-07-24 14:26   ` Cristian Marussi
2024-07-15 13:37 ` [PATCH v3 5/5] firmware: arm_scmi: Reset statistics Luke Parkin
2024-07-24 14:41   ` Cristian Marussi
2024-07-24 14:46 ` [PATCH v3 0/5] Add Per-transport SCMI debug statistics Cristian Marussi

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=ZqEN6w49zFSDMUIe@pluto \
    --to=cristian.marussi@arm.com \
    --cc=arm-scmi@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luke.parkin@arm.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.