2019-11-07 11:43:42

by Mihail Atanassov

[permalink] [raw]
Subject: [PATCH v2 0/5] drm/komeda: Improve IRQ error event prints

Hi everyone,

Sending out a v2 of the series since I had missed out a couple of issues
checkpatch caught.

Changes since v1 [https://patchwork.freedesktop.org/series/68325/]:
- Fixed a couple of checkpatch issues in 2/5 and 5/5

v1's cover letter:

This is a smallish series that tries to remove some build-time
configurability in komeda and replace it with a debugfs control. Later
patches in the series add some extra functionality which I found useful
during my debugging sessions, so I figured I'd bake it in.

I've preserved the default behaviour as if CONFIG_KOMEDA_ERROR_PRINT
were enabled, so production kernels can have some feedback from the
driver when things are going south.

1: Introduce the err_verbosity debugfs node for komeda; this keeps the
default of printing error events once per frame.
2: Drop CONFIG_KOMEDA_ERROR_PRINT since output can be disabled at
runtime
3: Add a drm state dump on event. It's quite chatty so I left it only
for error events; printing all that once per frame every vsync floods my
serial terminal, so no info + state combination.
4: Add lower-severity categories to the event printer
5: Normally these events fire only once per pageflip, but sometimes it's
useful to see them all as they come in.

These patches are overall quite tiny, and I was considering just
squashing them into one, but I opted to keep them separate for an easier
review experience; please let me know whether you prefer a single patch.
Thanks!

Mihail Atanassov (5):
drm/komeda: Add debugfs node to control error verbosity
drm/komeda: Remove CONFIG_KOMEDA_ERROR_PRINT
drm/komeda: Optionally dump DRM state on interrupts
drm/komeda: Add option to print WARN- and INFO-level IRQ events
drm/komeda: add rate limiting disable to err_verbosity

drivers/gpu/drm/arm/display/Kconfig | 6 ----
drivers/gpu/drm/arm/display/komeda/Makefile | 5 ++--
.../gpu/drm/arm/display/komeda/komeda_dev.c | 4 +++
.../gpu/drm/arm/display/komeda/komeda_dev.h | 30 +++++++++++++++----
.../gpu/drm/arm/display/komeda/komeda_event.c | 23 +++++++++++---
.../gpu/drm/arm/display/komeda/komeda_kms.c | 2 +-
6 files changed, 51 insertions(+), 19 deletions(-)

--
2.23.0


2019-11-07 11:43:46

by Mihail Atanassov

[permalink] [raw]
Subject: [PATCH v2 2/5] drm/komeda: Remove CONFIG_KOMEDA_ERROR_PRINT

Now that there's a debugfs node to control the same, remove the
config option.

Reviewed-by: James Qian Wang (Arm Technology China) <[email protected]>
Signed-off-by: Mihail Atanassov <[email protected]>
---
drivers/gpu/drm/arm/display/Kconfig | 6 ------
drivers/gpu/drm/arm/display/komeda/Makefile | 5 ++---
drivers/gpu/drm/arm/display/komeda/komeda_dev.h | 6 ------
3 files changed, 2 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/arm/display/Kconfig b/drivers/gpu/drm/arm/display/Kconfig
index e87ff8623076..cec0639e3aa1 100644
--- a/drivers/gpu/drm/arm/display/Kconfig
+++ b/drivers/gpu/drm/arm/display/Kconfig
@@ -12,9 +12,3 @@ config DRM_KOMEDA
Processor driver. It supports the D71 variants of the hardware.

If compiled as a module it will be called komeda.
-
-config DRM_KOMEDA_ERROR_PRINT
- bool "Enable komeda error print"
- depends on DRM_KOMEDA
- help
- Choose this option to enable error printing.
diff --git a/drivers/gpu/drm/arm/display/komeda/Makefile b/drivers/gpu/drm/arm/display/komeda/Makefile
index f095a1c68ac7..1931a7fa1a14 100644
--- a/drivers/gpu/drm/arm/display/komeda/Makefile
+++ b/drivers/gpu/drm/arm/display/komeda/Makefile
@@ -16,12 +16,11 @@ komeda-y := \
komeda_crtc.o \
komeda_plane.o \
komeda_wb_connector.o \
- komeda_private_obj.o
+ komeda_private_obj.o \
+ komeda_event.o

komeda-y += \
d71/d71_dev.o \
d71/d71_component.o

-komeda-$(CONFIG_DRM_KOMEDA_ERROR_PRINT) += komeda_event.o
-
obj-$(CONFIG_DRM_KOMEDA) += komeda.o
diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h b/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
index b5bd3d5898ee..831c375180f8 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
@@ -226,13 +226,7 @@ void komeda_dev_destroy(struct komeda_dev *mdev);

struct komeda_dev *dev_to_mdev(struct device *dev);

-#ifdef CONFIG_DRM_KOMEDA_ERROR_PRINT
void komeda_print_events(struct komeda_events *evts, struct drm_device *dev);
-#else
-static inline void komeda_print_events(struct komeda_events *evts,
- struct drm_device *dev)
-{}
-#endif

int komeda_dev_resume(struct komeda_dev *mdev);
int komeda_dev_suspend(struct komeda_dev *mdev);
--
2.23.0

2019-11-07 11:44:07

by Mihail Atanassov

[permalink] [raw]
Subject: [PATCH v2 3/5] drm/komeda: Optionally dump DRM state on interrupts

It's potentially useful information when diagnosing error/warn IRQs, so
dump it to dmesg with a drm_info_printer. Hide this extra debug dumping
behind another komeda_dev->err_verbosity bit.

Note that there's not much sense in dumping it for INFO events,
since the VSYNC event will swamp the log.

Reviewed-by: James Qian Wang (Arm Technology China) <[email protected]>
Signed-off-by: Mihail Atanassov <[email protected]>
---

v2: Clean up continuation line warning from checkpatch.

drivers/gpu/drm/arm/display/komeda/komeda_dev.h | 5 ++++-
drivers/gpu/drm/arm/display/komeda/komeda_event.c | 8 +++++++-
2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h b/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
index 831c375180f8..4809000c1efb 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
@@ -205,11 +205,14 @@ struct komeda_dev {
/**
* @err_verbosity: bitmask for how much extra info to print on error
*
- * See KOMEDA_DEV_* macros for details.
+ * See KOMEDA_DEV_* macros for details. Low byte contains the debug
+ * level categories, the high byte contains extra debug options.
*/
u16 err_verbosity;
/* Print a single line per error per frame with error events. */
#define KOMEDA_DEV_PRINT_ERR_EVENTS BIT(0)
+ /* Dump DRM state on an error or warning event. */
+#define KOMEDA_DEV_PRINT_DUMP_STATE_ON_EVENT BIT(8)
};

static inline bool
diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_event.c b/drivers/gpu/drm/arm/display/komeda/komeda_event.c
index 575ed4df74ed..de99a588ed75 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_event.c
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_event.c
@@ -4,6 +4,7 @@
* Author: James.Qian.Wang <[email protected]>
*
*/
+#include <drm/drm_atomic.h>
#include <drm/drm_print.h>

#include "komeda_dev.h"
@@ -113,6 +114,7 @@ void komeda_print_events(struct komeda_events *evts, struct drm_device *dev)
static bool en_print = true;
struct komeda_dev *mdev = dev->dev_private;
u16 const err_verbosity = mdev->err_verbosity;
+ u64 evts_mask = evts->global | evts->pipes[0] | evts->pipes[1];

/* reduce the same msg print, only print the first evt for one frame */
if (evts->global || is_new_frame(evts))
@@ -123,9 +125,10 @@ void komeda_print_events(struct komeda_events *evts, struct drm_device *dev)
if (err_verbosity & KOMEDA_DEV_PRINT_ERR_EVENTS)
print_evts |= KOMEDA_ERR_EVENTS;

- if ((evts->global | evts->pipes[0] | evts->pipes[1]) & print_evts) {
+ if (evts_mask & print_evts) {
char msg[256];
struct komeda_str str;
+ struct drm_printer p = drm_info_printer(dev->dev);

str.str = msg;
str.sz = sizeof(msg);
@@ -139,6 +142,9 @@ void komeda_print_events(struct komeda_events *evts, struct drm_device *dev)
evt_str(&str, evts->pipes[1]);

DRM_ERROR("err detect: %s\n", msg);
+ if ((err_verbosity & KOMEDA_DEV_PRINT_DUMP_STATE_ON_EVENT) &&
+ (evts_mask & (KOMEDA_ERR_EVENTS | KOMEDA_WARN_EVENTS)))
+ drm_state_dump(dev, &p);

en_print = false;
}
--
2.23.0

2019-11-07 11:44:46

by Mihail Atanassov

[permalink] [raw]
Subject: [PATCH v2 4/5] drm/komeda: Add option to print WARN- and INFO-level IRQ events

Extra detail (normally off) almost never hurts.

Reviewed-by: James Qian Wang (Arm Technology China) <[email protected]>
Signed-off-by: Mihail Atanassov <[email protected]>
---
drivers/gpu/drm/arm/display/komeda/komeda_dev.h | 11 +++++++++++
drivers/gpu/drm/arm/display/komeda/komeda_event.c | 4 ++++
2 files changed, 15 insertions(+)

diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h b/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
index 4809000c1efb..d9fc9c48859a 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
@@ -51,6 +51,13 @@

#define KOMEDA_WARN_EVENTS KOMEDA_ERR_CSCE

+#define KOMEDA_INFO_EVENTS ({0 \
+ | KOMEDA_EVENT_VSYNC \
+ | KOMEDA_EVENT_FLIP \
+ | KOMEDA_EVENT_EOW \
+ | KOMEDA_EVENT_MODE \
+ })
+
/* malidp device id */
enum {
MALI_D71 = 0,
@@ -211,6 +218,10 @@ struct komeda_dev {
u16 err_verbosity;
/* Print a single line per error per frame with error events. */
#define KOMEDA_DEV_PRINT_ERR_EVENTS BIT(0)
+ /* Print a single line per warning per frame with error events. */
+#define KOMEDA_DEV_PRINT_WARN_EVENTS BIT(1)
+ /* Print a single line per info event per frame with error events. */
+#define KOMEDA_DEV_PRINT_INFO_EVENTS BIT(2)
/* Dump DRM state on an error or warning event. */
#define KOMEDA_DEV_PRINT_DUMP_STATE_ON_EVENT BIT(8)
};
diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_event.c b/drivers/gpu/drm/arm/display/komeda/komeda_event.c
index de99a588ed75..7fd624761a2b 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_event.c
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_event.c
@@ -124,6 +124,10 @@ void komeda_print_events(struct komeda_events *evts, struct drm_device *dev)

if (err_verbosity & KOMEDA_DEV_PRINT_ERR_EVENTS)
print_evts |= KOMEDA_ERR_EVENTS;
+ if (err_verbosity & KOMEDA_DEV_PRINT_WARN_EVENTS)
+ print_evts |= KOMEDA_WARN_EVENTS;
+ if (err_verbosity & KOMEDA_DEV_PRINT_INFO_EVENTS)
+ print_evts |= KOMEDA_INFO_EVENTS;

if (evts_mask & print_evts) {
char msg[256];
--
2.23.0

2019-11-07 11:46:35

by Mihail Atanassov

[permalink] [raw]
Subject: [PATCH v2 1/5] drm/komeda: Add debugfs node to control error verbosity

Named 'err_verbosity', currently with only 1 active bit in that
replicates the existing level - print error events once per flip.

Reviewed-by: James Qian Wang (Arm Technology China) <[email protected]>
Signed-off-by: Mihail Atanassov <[email protected]>
---
drivers/gpu/drm/arm/display/komeda/komeda_dev.c | 4 ++++
drivers/gpu/drm/arm/display/komeda/komeda_dev.h | 14 ++++++++++++--
drivers/gpu/drm/arm/display/komeda/komeda_event.c | 9 +++++++--
drivers/gpu/drm/arm/display/komeda/komeda_kms.c | 2 +-
4 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_dev.c b/drivers/gpu/drm/arm/display/komeda/komeda_dev.c
index 14d5c5da9e3b..4e46f650fddf 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_dev.c
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_dev.c
@@ -58,6 +58,8 @@ static void komeda_debugfs_init(struct komeda_dev *mdev)
mdev->debugfs_root = debugfs_create_dir("komeda", NULL);
debugfs_create_file("register", 0444, mdev->debugfs_root,
mdev, &komeda_register_fops);
+ debugfs_create_x16("err_verbosity", 0664, mdev->debugfs_root,
+ &mdev->err_verbosity);
}
#endif

@@ -273,6 +275,8 @@ struct komeda_dev *komeda_dev_create(struct device *dev)
goto err_cleanup;
}

+ mdev->err_verbosity = KOMEDA_DEV_PRINT_ERR_EVENTS;
+
#ifdef CONFIG_DEBUG_FS
komeda_debugfs_init(mdev);
#endif
diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h b/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
index 414200233b64..b5bd3d5898ee 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
@@ -202,6 +202,14 @@ struct komeda_dev {

/** @debugfs_root: root directory of komeda debugfs */
struct dentry *debugfs_root;
+ /**
+ * @err_verbosity: bitmask for how much extra info to print on error
+ *
+ * See KOMEDA_DEV_* macros for details.
+ */
+ u16 err_verbosity;
+ /* Print a single line per error per frame with error events. */
+#define KOMEDA_DEV_PRINT_ERR_EVENTS BIT(0)
};

static inline bool
@@ -219,9 +227,11 @@ void komeda_dev_destroy(struct komeda_dev *mdev);
struct komeda_dev *dev_to_mdev(struct device *dev);

#ifdef CONFIG_DRM_KOMEDA_ERROR_PRINT
-void komeda_print_events(struct komeda_events *evts);
+void komeda_print_events(struct komeda_events *evts, struct drm_device *dev);
#else
-static inline void komeda_print_events(struct komeda_events *evts) {}
+static inline void komeda_print_events(struct komeda_events *evts,
+ struct drm_device *dev)
+{}
#endif

int komeda_dev_resume(struct komeda_dev *mdev);
diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_event.c b/drivers/gpu/drm/arm/display/komeda/komeda_event.c
index a36fb86cc054..575ed4df74ed 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_event.c
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_event.c
@@ -107,10 +107,12 @@ static bool is_new_frame(struct komeda_events *a)
(KOMEDA_EVENT_FLIP | KOMEDA_EVENT_EOW);
}

-void komeda_print_events(struct komeda_events *evts)
+void komeda_print_events(struct komeda_events *evts, struct drm_device *dev)
{
- u64 print_evts = KOMEDA_ERR_EVENTS;
+ u64 print_evts = 0;
static bool en_print = true;
+ struct komeda_dev *mdev = dev->dev_private;
+ u16 const err_verbosity = mdev->err_verbosity;

/* reduce the same msg print, only print the first evt for one frame */
if (evts->global || is_new_frame(evts))
@@ -118,6 +120,9 @@ void komeda_print_events(struct komeda_events *evts)
if (!en_print)
return;

+ if (err_verbosity & KOMEDA_DEV_PRINT_ERR_EVENTS)
+ print_evts |= KOMEDA_ERR_EVENTS;
+
if ((evts->global | evts->pipes[0] | evts->pipes[1]) & print_evts) {
char msg[256];
struct komeda_str str;
diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c
index d49772de93e0..e30a5b43caa9 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c
@@ -48,7 +48,7 @@ static irqreturn_t komeda_kms_irq_handler(int irq, void *data)
memset(&evts, 0, sizeof(evts));
status = mdev->funcs->irq_handler(mdev, &evts);

- komeda_print_events(&evts);
+ komeda_print_events(&evts, drm);

/* Notify the crtc to handle the events */
for (i = 0; i < kms->n_crtcs; i++)
--
2.23.0

2019-11-07 11:47:40

by Mihail Atanassov

[permalink] [raw]
Subject: [PATCH v2 5/5] drm/komeda: add rate limiting disable to err_verbosity

It's possible to get multiple events in a single frame/flip, so add an
option to print them all.

Reviewed-by: James Qian Wang (Arm Technology China) <[email protected]>
Signed-off-by: Mihail Atanassov <[email protected]>
---

v2: Clean up continuation line warning from checkpatch.

drivers/gpu/drm/arm/display/komeda/komeda_dev.h | 2 ++
drivers/gpu/drm/arm/display/komeda/komeda_event.c | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h b/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
index d9fc9c48859a..15f52e304c08 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
@@ -224,6 +224,8 @@ struct komeda_dev {
#define KOMEDA_DEV_PRINT_INFO_EVENTS BIT(2)
/* Dump DRM state on an error or warning event. */
#define KOMEDA_DEV_PRINT_DUMP_STATE_ON_EVENT BIT(8)
+ /* Disable rate limiting of event prints (normally one per commit) */
+#define KOMEDA_DEV_PRINT_DISABLE_RATELIMIT BIT(12)
};

static inline bool
diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_event.c b/drivers/gpu/drm/arm/display/komeda/komeda_event.c
index 7fd624761a2b..bf269683f811 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_event.c
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_event.c
@@ -119,7 +119,7 @@ void komeda_print_events(struct komeda_events *evts, struct drm_device *dev)
/* reduce the same msg print, only print the first evt for one frame */
if (evts->global || is_new_frame(evts))
en_print = true;
- if (!en_print)
+ if (!(err_verbosity & KOMEDA_DEV_PRINT_DISABLE_RATELIMIT) && !en_print)
return;

if (err_verbosity & KOMEDA_DEV_PRINT_ERR_EVENTS)
--
2.23.0

2019-11-11 15:53:54

by Liviu Dudau

[permalink] [raw]
Subject: Re: [PATCH v2 1/5] drm/komeda: Add debugfs node to control error verbosity

On Thu, Nov 07, 2019 at 11:42:28AM +0000, Mihail Atanassov wrote:
> Named 'err_verbosity', currently with only 1 active bit in that
> replicates the existing level - print error events once per flip.
>
> Reviewed-by: James Qian Wang (Arm Technology China) <[email protected]>
> Signed-off-by: Mihail Atanassov <[email protected]>

Acked-by: Liviu Dudau <[email protected]>

Best regards,
Liviu

> ---
> drivers/gpu/drm/arm/display/komeda/komeda_dev.c | 4 ++++
> drivers/gpu/drm/arm/display/komeda/komeda_dev.h | 14 ++++++++++++--
> drivers/gpu/drm/arm/display/komeda/komeda_event.c | 9 +++++++--
> drivers/gpu/drm/arm/display/komeda/komeda_kms.c | 2 +-
> 4 files changed, 24 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_dev.c b/drivers/gpu/drm/arm/display/komeda/komeda_dev.c
> index 14d5c5da9e3b..4e46f650fddf 100644
> --- a/drivers/gpu/drm/arm/display/komeda/komeda_dev.c
> +++ b/drivers/gpu/drm/arm/display/komeda/komeda_dev.c
> @@ -58,6 +58,8 @@ static void komeda_debugfs_init(struct komeda_dev *mdev)
> mdev->debugfs_root = debugfs_create_dir("komeda", NULL);
> debugfs_create_file("register", 0444, mdev->debugfs_root,
> mdev, &komeda_register_fops);
> + debugfs_create_x16("err_verbosity", 0664, mdev->debugfs_root,
> + &mdev->err_verbosity);
> }
> #endif
>
> @@ -273,6 +275,8 @@ struct komeda_dev *komeda_dev_create(struct device *dev)
> goto err_cleanup;
> }
>
> + mdev->err_verbosity = KOMEDA_DEV_PRINT_ERR_EVENTS;
> +
> #ifdef CONFIG_DEBUG_FS
> komeda_debugfs_init(mdev);
> #endif
> diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h b/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
> index 414200233b64..b5bd3d5898ee 100644
> --- a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
> +++ b/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
> @@ -202,6 +202,14 @@ struct komeda_dev {
>
> /** @debugfs_root: root directory of komeda debugfs */
> struct dentry *debugfs_root;
> + /**
> + * @err_verbosity: bitmask for how much extra info to print on error
> + *
> + * See KOMEDA_DEV_* macros for details.
> + */
> + u16 err_verbosity;
> + /* Print a single line per error per frame with error events. */
> +#define KOMEDA_DEV_PRINT_ERR_EVENTS BIT(0)
> };
>
> static inline bool
> @@ -219,9 +227,11 @@ void komeda_dev_destroy(struct komeda_dev *mdev);
> struct komeda_dev *dev_to_mdev(struct device *dev);
>
> #ifdef CONFIG_DRM_KOMEDA_ERROR_PRINT
> -void komeda_print_events(struct komeda_events *evts);
> +void komeda_print_events(struct komeda_events *evts, struct drm_device *dev);
> #else
> -static inline void komeda_print_events(struct komeda_events *evts) {}
> +static inline void komeda_print_events(struct komeda_events *evts,
> + struct drm_device *dev)
> +{}
> #endif
>
> int komeda_dev_resume(struct komeda_dev *mdev);
> diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_event.c b/drivers/gpu/drm/arm/display/komeda/komeda_event.c
> index a36fb86cc054..575ed4df74ed 100644
> --- a/drivers/gpu/drm/arm/display/komeda/komeda_event.c
> +++ b/drivers/gpu/drm/arm/display/komeda/komeda_event.c
> @@ -107,10 +107,12 @@ static bool is_new_frame(struct komeda_events *a)
> (KOMEDA_EVENT_FLIP | KOMEDA_EVENT_EOW);
> }
>
> -void komeda_print_events(struct komeda_events *evts)
> +void komeda_print_events(struct komeda_events *evts, struct drm_device *dev)
> {
> - u64 print_evts = KOMEDA_ERR_EVENTS;
> + u64 print_evts = 0;
> static bool en_print = true;
> + struct komeda_dev *mdev = dev->dev_private;
> + u16 const err_verbosity = mdev->err_verbosity;
>
> /* reduce the same msg print, only print the first evt for one frame */
> if (evts->global || is_new_frame(evts))
> @@ -118,6 +120,9 @@ void komeda_print_events(struct komeda_events *evts)
> if (!en_print)
> return;
>
> + if (err_verbosity & KOMEDA_DEV_PRINT_ERR_EVENTS)
> + print_evts |= KOMEDA_ERR_EVENTS;
> +
> if ((evts->global | evts->pipes[0] | evts->pipes[1]) & print_evts) {
> char msg[256];
> struct komeda_str str;
> diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c
> index d49772de93e0..e30a5b43caa9 100644
> --- a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c
> +++ b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c
> @@ -48,7 +48,7 @@ static irqreturn_t komeda_kms_irq_handler(int irq, void *data)
> memset(&evts, 0, sizeof(evts));
> status = mdev->funcs->irq_handler(mdev, &evts);
>
> - komeda_print_events(&evts);
> + komeda_print_events(&evts, drm);
>
> /* Notify the crtc to handle the events */
> for (i = 0; i < kms->n_crtcs; i++)
> --
> 2.23.0
>

--
====================
| I would like to |
| fix the world, |
| but they're not |
| giving me the |
\ source code! /
---------------
¯\_(ツ)_/¯

2019-11-11 15:54:44

by Liviu Dudau

[permalink] [raw]
Subject: Re: [PATCH v2 5/5] drm/komeda: add rate limiting disable to err_verbosity

On Thu, Nov 07, 2019 at 11:42:44AM +0000, Mihail Atanassov wrote:
> It's possible to get multiple events in a single frame/flip, so add an
> option to print them all.
>
> Reviewed-by: James Qian Wang (Arm Technology China) <[email protected]>
> Signed-off-by: Mihail Atanassov <[email protected]>

For the whole series:

Acked-by: Liviu Dudau <[email protected]>

Best regards,
Liviu

> ---
>
> v2: Clean up continuation line warning from checkpatch.
>
> drivers/gpu/drm/arm/display/komeda/komeda_dev.h | 2 ++
> drivers/gpu/drm/arm/display/komeda/komeda_event.c | 2 +-
> 2 files changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h b/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
> index d9fc9c48859a..15f52e304c08 100644
> --- a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
> +++ b/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
> @@ -224,6 +224,8 @@ struct komeda_dev {
> #define KOMEDA_DEV_PRINT_INFO_EVENTS BIT(2)
> /* Dump DRM state on an error or warning event. */
> #define KOMEDA_DEV_PRINT_DUMP_STATE_ON_EVENT BIT(8)
> + /* Disable rate limiting of event prints (normally one per commit) */
> +#define KOMEDA_DEV_PRINT_DISABLE_RATELIMIT BIT(12)
> };
>
> static inline bool
> diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_event.c b/drivers/gpu/drm/arm/display/komeda/komeda_event.c
> index 7fd624761a2b..bf269683f811 100644
> --- a/drivers/gpu/drm/arm/display/komeda/komeda_event.c
> +++ b/drivers/gpu/drm/arm/display/komeda/komeda_event.c
> @@ -119,7 +119,7 @@ void komeda_print_events(struct komeda_events *evts, struct drm_device *dev)
> /* reduce the same msg print, only print the first evt for one frame */
> if (evts->global || is_new_frame(evts))
> en_print = true;
> - if (!en_print)
> + if (!(err_verbosity & KOMEDA_DEV_PRINT_DISABLE_RATELIMIT) && !en_print)
> return;
>
> if (err_verbosity & KOMEDA_DEV_PRINT_ERR_EVENTS)
> --
> 2.23.0
>

--
====================
| I would like to |
| fix the world, |
| but they're not |
| giving me the |
\ source code! /
---------------
¯\_(ツ)_/¯

2019-11-12 13:01:36

by Mihail Atanassov

[permalink] [raw]
Subject: Re: [PATCH v2 5/5] drm/komeda: add rate limiting disable to err_verbosity

On Monday, 11 November 2019 15:53:14 GMT Liviu Dudau wrote:
> On Thu, Nov 07, 2019 at 11:42:44AM +0000, Mihail Atanassov wrote:
> > It's possible to get multiple events in a single frame/flip, so add an
> > option to print them all.
> >
> > Reviewed-by: James Qian Wang (Arm Technology China) <[email protected]>
> > Signed-off-by: Mihail Atanassov <[email protected]>
>
> For the whole series:
>
> Acked-by: Liviu Dudau <[email protected]>

Thanks, applied to drm-misc-next.

>
> Best regards,
> Liviu
>
> > ---
> >
> > v2: Clean up continuation line warning from checkpatch.
> >
> > drivers/gpu/drm/arm/display/komeda/komeda_dev.h | 2 ++
> > drivers/gpu/drm/arm/display/komeda/komeda_event.c | 2 +-
> > 2 files changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h b/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
> > index d9fc9c48859a..15f52e304c08 100644
> > --- a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
> > +++ b/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
> > @@ -224,6 +224,8 @@ struct komeda_dev {
> > #define KOMEDA_DEV_PRINT_INFO_EVENTS BIT(2)
> > /* Dump DRM state on an error or warning event. */
> > #define KOMEDA_DEV_PRINT_DUMP_STATE_ON_EVENT BIT(8)
> > + /* Disable rate limiting of event prints (normally one per commit) */
> > +#define KOMEDA_DEV_PRINT_DISABLE_RATELIMIT BIT(12)
> > };
> >
> > static inline bool
> > diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_event.c b/drivers/gpu/drm/arm/display/komeda/komeda_event.c
> > index 7fd624761a2b..bf269683f811 100644
> > --- a/drivers/gpu/drm/arm/display/komeda/komeda_event.c
> > +++ b/drivers/gpu/drm/arm/display/komeda/komeda_event.c
> > @@ -119,7 +119,7 @@ void komeda_print_events(struct komeda_events *evts, struct drm_device *dev)
> > /* reduce the same msg print, only print the first evt for one frame */
> > if (evts->global || is_new_frame(evts))
> > en_print = true;
> > - if (!en_print)
> > + if (!(err_verbosity & KOMEDA_DEV_PRINT_DISABLE_RATELIMIT) && !en_print)
> > return;
> >
> > if (err_verbosity & KOMEDA_DEV_PRINT_ERR_EVENTS)
> > --
> > 2.23.0
> >
>
> --
> ====================
> | I would like to |
> | fix the world, |
> | but they're not |
> | giving me the |
> \ source code! /
> ---------------
> ¯\_(ツ)_/¯
>


--
Mihail



2019-11-12 18:25:30

by Daniel Vetter

[permalink] [raw]
Subject: Re: [PATCH v2 5/5] drm/komeda: add rate limiting disable to err_verbosity

On Tue, Nov 12, 2019 at 2:00 PM Mihail Atanassov
<[email protected]> wrote:
>
> On Monday, 11 November 2019 15:53:14 GMT Liviu Dudau wrote:
> > On Thu, Nov 07, 2019 at 11:42:44AM +0000, Mihail Atanassov wrote:
> > > It's possible to get multiple events in a single frame/flip, so add an
> > > option to print them all.
> > >
> > > Reviewed-by: James Qian Wang (Arm Technology China) <[email protected]>
> > > Signed-off-by: Mihail Atanassov <[email protected]>
> >
> > For the whole series:
> >
> > Acked-by: Liviu Dudau <[email protected]>
>
> Thanks, applied to drm-misc-next.

And now komeda doesn't even compile anymore. I'm ... impressed.

I mean generally people break other people's driver, not their own.
-Daniel

> >
> > Best regards,
> > Liviu
> >
> > > ---
> > >
> > > v2: Clean up continuation line warning from checkpatch.
> > >
> > > drivers/gpu/drm/arm/display/komeda/komeda_dev.h | 2 ++
> > > drivers/gpu/drm/arm/display/komeda/komeda_event.c | 2 +-
> > > 2 files changed, 3 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h b/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
> > > index d9fc9c48859a..15f52e304c08 100644
> > > --- a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
> > > +++ b/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
> > > @@ -224,6 +224,8 @@ struct komeda_dev {
> > > #define KOMEDA_DEV_PRINT_INFO_EVENTS BIT(2)
> > > /* Dump DRM state on an error or warning event. */
> > > #define KOMEDA_DEV_PRINT_DUMP_STATE_ON_EVENT BIT(8)
> > > + /* Disable rate limiting of event prints (normally one per commit) */
> > > +#define KOMEDA_DEV_PRINT_DISABLE_RATELIMIT BIT(12)
> > > };
> > >
> > > static inline bool
> > > diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_event.c b/drivers/gpu/drm/arm/display/komeda/komeda_event.c
> > > index 7fd624761a2b..bf269683f811 100644
> > > --- a/drivers/gpu/drm/arm/display/komeda/komeda_event.c
> > > +++ b/drivers/gpu/drm/arm/display/komeda/komeda_event.c
> > > @@ -119,7 +119,7 @@ void komeda_print_events(struct komeda_events *evts, struct drm_device *dev)
> > > /* reduce the same msg print, only print the first evt for one frame */
> > > if (evts->global || is_new_frame(evts))
> > > en_print = true;
> > > - if (!en_print)
> > > + if (!(err_verbosity & KOMEDA_DEV_PRINT_DISABLE_RATELIMIT) && !en_print)
> > > return;
> > >
> > > if (err_verbosity & KOMEDA_DEV_PRINT_ERR_EVENTS)
> > > --
> > > 2.23.0
> > >
> >
> > --
> > ====================
> > | I would like to |
> > | fix the world, |
> > | but they're not |
> > | giving me the |
> > \ source code! /
> > ---------------
> > ¯\_(ツ)_/¯
> >
>
>
> --
> Mihail
>
>
>


--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

2019-11-13 01:44:55

by James Qian Wang

[permalink] [raw]
Subject: Re: [PATCH v2 5/5] drm/komeda: add rate limiting disable to err_verbosity

On Tue, Nov 12, 2019 at 07:24:16PM +0100, Daniel Vetter wrote:
> On Tue, Nov 12, 2019 at 2:00 PM Mihail Atanassov
> <[email protected]> wrote:
> >
> > On Monday, 11 November 2019 15:53:14 GMT Liviu Dudau wrote:
> > > On Thu, Nov 07, 2019 at 11:42:44AM +0000, Mihail Atanassov wrote:
> > > > It's possible to get multiple events in a single frame/flip, so add an
> > > > option to print them all.
> > > >
> > > > Reviewed-by: James Qian Wang (Arm Technology China) <[email protected]>
> > > > Signed-off-by: Mihail Atanassov <[email protected]>
> > >
> > > For the whole series:
> > >
> > > Acked-by: Liviu Dudau <[email protected]>
> >
> > Thanks, applied to drm-misc-next.
>
> And now komeda doesn't even compile anymore. I'm ... impressed.
>
> I mean generally people break other people's driver, not their own.
> -Daniel

Hi Daniel:

Real Real sorry, we will find a way to avoid such stupid problem.

And the fix is: https://patchwork.freedesktop.org/series/69386/

Best regards,
James
> > >
> > > Best regards,
> > > Liviu
> > >
> > > > ---
> > > >
> > > > v2: Clean up continuation line warning from checkpatch.
> > > >
> > > > drivers/gpu/drm/arm/display/komeda/komeda_dev.h | 2 ++
> > > > drivers/gpu/drm/arm/display/komeda/komeda_event.c | 2 +-
> > > > 2 files changed, 3 insertions(+), 1 deletion(-)
> > > >
> > > > diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h b/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
> > > > index d9fc9c48859a..15f52e304c08 100644
> > > > --- a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
> > > > +++ b/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
> > > > @@ -224,6 +224,8 @@ struct komeda_dev {
> > > > #define KOMEDA_DEV_PRINT_INFO_EVENTS BIT(2)
> > > > /* Dump DRM state on an error or warning event. */
> > > > #define KOMEDA_DEV_PRINT_DUMP_STATE_ON_EVENT BIT(8)
> > > > + /* Disable rate limiting of event prints (normally one per commit) */
> > > > +#define KOMEDA_DEV_PRINT_DISABLE_RATELIMIT BIT(12)
> > > > };
> > > >
> > > > static inline bool
> > > > diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_event.c b/drivers/gpu/drm/arm/display/komeda/komeda_event.c
> > > > index 7fd624761a2b..bf269683f811 100644
> > > > --- a/drivers/gpu/drm/arm/display/komeda/komeda_event.c
> > > > +++ b/drivers/gpu/drm/arm/display/komeda/komeda_event.c
> > > > @@ -119,7 +119,7 @@ void komeda_print_events(struct komeda_events *evts, struct drm_device *dev)
> > > > /* reduce the same msg print, only print the first evt for one frame */
> > > > if (evts->global || is_new_frame(evts))
> > > > en_print = true;
> > > > - if (!en_print)
> > > > + if (!(err_verbosity & KOMEDA_DEV_PRINT_DISABLE_RATELIMIT) && !en_print)
> > > > return;
> > > >
> > > > if (err_verbosity & KOMEDA_DEV_PRINT_ERR_EVENTS)
> > > > --
> > > > 2.23.0
> > > >
> > >
> > > --
> > > ====================
> > > | I would like to |
> > > | fix the world, |
> > > | but they're not |
> > > | giving me the |
> > > \ source code! /
> > > ---------------
> > > ¯\_(ツ)_/¯
> > >
> >
> >
> > --
> > Mihail
> >
> >
> >
>
>
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> +41 (0) 79 365 57 48 - http://blog.ffwll.ch

2019-11-13 13:45:46

by Mihail Atanassov

[permalink] [raw]
Subject: Re: [PATCH v2 5/5] drm/komeda: add rate limiting disable to err_verbosity

On Tuesday, 12 November 2019 18:24:16 GMT Daniel Vetter wrote:
> On Tue, Nov 12, 2019 at 2:00 PM Mihail Atanassov
> <[email protected]> wrote:
> >
> > On Monday, 11 November 2019 15:53:14 GMT Liviu Dudau wrote:
> > > On Thu, Nov 07, 2019 at 11:42:44AM +0000, Mihail Atanassov wrote:
> > > > It's possible to get multiple events in a single frame/flip, so add an
> > > > option to print them all.
> > > >
> > > > Reviewed-by: James Qian Wang (Arm Technology China) <[email protected]>
> > > > Signed-off-by: Mihail Atanassov <[email protected]>
> > >
> > > For the whole series:
> > >
> > > Acked-by: Liviu Dudau <[email protected]>
> >
> > Thanks, applied to drm-misc-next.
>
> And now komeda doesn't even compile anymore. I'm ... impressed.
>

Mea culpa! Sorry about the breakage, I did build-test but apparently
not the right checkout :/. I'll adjust my workflow to make sure this
doesn't happen again.

> I mean generally people break other people's driver, not their own.
> -Daniel
>
> > >
> > > Best regards,
> > > Liviu
> > >
> > > > ---
> > > >
> > > > v2: Clean up continuation line warning from checkpatch.
> > > >
> > > > drivers/gpu/drm/arm/display/komeda/komeda_dev.h | 2 ++
> > > > drivers/gpu/drm/arm/display/komeda/komeda_event.c | 2 +-
> > > > 2 files changed, 3 insertions(+), 1 deletion(-)
> > > >
> > > > diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h b/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
> > > > index d9fc9c48859a..15f52e304c08 100644
> > > > --- a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
> > > > +++ b/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
> > > > @@ -224,6 +224,8 @@ struct komeda_dev {
> > > > #define KOMEDA_DEV_PRINT_INFO_EVENTS BIT(2)
> > > > /* Dump DRM state on an error or warning event. */
> > > > #define KOMEDA_DEV_PRINT_DUMP_STATE_ON_EVENT BIT(8)
> > > > + /* Disable rate limiting of event prints (normally one per commit) */
> > > > +#define KOMEDA_DEV_PRINT_DISABLE_RATELIMIT BIT(12)
> > > > };
> > > >
> > > > static inline bool
> > > > diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_event.c b/drivers/gpu/drm/arm/display/komeda/komeda_event.c
> > > > index 7fd624761a2b..bf269683f811 100644
> > > > --- a/drivers/gpu/drm/arm/display/komeda/komeda_event.c
> > > > +++ b/drivers/gpu/drm/arm/display/komeda/komeda_event.c
> > > > @@ -119,7 +119,7 @@ void komeda_print_events(struct komeda_events *evts, struct drm_device *dev)
> > > > /* reduce the same msg print, only print the first evt for one frame */
> > > > if (evts->global || is_new_frame(evts))
> > > > en_print = true;
> > > > - if (!en_print)
> > > > + if (!(err_verbosity & KOMEDA_DEV_PRINT_DISABLE_RATELIMIT) && !en_print)
> > > > return;
> > > >
> > > > if (err_verbosity & KOMEDA_DEV_PRINT_ERR_EVENTS)
> > > > --
> > > > 2.23.0
> > > >
> > >
> > > --
> > > ====================
> > > | I would like to |
> > > | fix the world, |
> > > | but they're not |
> > > | giving me the |
> > > \ source code! /
> > > ---------------
> > > ¯\_(ツ)_/¯
> > >
> >
> >
> > --
> > Mihail
> >
> >
> >
>
>
>


--
Mihail