[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240206184911.248214633@redhat.com>
Date: Tue, 06 Feb 2024 15:49:11 -0300
From: Marcelo Tosatti <mtosatti@...hat.com>
To: linux-kernel@...r.kernel.org
Cc: Daniel Bristot de Oliveira <bristot@...nel.org>,
Juri Lelli <juri.lelli@...hat.com>,
Valentin Schneider <vschneid@...hat.com>,
Frederic Weisbecker <frederic@...nel.org>,
Leonardo Bras <leobras@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Thomas Gleixner <tglx@...utronix.de>
Subject: [patch 00/12] cpu isolation: infra to block interference to select CPUs
There are a number of codepaths in the kernel that interrupt
code execution in remote CPUs. A subset of such codepaths are
triggered from userspace and can therefore return errors.
Introduce a cpumask named "block interference", writable from userspace.
This cpumask (and associated helpers) can be used by code that executes
code on remote CPUs to optionally return an error.
Note: the word "interference" has been chosen since "interruption" is
often confused with "device interrupt".
To protect readers VS writers of this cpumask, SRCU protection is used.
What is proposed is to incrementally modify code that can return errors
in two ways:
1) Introduction of fail variants of the functions that generate
code execution on remote CPUs. This way the modified code should
look like:
idx = block_interf_srcu_read_lock();
ret = smp_call_function_single_fail(cpu, remote_fn, ...); (or stop_machine_fail)
block_interf_srcu_read_unlock(idx);
This is grep friendly (so one can search for smp_call_function_* variants)
and re-uses code.
2) Usage of block interference CPU mask helpers. For certain
users of smp_call_func_*, stop_machine_* functions it
is natural to check for block interference CPUs before
calling the functions for remote code execution.
For example if its not desirable to perform error handling at
smp_call_func_* time, or if performing the error handling requires
unjustified complexity. Then:
idx = block_interf_srcu_read_lock();
if target cpumask intersects with block interference cpumask {
block_interf_read_unlock();
return error
}
..
ret = smp_call_function_single / stop_machine() / ...
..
block_interf_srcu_read_unlock(idx);
Regarding housekeeping flags, it is usually the case that initialization might
require code execution on interference blocked CPUs (for example MTRR
initialization, resctrlfs initialization, MSR writes, ...). Therefore
tagging the CPUs after system initialization is necessary, which
is not possible with current housekeeping flags infrastructure.
This patchset converts a few callers for demonstration purposes.
Sending the second RFC to know whether folks have objections
(there were no objections to the first release), or have
better ideas.
Powered by blists - more mailing lists