dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil@xs4all.nl>
To: linux-media@vger.kernel.org
Cc: Maxime Ripard <maxime.ripard@free-electrons.com>,
	dri-devel@lists.freedesktop.org,
	Hans Verkuil <hans.verkuil@cisco.com>
Subject: [PATCH 01/11] cec: improve transmit timeout logging
Date: Tue, 11 Jul 2017 08:30:34 +0200	[thread overview]
Message-ID: <20170711063044.29849-2-hverkuil@xs4all.nl> (raw)
In-Reply-To: <20170711063044.29849-1-hverkuil@xs4all.nl>

From: Hans Verkuil <hans.verkuil@cisco.com>

Kernel logging messes up the upcoming low-level CEC monitoring support
which is very time-sensitive. So change the debug level of this message
but keep a counter that is shown in the debugfs status log.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
---
 drivers/media/cec/cec-adap.c | 17 +++++++++++++----
 include/media/cec.h          |  2 ++
 2 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/drivers/media/cec/cec-adap.c b/drivers/media/cec/cec-adap.c
index bf45977b2823..644ce82ea2ed 100644
--- a/drivers/media/cec/cec-adap.c
+++ b/drivers/media/cec/cec-adap.c
@@ -394,13 +394,17 @@ int cec_thread_func(void *_adap)
 
 		if (adap->transmitting && timeout) {
 			/*
-			 * If we timeout, then log that. This really shouldn't
-			 * happen and is an indication of a faulty CEC adapter
-			 * driver, or the CEC bus is in some weird state.
+			 * If we timeout, then log that. Normally this does
+			 * not happen and it is an indication of a faulty CEC
+			 * adapter driver, or the CEC bus is in some weird
+			 * state. On rare occasions it can happen if there is
+			 * so much traffic on the bus that the adapter was
+			 * unable to transmit for CEC_XFER_TIMEOUT_MS (2.1s).
 			 */
-			dprintk(0, "%s: message %*ph timed out!\n", __func__,
+			dprintk(1, "%s: message %*ph timed out\n", __func__,
 				adap->transmitting->msg.len,
 				adap->transmitting->msg.msg);
+			adap->tx_timeouts++;
 			/* Just give up on this. */
 			cec_data_cancel(adap->transmitting);
 			goto unlock;
@@ -1941,6 +1945,11 @@ int cec_adap_status(struct seq_file *file, void *priv)
 	if (adap->monitor_all_cnt)
 		seq_printf(file, "file handles in Monitor All mode: %u\n",
 			   adap->monitor_all_cnt);
+	if (adap->tx_timeouts) {
+		seq_printf(file, "transmit timeouts: %u\n",
+			   adap->tx_timeouts);
+		adap->tx_timeouts = 0;
+	}
 	data = adap->transmitting;
 	if (data)
 		seq_printf(file, "transmitting message: %*ph (reply: %02x, timeout: %ums)\n",
diff --git a/include/media/cec.h b/include/media/cec.h
index 56643b27e4b8..e32b0e1a81a4 100644
--- a/include/media/cec.h
+++ b/include/media/cec.h
@@ -174,6 +174,8 @@ struct cec_adapter {
 	bool passthrough;
 	struct cec_log_addrs log_addrs;
 
+	u32 tx_timeouts;
+
 #ifdef CONFIG_CEC_NOTIFIER
 	struct cec_notifier *notifier;
 #endif
-- 
2.11.0

  reply	other threads:[~2017-07-11  6:30 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-11  6:30 [PATCH 00/11] drm/sun4i: add CEC support Hans Verkuil
2017-07-11  6:30 ` Hans Verkuil [this message]
2017-07-11  6:30 ` [PATCH 02/11] cec: add *_ts variants for transmit_done/received_msg Hans Verkuil
2017-07-11  6:30 ` [PATCH 03/11] cec: add adap_free op Hans Verkuil
2017-07-11  6:30 ` [PATCH 04/11] cec-core.rst: document the adap_free callback Hans Verkuil
2017-07-11  6:30 ` [PATCH 05/11] linux/cec.h: add pin monitoring API support Hans Verkuil
2017-07-11  6:30 ` [PATCH 06/11] cec: rework the cec event handling Hans Verkuil
2017-07-11  6:30 ` [PATCH 07/11] cec: document the new CEC pin capability, events and mode Hans Verkuil
2017-07-11  6:30 ` [PATCH 08/11] cec: add core support for low-level CEC pin monitoring Hans Verkuil
2017-07-11  6:30 ` [PATCH 09/11] cec-pin: add low-level pin hardware support Hans Verkuil
2017-07-11  6:30 ` [PATCH 10/11] cec-core.rst: include cec-pin.h and cec-notifier.h Hans Verkuil
2017-07-11  6:30 ` [PATCH 11/11] sun4i_hdmi: add CEC support Hans Verkuil
2017-07-11 20:10 ` [PATCH 00/11] drm/sun4i: " Hans Verkuil
2017-07-11 20:39 ` Maxime Ripard
2017-07-11 21:06   ` Hans Verkuil
2017-07-18 16:29     ` Maxime Ripard
2017-07-19  8:39       ` Hans Verkuil
2017-09-08 10:59       ` Hans Verkuil
2017-09-21 20:37         ` Maxime Ripard
2017-09-21 21:19           ` Hans Verkuil
2017-09-22  6:50             ` Maxime Ripard

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=20170711063044.29849-2-hverkuil@xs4all.nl \
    --to=hverkuil@xs4all.nl \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hans.verkuil@cisco.com \
    --cc=linux-media@vger.kernel.org \
    --cc=maxime.ripard@free-electrons.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).