From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Reinette Chatre <reinette.chatre@intel.com>
Cc: fenghua.yu@intel.com, shuah@kernel.org, tony.luck@intel.com,
peternewman@google.com, babu.moger@amd.com,
"Maciej Wieczór-Retman" <maciej.wieczor-retman@intel.com>,
linux-kselftest@vger.kernel.org,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/6] selftests/resctrl: Ensure measurements skip initialization of default benchmark
Date: Wed, 4 Sep 2024 14:57:14 +0300 (EEST) [thread overview]
Message-ID: <85a11091-3c61-2d8b-28d4-2a251f3b8ffe@linux.intel.com> (raw)
In-Reply-To: <0ae6d28f-0646-48b2-a4e7-17e2d14f6dd5@intel.com>
[-- Attachment #1: Type: text/plain, Size: 4331 bytes --]
On Fri, 30 Aug 2024, Reinette Chatre wrote:
>
> Thank you for taking a look.
>
> On 8/30/24 3:56 AM, Ilpo Järvinen wrote:
> > On Thu, 29 Aug 2024, Reinette Chatre wrote:
> >
>
> ...
>
> > > @@ -684,11 +622,13 @@ int resctrl_val(const struct resctrl_test *test,
> > > const char * const *benchmark_cmd,
> > > struct resctrl_val_param *param)
> > > {
> > > - struct sigaction sigact;
> > > - int ret = 0, pipefd[2];
> > > - char pipe_message = 0;
> > > - union sigval value;
> > > - int domain_id;
> > > + int domain_id, operation = 0, memflush = 1;
> > > + size_t span = DEFAULT_SPAN;
> > > + unsigned char *buf = NULL;
> > > + cpu_set_t old_affinity;
> > > + bool once = false;
> > > + int ret = 0;
> > > + pid_t ppid;
> > > if (strcmp(param->filename, "") == 0)
> > > sprintf(param->filename, "stdio");
> > > @@ -699,111 +639,80 @@ int resctrl_val(const struct resctrl_test *test,
> > > return ret;
> > > }
> > > - /*
> > > - * If benchmark wasn't successfully started by child, then child
> > > should
> > > - * kill parent, so save parent's pid
> > > - */
> > > ppid = getpid();
> > > - if (pipe(pipefd)) {
> > > - ksft_perror("Unable to create pipe");
> > > + /* Taskset test to specified CPU. */
> > > + ret = taskset_benchmark(ppid, uparams->cpu, &old_affinity);
> >
> > Previously only CPU affinity for bm_pid was set but now it's set before
> > fork(). Quickly checking the Internet, it seems that CPU affinity gets
> > inherited on fork() so now both processes will have the same affinity
> > which might make the other process to interfere with the measurement.
>
> Setting the affinity is intended to ensure that the buffer preparation
> occurs in the same topology as where the runtime portion will run.
> This preparation is done before the work to be measured starts.
>
> This does tie in with the association with the resctrl group and I
> will elaborate more below ...
Okay, that's useful to retain but thinking this further, now we're also
going do non-trivial amount of work in between the setup and the test by
forking. I guess that doesn't matter for memflush = true case but might be
meaningful for the memflush = false case that seems to be there to allow
keeping caches hot (I personally haven't thought how to use "caches hot"
test but we do have that capability by the fact that memflush paremeter
exists).
> > > + if (ret)
> > > + return ret;
> > > - return -1;
> > > + /* Write test to specified control & monitoring group in resctrl FS.
> > > */
> > > + ret = write_bm_pid_to_resctrl(ppid, param->ctrlgrp, param->mongrp);
> >
> > Previously, this was done for bm_pid but now it's done for the parent. I'm
> > not sure how inheritance goes with resctrl on fork(), will the forked PID
> > get added to the list of PIDs or not? You probably know the answer :-).
>
> Yes. A process fork()ed will land in the same resctrl group as its parent.
>
> > Neither behavior, however, seems to result in the intended behavior as we
> > either get interfering processes (if inherited) or no desired resctrl
> > setup for the benchmark process.
>
> There are two processes to consider in the resource group, the parent (that
> sets up the buffer and does the measurements) and the child (that runs the
> workload to be measured). Thanks to your commit da50de0a92f3
> ("selftests/resctrl:
> Calculate resctrl FS derived mem bw over sleep(1) only") the parent
> will be sleeping while the child runs its workload and there is no
> other interference I am aware of. The only additional measurements
> that I can see would be the work needed to actually start and stop the
> measurements and from what I can tell this falls into the noise.
>
> Please do keep in mind that the performance counters used, iMC, cannot
> actually
> be bound to a single CPU since it is a per-socket PMU. The measurements have
> thus never been as fine grained as the code pretends it to be.
I was thinking if I should note the amount of work is small. Maybe it's
fine to leave that noise there and I'm just overly cautious :-), when I
used to do networking research in the past life, I wanted to eliminate as
much noise sources so I guess it comes from that background.
--
i.
next prev parent reply other threads:[~2024-09-04 11:57 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-29 22:52 [PATCH 0/6] selftests/resctrl: Support diverse platforms with MBM and MBA tests Reinette Chatre
2024-08-29 22:52 ` [PATCH 1/6] selftests/resctrl: Fix sparse warnings Reinette Chatre
2024-08-30 10:29 ` Ilpo Järvinen
2024-08-29 22:52 ` [PATCH 2/6] selftests/resctrl: Ensure measurements skip initialization of default benchmark Reinette Chatre
2024-08-30 10:56 ` Ilpo Järvinen
2024-08-30 16:00 ` Reinette Chatre
2024-09-04 11:57 ` Ilpo Järvinen [this message]
2024-09-04 21:15 ` Reinette Chatre
2024-09-05 12:10 ` Ilpo Järvinen
2024-09-05 18:08 ` Reinette Chatre
2024-09-06 10:00 ` Ilpo Järvinen
2024-09-07 0:05 ` Reinette Chatre
2024-09-09 12:52 ` Ilpo Järvinen
2024-08-29 22:52 ` [PATCH 3/6] selftests/resctrl: Simplify benchmark parameter passing Reinette Chatre
2024-08-30 11:13 ` Ilpo Järvinen
2024-08-30 16:01 ` Reinette Chatre
2024-08-29 22:52 ` [PATCH 4/6] selftests/resctrl: Use cache size to determine "fill_buf" buffer size Reinette Chatre
2024-08-30 11:25 ` Ilpo Järvinen
2024-08-30 16:00 ` Reinette Chatre
2024-08-29 22:52 ` [PATCH 5/6] selftests/resctrl: Do not compare performance counters and resctrl at low bandwidth Reinette Chatre
2024-08-30 11:42 ` Ilpo Järvinen
2024-08-30 16:00 ` Reinette Chatre
2024-09-04 11:43 ` Ilpo Järvinen
2024-09-04 21:15 ` Reinette Chatre
2024-09-05 11:45 ` Ilpo Järvinen
2024-09-05 18:08 ` Reinette Chatre
2024-09-06 8:44 ` Ilpo Järvinen
2024-09-07 0:05 ` Reinette Chatre
2024-09-09 8:13 ` Ilpo Järvinen
2024-08-29 22:52 ` [PATCH 6/6] selftests/resctrl: Keep results from first test run Reinette Chatre
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=85a11091-3c61-2d8b-28d4-2a251f3b8ffe@linux.intel.com \
--to=ilpo.jarvinen@linux.intel.com \
--cc=babu.moger@amd.com \
--cc=fenghua.yu@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=maciej.wieczor-retman@intel.com \
--cc=peternewman@google.com \
--cc=reinette.chatre@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