public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Stefan Wahren <stefan.wahren@i2se.com>
To: Umang Jain <umang.jain@ideasonboard.com>,
	Phil Elwell <phil@raspberrypi.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Adrien Thierry <athierry@redhat.com>,
	Dan Carpenter <error27@gmail.com>,
	Dave Stevenson <dave.stevenson@raspberrypi.com>,
	linux-staging@lists.linux.dev,
	Kieran Bingham <kieran.bingham@ideasonboard.com>,
	linux-kernel@vger.kernel.org,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	linux-rpi-kernel@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org,
	linux-media@vger.kernel.org
Subject: Re: [RFC PATCH 4/4] staging: vc04_services: Drop remnants of custom logging
Date: Wed, 18 Jan 2023 19:10:57 +0100	[thread overview]
Message-ID: <07d1b3e2-9072-d12f-98e3-48d0f9d712d2@i2se.com> (raw)
In-Reply-To: <20230118115810.21979-5-umang.jain@ideasonboard.com>

Hi Umang,

[add Phil]

Am 18.01.23 um 12:58 schrieb Umang Jain:
> Drop remnants of custom logging such as header definitions and such.
> Also migrate the vchiq_debugfs to use the log levels coming from
> include/linux/kern_levels.h instead.
since we switch to default kernel logging, i would prefer to drop all of 
these logging specific debugfs entries too. Or just leave one entry to 
specify a logging mask as suggested before.
>
> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
> ---
>   .../interface/vchiq_arm/vchiq_arm.c           |  4 --
>   .../interface/vchiq_arm/vchiq_core.c          | 39 +++++++------------
>   .../interface/vchiq_arm/vchiq_core.h          | 39 -------------------
>   .../interface/vchiq_arm/vchiq_debugfs.c       | 26 ++++++++-----
>   4 files changed, 31 insertions(+), 77 deletions(-)
>
> diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> index ed3773b996a3..45e28ca368ee 100644
> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> @@ -60,10 +60,6 @@
>   #define KEEPALIVE_VER 1
>   #define KEEPALIVE_VER_MIN KEEPALIVE_VER
>   
> -/* Run time control of log level, based on KERN_XXX level. */
> -int vchiq_arm_log_level = VCHIQ_LOG_DEFAULT;
> -int vchiq_susp_log_level = VCHIQ_LOG_ERROR;
> -
>   DEFINE_SPINLOCK(msg_queue_spinlock);
>   struct vchiq_state g_state;
>   
> diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
> index 7b3c57326d28..4cf710a3ca28 100644
> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
> @@ -9,6 +9,7 @@
>   #include <linux/wait.h>
>   #include <linux/delay.h>
>   #include <linux/slab.h>
> +#include <linux/kern_levels.h>
>   #include <linux/kref.h>
>   #include <linux/rcupdate.h>
>   #include <linux/sched/signal.h>
> @@ -103,10 +104,8 @@ static_assert((unsigned int)VCHIQ_PORT_MAX <
>   
>   #define BULK_INDEX(x) ((x) & (VCHIQ_NUM_SERVICE_BULKS - 1))
>   
> -#define SRVTRACE_LEVEL(srv) \
> -	(((srv) && (srv)->trace) ? VCHIQ_LOG_TRACE : vchiq_core_msg_log_level)
>   #define SRVTRACE_ENABLED(srv, lev) \
> -	(((srv) && (srv)->trace) || (vchiq_core_msg_log_level >= (lev)))
> +	(((srv) && (srv)->trace) || (LOGLEVEL_DEFAULT >= (lev)))
>   
>   #define NO_CLOSE_RECVD	0
>   #define CLOSE_RECVD	1
> @@ -154,11 +153,6 @@ static inline void check_sizes(void)
>   	BUILD_BUG_ON_NOT_POWER_OF_2(VCHIQ_MAX_SERVICES);
>   }
>   
> -/* Run time control of log level, based on KERN_XXX level. */
> -int vchiq_core_log_level = VCHIQ_LOG_DEFAULT;
> -int vchiq_core_msg_log_level = VCHIQ_LOG_DEFAULT;
> -int vchiq_sync_log_level = VCHIQ_LOG_DEFAULT;
> -
>   DEFINE_SPINLOCK(bulk_waiter_spinlock);
>   static DEFINE_SPINLOCK(quota_spinlock);
>   
> @@ -1035,8 +1029,7 @@ queue_message(struct vchiq_state *state, struct vchiq_service *service,
>   			return -EINVAL;
>   		}
>   
> -		if (SRVTRACE_ENABLED(service,
> -				     VCHIQ_LOG_INFO))
> +		if (SRVTRACE_ENABLED(service, LOGLEVEL_INFO))
>   			vchiq_log_dump_mem("Sent", 0,
>   					   header->data,
>   					   min_t(size_t, 16, callback_result));
> @@ -1144,6 +1137,7 @@ queue_message_sync(struct vchiq_state *state, struct vchiq_service *service,
>   	struct vchiq_shared_state *local;
>   	struct vchiq_header *header;
>   	ssize_t callback_result;
> +	int svc_fourcc;
>   
>   	local = state->local;
>   
> @@ -1184,8 +1178,7 @@ queue_message_sync(struct vchiq_state *state, struct vchiq_service *service,
>   	}
>   
>   	if (service) {
> -		if (SRVTRACE_ENABLED(service,
> -				     VCHIQ_LOG_INFO))
> +		if (SRVTRACE_ENABLED(service, LOGLEVEL_INFO))
>   			vchiq_log_dump_mem("Sent", 0,
>   					   header->data,
>   					   min_t(size_t, 16, callback_result));
> @@ -1199,19 +1192,15 @@ queue_message_sync(struct vchiq_state *state, struct vchiq_service *service,
>   	header->size = size;
>   	header->msgid = msgid;
>   
> -	if (vchiq_sync_log_level >= VCHIQ_LOG_TRACE) {
> -		int svc_fourcc;
>   
> -		svc_fourcc = service
> -			? service->base.fourcc
> -			: VCHIQ_MAKE_FOURCC('?', '?', '?', '?');
> +	svc_fourcc = service ? service->base.fourcc
> +			     : VCHIQ_MAKE_FOURCC('?', '?', '?', '?');
>   
> -		dev_dbg(state->dev,
> -			"Sent Sync Msg %s(%u) to %c%c%c%c s:%u d:%d len:%d",
> -			msg_type_str(VCHIQ_MSG_TYPE(msgid)), VCHIQ_MSG_TYPE(msgid),
> -			VCHIQ_FOURCC_AS_4CHARS(svc_fourcc), VCHIQ_MSG_SRCPORT(msgid),
> -			VCHIQ_MSG_DSTPORT(msgid), size);
> -	}
> +	dev_dbg(state->dev,
> +		"Sent Sync Msg %s(%u) to %c%c%c%c s:%u d:%d len:%d",
> +		msg_type_str(VCHIQ_MSG_TYPE(msgid)), VCHIQ_MSG_TYPE(msgid),
> +		VCHIQ_FOURCC_AS_4CHARS(svc_fourcc), VCHIQ_MSG_SRCPORT(msgid),
> +		VCHIQ_MSG_DSTPORT(msgid), size);
>   
>   	remote_event_signal(&state->remote->sync_trigger);
>   
> @@ -1624,7 +1613,7 @@ parse_message(struct vchiq_state *state, struct vchiq_header *header)
>   		break;
>   	}
>   
> -	if (SRVTRACE_ENABLED(service, VCHIQ_LOG_INFO)) {
> +	if (SRVTRACE_ENABLED(service, LOGLEVEL_INFO)) {
>   		int svc_fourcc;
>   
>   		svc_fourcc = service
> @@ -2031,7 +2020,7 @@ sync_func(void *v)
>   			continue;
>   		}
>   
> -		if (vchiq_sync_log_level >= VCHIQ_LOG_TRACE) {
> +		if (vchiq_sync_log_level >= LOGLEVEL_DEBUG) {
>   			int svc_fourcc;
>   
>   			svc_fourcc = service
> diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
> index ec3505424718..960bf4efeab5 100644
> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
> @@ -30,39 +30,6 @@
>   #define VCHIQ_SLOT_SIZE     4096
>   #define VCHIQ_MAX_MSG_SIZE  (VCHIQ_SLOT_SIZE - sizeof(struct vchiq_header))
>   
> -/* Run time control of log level, based on KERN_XXX level. */
> -#define VCHIQ_LOG_DEFAULT  4
> -#define VCHIQ_LOG_ERROR    3
> -#define VCHIQ_LOG_WARNING  4
> -#define VCHIQ_LOG_INFO     6
> -#define VCHIQ_LOG_TRACE    7
> -
> -#define VCHIQ_LOG_PREFIX   KERN_INFO "vchiq: "
> -
> -#ifndef vchiq_log_error
> -#define vchiq_log_error(cat, fmt, ...) \
> -	do { if (cat >= VCHIQ_LOG_ERROR) \
> -		printk(VCHIQ_LOG_PREFIX fmt "\n", ##__VA_ARGS__); } while (0)
> -#endif
> -#ifndef vchiq_log_warning
> -#define vchiq_log_warning(cat, fmt, ...) \
> -	do { if (cat >= VCHIQ_LOG_WARNING) \
> -		 printk(VCHIQ_LOG_PREFIX fmt "\n", ##__VA_ARGS__); } while (0)
> -#endif
> -#ifndef vchiq_log_info
> -#define vchiq_log_info(cat, fmt, ...) \
> -	do { if (cat >= VCHIQ_LOG_INFO) \
> -		printk(VCHIQ_LOG_PREFIX fmt "\n", ##__VA_ARGS__); } while (0)
> -#endif
> -#ifndef vchiq_log_trace
> -#define vchiq_log_trace(cat, fmt, ...) \
> -	do { if (cat >= VCHIQ_LOG_TRACE) \
> -		printk(VCHIQ_LOG_PREFIX fmt "\n", ##__VA_ARGS__); } while (0)
> -#endif
> -
> -#define vchiq_loud_error(...) \
> -	vchiq_log_error(vchiq_core_log_level, "===== " __VA_ARGS__)
> -
>   #define VCHIQ_SLOT_MASK        (VCHIQ_SLOT_SIZE - 1)
>   #define VCHIQ_SLOT_QUEUE_MASK  (VCHIQ_MAX_SLOTS_PER_SIDE - 1)
>   #define VCHIQ_SLOT_ZERO_SLOTS  DIV_ROUND_UP(sizeof(struct vchiq_slot_zero), \
> @@ -496,12 +463,6 @@ vchiq_dump_state(void *dump_context, struct vchiq_state *state);
>   extern int
>   vchiq_dump_service_state(void *dump_context, struct vchiq_service *service);
>   
> -extern void
> -vchiq_loud_error_header(void);
> -
> -extern void
> -vchiq_loud_error_footer(void);
> -
>   extern void
>   request_poll(struct vchiq_state *state, struct vchiq_service *service,
>   	     int poll_type);
> diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.c
> index dc667afd1f8c..1d142752351d 100644
> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.c
> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.c
> @@ -5,6 +5,8 @@
>    */
>   
>   #include <linux/debugfs.h>
> +#include <linux/kern_levels.h>
> +
>   #include "vchiq_core.h"
>   #include "vchiq_arm.h"
>   #include "vchiq_debugfs.h"
> @@ -22,6 +24,12 @@
>   static struct dentry *vchiq_dbg_dir;
>   static struct dentry *vchiq_dbg_clients;
>   
> +int vchiq_arm_log_level = LOGLEVEL_DEFAULT;
> +int vchiq_susp_log_level = LOGLEVEL_ERR;
> +int vchiq_core_log_level = LOGLEVEL_DEFAULT;
> +int vchiq_core_msg_log_level = LOGLEVEL_DEFAULT;
> +int vchiq_sync_log_level = LOGLEVEL_DEFAULT;
> +
>   /* Log category debugfs entries */
>   struct vchiq_debugfs_log_entry {
>   	const char *name;
> @@ -42,16 +50,16 @@ static int debugfs_log_show(struct seq_file *f, void *offset)
>   	char *log_value = NULL;
>   
>   	switch (*levp) {
> -	case VCHIQ_LOG_ERROR:
> +	case LOGLEVEL_ERR:
>   		log_value = VCHIQ_LOG_ERROR_STR;
>   		break;
> -	case VCHIQ_LOG_WARNING:
> +	case LOGLEVEL_WARNING:
>   		log_value = VCHIQ_LOG_WARNING_STR;
>   		break;
> -	case VCHIQ_LOG_INFO:
> +	case LOGLEVEL_INFO:
>   		log_value = VCHIQ_LOG_INFO_STR;
>   		break;
> -	case VCHIQ_LOG_TRACE:
> +	case LOGLEVEL_DEBUG:
>   		log_value = VCHIQ_LOG_TRACE_STR;
>   		break;
>   	default:
> @@ -85,15 +93,15 @@ static ssize_t debugfs_log_write(struct file *file,
>   	kbuf[count - 1] = 0;
>   
>   	if (strncmp("error", kbuf, strlen("error")) == 0)
> -		*levp = VCHIQ_LOG_ERROR;
> +		*levp = LOGLEVEL_ERR;
>   	else if (strncmp("warning", kbuf, strlen("warning")) == 0)
> -		*levp = VCHIQ_LOG_WARNING;
> +		*levp = LOGLEVEL_WARNING;
>   	else if (strncmp("info", kbuf, strlen("info")) == 0)
> -		*levp = VCHIQ_LOG_INFO;
> +		*levp = LOGLEVEL_INFO;
>   	else if (strncmp("trace", kbuf, strlen("trace")) == 0)
> -		*levp = VCHIQ_LOG_TRACE;
> +		*levp = LOGLEVEL_DEBUG;
>   	else
> -		*levp = VCHIQ_LOG_DEFAULT;
> +		*levp = LOGLEVEL_DEFAULT;
>   
>   	*ppos += count;
>   

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

  reply	other threads:[~2023-01-18 18:20 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-18 11:58 [RFC PATCH 0/4] Drop custom logging Umang Jain
2023-01-18 11:58 ` [RFC PATCH 1/4] staging: vc04_services: vchiq_core: " Umang Jain
2023-01-18 17:29   ` Stefan Wahren
2023-01-19 14:32   ` Dan Carpenter
2023-01-18 11:58 ` [RFC PATCH 2/4] staging: vc04_services: vchiq_arm: " Umang Jain
2023-01-18 11:58 ` [RFC PATCH 3/4] staging: vc04_services: " Umang Jain
2023-01-18 11:58 ` [RFC PATCH 4/4] staging: vc04_services: Drop remnants of " Umang Jain
2023-01-18 18:10   ` Stefan Wahren [this message]
2023-01-18 17:54 ` [RFC PATCH 0/4] Drop " Stefan Wahren
2023-01-19  5:11   ` Dan Carpenter
2023-01-19 13:31   ` Phil Elwell
2023-01-19 13:37     ` Greg Kroah-Hartman
2023-01-19 13:47       ` Phil Elwell
2023-01-19 14:25         ` Dan Carpenter
2023-01-19 14:31           ` Phil Elwell
2023-01-19 14:37             ` Dan Carpenter
2023-01-19 14:39               ` Phil Elwell
2023-01-20  0:53               ` Laurent Pinchart
2023-01-20  1:00                 ` Laurent Pinchart
2023-01-23 12:04                 ` Dan Carpenter
2023-01-19  9:34 ` Greg Kroah-Hartman
2023-01-22 14:21 ` Stefan Wahren
2023-01-22 16:26   ` Kieran Bingham
2023-01-22 18:07     ` Stefan Wahren
2023-01-23 16:54       ` Kieran Bingham

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=07d1b3e2-9072-d12f-98e3-48d0f9d712d2@i2se.com \
    --to=stefan.wahren@i2se.com \
    --cc=athierry@redhat.com \
    --cc=dave.stevenson@raspberrypi.com \
    --cc=error27@gmail.com \
    --cc=f.fainelli@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kieran.bingham@ideasonboard.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=phil@raspberrypi.com \
    --cc=umang.jain@ideasonboard.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