From: Reinette Chatre <reinette.chatre@intel.com>
To: "Luck, Tony" <tony.luck@intel.com>,
"Wieczor-Retman, Maciej" <maciej.wieczor-retman@intel.com>,
"shuah@kernel.org" <shuah@kernel.org>,
"Yu, Fenghua" <fenghua.yu@intel.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-kselftest@vger.kernel.org"
<linux-kselftest@vger.kernel.org>,
"ilpo.jarvinen@linux.intel.com" <ilpo.jarvinen@linux.intel.com>
Subject: Re: [PATCH v3 2/2] selftests/resctrl: Adjust SNC support messages
Date: Tue, 2 Jul 2024 14:26:25 -0700 [thread overview]
Message-ID: <4fdc8cc0-0b04-4879-9337-9eda3b83f603@intel.com> (raw)
In-Reply-To: <SJ1PR11MB6083D0D8AF9D1A7864084F0EFCD32@SJ1PR11MB6083.namprd11.prod.outlook.com>
Hi Tony,
On 7/1/24 9:04 AM, Luck, Tony wrote:
> +static bool cpus_offline_empty(void)
> +{
> + char offline_cpus_str[64];
> + FILE *fp;
> +
> + fp = fopen("/sys/devices/system/cpu/offline", "r");
>
> Check for fp == NULL before using it.
>
> + if (fscanf(fp, "%s", offline_cpus_str) < 0) {
>
> fscanf() seems like a heavy hammer.
Do you perhaps have any recommendations that should be used instead of
fscanf()? I checked with stat() but could not see a difference between
file with a CPU and a file without. Other alternative is
open()/read()/close()? Looks like when there are no offline CPUs then
the file will only contain '\n' so it may be possible to read one byte
from the file and confirm it is '\n' as a check for "cpus_offline_empty()".
Reinette
next prev parent reply other threads:[~2024-07-02 21:27 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-01 14:17 [PATCH v3 0/2] selftests/resctrl: SNC kernel support discovery Maciej Wieczor-Retman
2024-07-01 14:18 ` [PATCH v3 1/2] selftests/resctrl: Adjust effective L3 cache size with SNC enabled Maciej Wieczor-Retman
2024-07-02 22:20 ` Reinette Chatre
2024-07-03 6:43 ` Maciej Wieczor-Retman
2024-07-01 14:18 ` [PATCH v3 2/2] selftests/resctrl: Adjust SNC support messages Maciej Wieczor-Retman
2024-07-01 16:04 ` Luck, Tony
2024-07-02 21:26 ` Reinette Chatre [this message]
2024-07-02 21:46 ` Tony Luck
2024-07-02 22:01 ` Reinette Chatre
2024-07-02 22:03 ` Luck, Tony
2024-07-03 6:44 ` Maciej Wieczor-Retman
2024-07-03 6:50 ` Maciej Wieczor-Retman
2024-07-02 22:21 ` Reinette Chatre
2024-07-03 7:43 ` Maciej Wieczór-Retman
2024-07-03 20:51 ` Reinette Chatre
2024-07-04 7:23 ` Maciej Wieczor-Retman
2024-07-08 16:39 ` Reinette Chatre
2024-07-09 7:49 ` Maciej Wieczor-Retman
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=4fdc8cc0-0b04-4879-9337-9eda3b83f603@intel.com \
--to=reinette.chatre@intel.com \
--cc=fenghua.yu@intel.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=maciej.wieczor-retman@intel.com \
--cc=shuah@kernel.org \
--cc=tony.luck@intel.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®