From: Yury Norov <ynorov@caviumnetworks.com>
To: Chris Metcalf <cmetcalf@mellanox.com>
Cc: Steven Rostedt <rostedt@goodmis.org>,
Ingo Molnar <mingo@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Andrew Morton <akpm@linux-foundation.org>,
Rik van Riel <riel@redhat.com>, Tejun Heo <tj@kernel.org>,
Frederic Weisbecker <fweisbec@gmail.com>,
Thomas Gleixner <tglx@linutronix.de>,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
Christoph Lameter <cl@linux.com>,
Viresh Kumar <viresh.kumar@linaro.org>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will.deacon@arm.com>,
Andy Lutomirski <luto@amacapital.net>,
Daniel Lezcano <daniel.lezcano@linaro.org>,
Francis Giraldeau <francis.giraldeau@gmail.com>,
Sunil Goutham <sgoutham@cavium.com>,
linux-mm@vger.kernel.org, linux-doc@vger.kernel.org,
linux-api@vger.kernel.org, linux-kernel@vger.k
Subject: Re: [PATCH v16 00/13] support "task_isolation" mode
Date: Thu, 12 Jul 2018 15:29:01 +0300 [thread overview]
Message-ID: <20180712122901.GA5049@yury-thinkpad> (raw)
In-Reply-To: <1509728692-10460-1-git-send-email-cmetcalf@mellanox.com>
On Fri, Nov 03, 2017 at 01:04:39PM -0400, Chris Metcalf wrote:
> Here, finally, is a new spin of the task isolation work (v16), with
> changes based on the issues that were raised at last year's Linux
> Plumbers Conference and in the email discussion that followed.
Hi Chris,
There's another possible way to break task isolation, by net subsystem.
See patch below.
Yury
>From 8025e9330bf06ce146d4ba96833aad6eafe24759 Mon Sep 17 00:00:00 2001
From: Yury Norov <ynorov@caviumnetworks.com>
Date: Sun, 8 Jul 2018 00:40:46 +0300
Subject: [PATCH] net: don't let user assign task isolation CPUs for RPS
Receive Packet Steering (RPS) subsystem distributes network traffic
handling to CPUs defined by user in
/sys/class/net/<dev>/queues/rx-<n>/rps_cpus.
If rps_cpus intersects with task_isolation_map, RPS may break task
isolation by assigning RPS work to CPU that runs isolated task.
In this patch user-provided rps_cpus map filtered to avoid that.
Signed-off-by: Yury Norov <ynorov@caviumnetworks.com>
---
include/linux/isolation.h | 2 ++
net/core/net-sysfs.c | 13 +++++++++++++
2 files changed, 15 insertions(+)
diff --git a/include/linux/isolation.h b/include/linux/isolation.h
index f467545ad37d..b7f0a9085b13 100644
--- a/include/linux/isolation.h
+++ b/include/linux/isolation.h
@@ -14,6 +14,8 @@ struct task_struct;
#ifdef CONFIG_TASK_ISOLATION
+extern cpumask_var_t task_isolation_map;
+
/**
* task_isolation_request() - prctl hook to request task isolation
* @flags: Flags from <linux/prctl.h> PR_TASK_ISOLATION_xxx.
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index 927a6dcbad96..18e576893984 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -11,6 +11,7 @@
#include <linux/capability.h>
#include <linux/kernel.h>
+#include <linux/isolation.h>
#include <linux/netdevice.h>
#include <net/switchdev.h>
#include <linux/if_arp.h>
@@ -727,6 +728,18 @@ static ssize_t store_rps_map(struct netdev_rx_queue *queue,
return err;
}
+#ifdef CONFIG_TASK_ISOLATION
+ if (cpumask_intersects(mask, task_isolation_map)) {
+ char tmp[256];
+
+ pr_warn("RPS is not allowed on CPUs allocated for isolated tasks\n");
+
+ cpumask_andnot(mask, mask, task_isolation_map);
+ cpumap_print_to_pagebuf(1, tmp, mask);
+ pr_warn("RPS CPUs list is reduced to: %s\n", tmp);
+ }
+#endif
+
map = kzalloc(max_t(unsigned int,
RPS_MAP_SIZE(cpumask_weight(mask)), L1_CACHE_BYTES),
GFP_KERNEL);
--
2.17.1
prev parent reply other threads:[~2018-07-12 12:29 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-03 17:04 [PATCH v16 00/13] support "task_isolation" mode Chris Metcalf
2017-11-03 17:04 ` [PATCH v16 06/13] task_isolation: userspace hard isolation from kernel Chris Metcalf
2018-03-18 14:22 ` Yury Norov
[not found] ` <1509728692-10460-1-git-send-email-cmetcalf-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2017-11-06 15:38 ` [PATCH v16 00/13] support "task_isolation" mode Christopher Lameter
[not found] ` <bd5526d4-7b6e-3b3d-79d0-5d6567c0bdf8@mellanox.com>
2017-11-07 17:10 ` Christopher Lameter
2017-11-07 17:27 ` Chris Metcalf
2017-11-07 17:54 ` Christopher Lameter
2018-03-07 10:07 ` Yury Norov
2018-07-12 12:29 ` Yury Norov [this message]
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=20180712122901.GA5049@yury-thinkpad \
--to=ynorov@caviumnetworks.com \
--cc=akpm@linux-foundation.org \
--cc=catalin.marinas@arm.com \
--cc=cl@linux.com \
--cc=cmetcalf@mellanox.com \
--cc=daniel.lezcano@linaro.org \
--cc=francis.giraldeau@gmail.com \
--cc=fweisbec@gmail.com \
--cc=linux-api@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.k \
--cc=linux-mm@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=mingo@kernel.org \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
--cc=riel@redhat.com \
--cc=rostedt@goodmis.org \
--cc=sgoutham@cavium.com \
--cc=tglx@linutronix.de \
--cc=tj@kernel.org \
--cc=viresh.kumar@linaro.org \
--cc=will.deacon@arm.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