From: Roderick Colenbrander <thunderbird2k@gmail.com>
To: Mauricio Faria de Oliveira <mfo@igalia.com>
Cc: Roderick Colenbrander <roderick.colenbrander@sony.com>,
Jiri Kosina <jikos@kernel.org>,
Benjamin Tissoires <bentiss@kernel.org>,
kernel-dev@igalia.com, linux-input@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] HID: playstation: ratelimit input CRC check failed messages
Date: Mon, 2 Nov 2026 06:18:09 -0800 [thread overview]
Message-ID: <CAEc3jaA_DhowgjeEBJGsUd2-SSWeDkvLbjFJsMeSSWgEqGc04g@mail.gmail.com> (raw)
In-Reply-To: <20261027-hid-playstation-ratelimit-input-crc-error-v1-1-68812542f898@igalia.com>
Hi Mauricio,
This looks reasonable to reduce log spam.
Signed-off-by: roderick.colenbrander@sony.com
Thanks,
Roderick Colenbrander
On Tue, Oct 27, 2026 at 5:36 PM Mauricio Faria de Oliveira
<mfo@igalia.com> wrote:
>
> The kernel log of a Steam Deck was mostly filled with CRC check errors
> from what is apparently a bogus controller, with 8174 messages in <200
> seconds, averaging ~43 messages/second:
>
> $ cat dmesg-pstore.202610250608-0 \
> | grep -c "input CRC's check failed"
> 8174
>
> $ cat dmesg-pstore.202610250608-0 \
> | grep -m1 "input CRC's check failed"
> <3>[ 8.715455] playstation 0005:054C:05C4.0006:
> DualShock4 input CRC's check failed
>
> $ tac dmesg-pstore.202610250608-0 \
> | grep -m1 "input CRC's check failed"
> <3>[ 196.187459] playstation 0005:054C:05C4.0006:
> DualShock4 input CRC's check failed
>
> $ echo $((8174 / (196-8)))
> 43
>
> Let's ratelimit the input CRC check failed messages for the exceptional,
> high-frequency error case, which doesn't impact the occasional, low-freq
> error case (as ratelimiting does not trigger) or the non-error case.
>
> CRC check failed messages for driver-initiated requests are kept as is.
>
> Testing with a UHID driver to synthetically reproduce input CRC check
> errors (generated by an LLM) shows that it reduces the duplicate lines
> and still provides useful information (number of errors/same message).
>
> For example, triggering such error every 25ms (40 times/second), prints
> 10 messages and silently counts another 187 in 5 seconds, ie, 197 / 5 =
> 39.4 times/second (aligned with the synthetic reproducer's rate):
>
> [ 9.554184] playstation ...: Registered DualShock4 controller ...
> [ 10.053936] playstation ...: DualShock4 input CRC's check failed
> [ 10.078162] playstation ...: DualShock4 input CRC's check failed
> [ 10.103447] playstation ...: DualShock4 input CRC's check failed
> [ 10.128739] playstation ...: DualShock4 input CRC's check failed
> [ 10.154016] playstation ...: DualShock4 input CRC's check failed
> [ 10.179198] playstation ...: DualShock4 input CRC's check failed
> [ 10.204474] playstation ...: DualShock4 input CRC's check failed
> [ 10.229762] playstation ...: DualShock4 input CRC's check failed
> [ 10.254904] playstation ...: DualShock4 input CRC's check failed
> [ 10.280441] playstation ...: DualShock4 input CRC's check failed
> [ 15.070695] dualshock4_parse_report: 187 callbacks suppressed
> ...
>
> This reduces the space consumed in the kernel log during 5 seconds from
> ~200 lines to only 11 lines (5.5%).
>
> Signed-off-by: Mauricio Faria de Oliveira <mfo@igalia.com>
> ---
> drivers/hid/hid-playstation.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/hid/hid-playstation.c b/drivers/hid/hid-playstation.c
> index f9dc9378cf777d33aab3cdb87302c6e48f406d2f..b053037a3f0b95b6986c7e53e787e005676ed565 100644
> --- a/drivers/hid/hid-playstation.c
> +++ b/drivers/hid/hid-playstation.c
> @@ -824,6 +824,7 @@ static int ps_get_report(struct hid_device *hdev, u8 report_id, u8 *buf,
> u32 report_crc = get_unaligned_le32(&buf[crc_offset]);
>
> if (!ps_check_crc32(PS_FEATURE_CRC32_SEED, buf, crc_offset, report_crc)) {
> + /* hid_err_ratelimited() not used on driver-initiated requests */
> hid_err(hdev, "CRC check failed for reportID=%d\n", report_id);
> return -EILSEQ;
> }
> @@ -1459,7 +1460,7 @@ static int dualsense_parse_report(struct ps_device *ps_dev, struct hid_report *r
> u32 report_crc = get_unaligned_le32(&data[size - 4]);
>
> if (!ps_check_crc32(PS_INPUT_CRC32_SEED, data, size - 4, report_crc)) {
> - hid_err(hdev, "DualSense input CRC's check failed\n");
> + hid_err_ratelimited(hdev, "DualSense input CRC's check failed\n");
> return -EILSEQ;
> }
>
> @@ -2425,7 +2426,7 @@ static int dualshock4_parse_report(struct ps_device *ps_dev, struct hid_report *
>
> /* Last 4 bytes of input report contains CRC. */
> if (!ps_check_crc32(PS_INPUT_CRC32_SEED, data, size - 4, report_crc)) {
> - hid_err(hdev, "DualShock4 input CRC's check failed\n");
> + hid_err_ratelimited(hdev, "DualShock4 input CRC's check failed\n");
> return -EILSEQ;
> }
>
>
> ---
> base-commit: 83f32c773255720a661aa45d83e36278135f23f5
> change-id: 20261027-hid-playstation-ratelimit-input-crc-error-26f871f1c9d2
>
> Best regards,
> --
> Mauricio Faria de Oliveira <mfo@igalia.com>
>
>
prev parent reply other threads:[~2026-11-02 14:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-28 0:36 Mauricio Faria de Oliveira
2026-11-02 14:18 ` Roderick Colenbrander [this message]
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=CAEc3jaA_DhowgjeEBJGsUd2-SSWeDkvLbjFJsMeSSWgEqGc04g@mail.gmail.com \
--to=thunderbird2k@gmail.com \
--cc=bentiss@kernel.org \
--cc=jikos@kernel.org \
--cc=kernel-dev@igalia.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mfo@igalia.com \
--cc=roderick.colenbrander@sony.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
all inboxes | Powered by JetHome®