From: Punit Agrawal <punitagrawal@gmail.com>
To: jkacur@redhat.com
Cc: linux-rt-users@vger.kernel.org, daniel.sangorrin@toshiba.co.jp,
Punit Agrawal <punit1.agrawal@toshiba.co.jp>,
Suresh Hegde <suresh.c11@toshiba-tsip.com>
Subject: [PATCH v2] rt-tests: hwlatdetect: Gracefully handle lack of /dev/cpu_dma_latency
Date: Tue, 28 Sep 2021 17:59:00 +0900 [thread overview]
Message-ID: <20210928085900.3422085-1-punitagrawal@gmail.com> (raw)
In-Reply-To: <20210928081716.3421463-1-punitagrawal@gmail.com>
From: Punit Agrawal <punit1.agrawal@toshiba.co.jp>
On systems where cpu idle is disabled to reduce latencies,
"/dev/cpu_dma_latency" does not exist and leads to the following
exception report from python when using hwlatdetect.py -
FileNotFoundError: [Errno 2] No such file or directory: '/dev/cpu_dma_latency
Update hwlatdetect to check whether the file exists before attemping
to write values to it.
Reported-by: Suresh Hegde <suresh.c11@toshiba-tsip.com>
Signed-off-by: Punit Agrawal <punit1.agrawal@toshiba.co.jp>
---
v1 -> v2:
* Correct Suresh's email
src/hwlatdetect/hwlatdetect.py | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/hwlatdetect/hwlatdetect.py b/src/hwlatdetect/hwlatdetect.py
index 12228f45f852..89537a6e371f 100755
--- a/src/hwlatdetect/hwlatdetect.py
+++ b/src/hwlatdetect/hwlatdetect.py
@@ -216,8 +216,11 @@ class Detector(object):
# use c_states_on() to close the file descriptor and re-enable c-states
#
def c_states_off(self):
- self.dma_latency_handle = os.open("/dev/cpu_dma_latency", os.O_WRONLY)
- os.write(self.dma_latency_handle, b'\x00\x00\x00\x00')
+ if os.path.exists("/dev/cpu_dma_latency"):
+ self.dma_latency_handle = os.open("/dev/cpu_dma_latency", os.O_WRONLY)
+ os.write(self.dma_latency_handle, b'\x00\x00\x00\x00')
+ else:
+ self.dma_latency_handle = None
debug("c-states disabled")
def c_states_on(self):
--
2.32.0
next prev parent reply other threads:[~2021-09-28 8:59 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-28 8:17 [PATCH] rt-tests: hwlatdetect: Gracefully handle lack of /dev/cpu_dma_latency Punit Agrawal
2021-09-28 8:59 ` Punit Agrawal [this message]
2021-09-28 14:34 ` [PATCH v2] " John Kacur
2021-09-28 22:48 ` Punit Agrawal
2021-09-28 23:25 ` John Kacur
2021-09-29 0:10 ` Punit Agrawal
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=20210928085900.3422085-1-punitagrawal@gmail.com \
--to=punitagrawal@gmail.com \
--cc=daniel.sangorrin@toshiba.co.jp \
--cc=jkacur@redhat.com \
--cc=linux-rt-users@vger.kernel.org \
--cc=punit1.agrawal@toshiba.co.jp \
--cc=suresh.c11@toshiba-tsip.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