[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1d96d1c4-d37e-40b0-b343-b143efd6440f@intel.com>
Date: Wed, 13 Dec 2023 13:56:45 -0800
From: Reinette Chatre <reinette.chatre@...el.com>
To: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>,
<linux-kselftest@...r.kernel.org>, Shuah Khan <shuah@...nel.org>,
"Shaopeng Tan" <tan.shaopeng@...fujitsu.com>,
Maciej Wieczór-Retman
<maciej.wieczor-retman@...el.com>,
Fenghua Yu <fenghua.yu@...el.com>
CC: <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v3 20/29] selftests/resctrl: Replace file write with
volatile variable
Hi Ilpo,
On 12/11/2023 4:18 AM, Ilpo Järvinen wrote:
> The fill_buf code prevents compiler optimizating the entire read loop
> away by writing the final value of the variable into a file. While it
> achieves the goal, writing into a file requires significant amount of
> work within the innermost test loop and also error handling.
>
> A simpler approach is to take advantage of volatile. Writing through
> a pointer to a volatile variable is enough to prevent compiler from
> optimizing the write away, and therefore compiler cannot remove the
> read loop either.
>
> Add a volatile 'value_sink' into resctrl_tests.c and make fill_buf to
> write into it. As a result, the error handling in fill_buf.c can be
> simplified.
>
> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
> ---
Reviewed-by: Reinette Chatre <reinette.chatre@...el.com>
Reinette
Powered by blists - more mailing lists