From: Sui Chen <suichen@google.com>
To: linux-i2c@vger.kernel.org, openbmc@lists.ozlabs.org,
joel@jms.id.au, andrew@aj.id.au, tali.perry1@gmail.com,
benjaminfair@google.com, krellan@google.com
Cc: Sui Chen <suichen@google.com>
Subject: [RFC Patch v4 0/1] i2c statistics as sysfs attributes
Date: Thu, 31 Mar 2022 17:21:59 -0700 [thread overview]
Message-ID: <20220401002200.27584-1-suichen@google.com> (raw)
This change renames the I2C debug counters as suggested, and moves their
processing into the i2c core:
- bus_errors
- transfers
- nacks
- recovery_successes
- recovery_failures
- timeouts
Did some brief tests with a few test programs that saves/replays I2C
trace by reading hwmon sensors. The test program and hardware run in
QEMU. The test programs are located at
https://gerrit.openbmc-project.xyz/c/openbmc/openbmc-tools/+/52527
(A normal read)
root@gsj:/tmp# cat /sys/class/i2c-adapter/i2c-1/stats/transfers
264
root@gsj:/tmp# ./i2c_bmk_bmc 0
idx=0
Processing 1 inputs
/sys/class/hwmon/hwmon0/temp1_input
(../../devices/platform/ahb/ahb:apb/f0081000.i2c/i2c-1/1-005c/hwmon/hwmon0):
0
[FindTraceEntries] t0=391.000000 t1=393.000000
Found 4 interesting I2C trace entries:
i2c_write: i2c-1 #0 a=05c f=0000 l=1 [00]
i2c_read: i2c-1 #1 a=05c f=0001 l=2
i2c_reply: i2c-1 #1 a=05c f=0001 l=2 [00-00]
i2c_result: i2c-1 n=2 ret=2
root@gsj:/tmp# cat /sys/class/i2c-adapter/i2c-1/stats/transfers
265
(Read from an inexistent address, NACK)
root@gsj:/tmp# cat /sys/class/i2c-adapter/i2c-1/stats/nacks
6
root@gsj:/tmp# cat /sys/class/i2c-adapter/i2c-1/stats/transfers
265
root@gsj:/tmp# cat i2c_trace.txt
i2c_write: i2c-1 #0 a=0ff f=0000 l=1 [00]
i2c_read: i2c-1 #1 a=0ff f=0001 l=2
root@gsj:/tmp# ./i2c_replay_bmc i2c_trace.txt
(program runs and finishes with 6 errors)
root@gsj:/tmp# cat /sys/class/i2c-adapter/i2c-1/stats/nacks
12
root@gsj:/tmp# cat /sys/class/i2c-adapter/i2c-1/stats/transfers
265
The program makes 2 attempts, performing 3 I2C operations at each
attempt, which translates to the 6 nack events.
We will do more testing.
Sui Chen (1):
i2c debug counters as sysfs attributes
drivers/i2c/i2c-core-base.c | 32 ++++++++++++-
drivers/i2c/i2c-dev.c | 94 +++++++++++++++++++++++++++++++++++++
include/linux/i2c.h | 26 ++++++++++
3 files changed, 151 insertions(+), 1 deletion(-)
--
2.35.1.1094.g7c7d902a7c-goog
next reply other threads:[~2022-04-01 0:27 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-01 0:21 Sui Chen [this message]
2022-04-01 0:22 ` [RFC Patch v4 1/1] i2c debug counters as sysfs attributes Sui Chen
2022-04-03 12:12 ` Avi Fishman
2022-04-03 12:12 ` Avi Fishman
2022-04-12 6:57 ` Sui Chen
2022-04-12 6:57 ` Sui Chen
2022-04-12 15:38 ` Avi Fishman
2022-04-12 15:38 ` Avi Fishman
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=20220401002200.27584-1-suichen@google.com \
--to=suichen@google.com \
--cc=andrew@aj.id.au \
--cc=benjaminfair@google.com \
--cc=joel@jms.id.au \
--cc=krellan@google.com \
--cc=linux-i2c@vger.kernel.org \
--cc=openbmc@lists.ozlabs.org \
--cc=tali.perry1@gmail.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.