From: Chris Metcalf <cmetcalf@mellanox.com>
To: 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>,
linux-kernel@vger.kernel.org
Cc: Chris Metcalf <cmetcalf@mellanox.com>
Subject: [PATCH v16 07/13] Add task isolation hooks to arch-independent code
Date: Fri, 3 Nov 2017 13:04:46 -0400 [thread overview]
Message-ID: <1509728692-10460-8-git-send-email-cmetcalf@mellanox.com> (raw)
In-Reply-To: <1509728692-10460-1-git-send-email-cmetcalf@mellanox.com>
This commit adds task isolation hooks as follows:
- __handle_domain_irq() generates an isolation warning for the
local task
- irq_work_queue_on() generates an isolation warning for the remote
task being interrupted for irq_work
- generic_exec_single() generates a remote isolation warning for
the remote cpu being IPI'd
- smp_call_function_many() generates a remote isolation warning for
the set of remote cpus being IPI'd
Calls to task_isolation_remote() or task_isolation_interrupt() can
be placed in the platform-independent code like this when doing so
results in fewer lines of code changes, as for example is true of
the users of the arch_send_call_function_*() APIs. Or, they can
be placed in the per-architecture code when there are many callers,
as for example is true of the smp_send_reschedule() call.
A further cleanup might be to create an intermediate layer, so that
for example smp_send_reschedule() is a single generic function that
just calls arch_smp_send_reschedule(), allowing generic code to be
called every time smp_send_reschedule() is invoked. But for now,
we just update either callers or callees as makes most sense.
Signed-off-by: Chris Metcalf <cmetcalf@mellanox.com>
---
kernel/irq/irqdesc.c | 5 +++++
kernel/irq_work.c | 5 ++++-
kernel/smp.c | 6 +++++-
3 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c
index 82afb7ed369f..1b114c6b7ab8 100644
--- a/kernel/irq/irqdesc.c
+++ b/kernel/irq/irqdesc.c
@@ -16,6 +16,7 @@
#include <linux/bitmap.h>
#include <linux/irqdomain.h>
#include <linux/sysfs.h>
+#include <linux/isolation.h>
#include "internals.h"
@@ -633,6 +634,10 @@ int __handle_domain_irq(struct irq_domain *domain, unsigned int hwirq,
irq = irq_find_mapping(domain, hwirq);
#endif
+ task_isolation_interrupt((irq == hwirq) ?
+ "irq %d (%s)" : "irq %d (%s hwirq %d)",
+ irq, domain ? domain->name : "", hwirq);
+
/*
* Some hardware gives randomly wrong interrupts. Rather
* than crashing, do something sensible.
diff --git a/kernel/irq_work.c b/kernel/irq_work.c
index bcf107ce0854..cde49f1f31f7 100644
--- a/kernel/irq_work.c
+++ b/kernel/irq_work.c
@@ -17,6 +17,7 @@
#include <linux/cpu.h>
#include <linux/notifier.h>
#include <linux/smp.h>
+#include <linux/isolation.h>
#include <asm/processor.h>
@@ -75,8 +76,10 @@ bool irq_work_queue_on(struct irq_work *work, int cpu)
if (!irq_work_claim(work))
return false;
- if (llist_add(&work->llnode, &per_cpu(raised_list, cpu)))
+ if (llist_add(&work->llnode, &per_cpu(raised_list, cpu))) {
+ task_isolation_remote(cpu, "irq_work");
arch_send_call_function_single_ipi(cpu);
+ }
return true;
}
diff --git a/kernel/smp.c b/kernel/smp.c
index c94dd85c8d41..44252aa650ac 100644
--- a/kernel/smp.c
+++ b/kernel/smp.c
@@ -19,6 +19,7 @@
#include <linux/sched.h>
#include <linux/sched/idle.h>
#include <linux/hypervisor.h>
+#include <linux/isolation.h>
#include "smpboot.h"
@@ -175,8 +176,10 @@ static int generic_exec_single(int cpu, call_single_data_t *csd,
* locking and barrier primitives. Generic code isn't really
* equipped to do the right thing...
*/
- if (llist_add(&csd->llist, &per_cpu(call_single_queue, cpu)))
+ if (llist_add(&csd->llist, &per_cpu(call_single_queue, cpu))) {
+ task_isolation_remote(cpu, "IPI function");
arch_send_call_function_single_ipi(cpu);
+ }
return 0;
}
@@ -458,6 +461,7 @@ void smp_call_function_many(const struct cpumask *mask,
}
/* Send a message to all CPUs in the map */
+ task_isolation_remote_cpumask(cfd->cpumask_ipi, "IPI function");
arch_send_call_function_ipi_mask(cfd->cpumask_ipi);
if (wait) {
--
2.1.2
next prev parent reply other threads:[~2017-11-03 17:08 UTC|newest]
Thread overview: 29+ 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 01/13] vmstat: add quiet_vmstat_sync function Chris Metcalf
2017-11-03 17:04 ` [PATCH v16 02/13] vmstat: add vmstat_idle function Chris Metcalf
2017-11-03 17:04 ` [PATCH v16 03/13] Revert "sched/core: Drop the unused try_get_task_struct() helper function" Chris Metcalf
2017-11-03 17:04 ` [PATCH v16 04/13] Add try_get_task_struct_on_cpu() to scheduler for task isolation Chris Metcalf
2017-11-03 17:04 ` [PATCH v16 05/13] Add try_stop_full_tick() API for NO_HZ_FULL 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
2017-11-03 17:04 ` Chris Metcalf [this message]
2017-11-03 17:04 ` [PATCH v16 08/13] arch/x86: enable task isolation functionality Chris Metcalf
2017-11-03 17:04 ` [PATCH v16 09/13] arch/arm64: " Chris Metcalf
2017-11-03 17:32 ` Mark Rutland
2017-11-03 17:53 ` Chris Metcalf
2017-11-03 17:04 ` [PATCH v16 10/13] arch/arm: " Chris Metcalf
2017-11-03 17:23 ` Russell King - ARM Linux
2017-11-03 17:27 ` Chris Metcalf
2017-11-06 22:53 ` Chris Metcalf
2018-03-18 14:48 ` Yury Norov
2017-11-03 17:04 ` [PATCH v16 11/13] arch/tile: " Chris Metcalf
2017-11-03 17:04 ` [PATCH v16 12/13] arm, tile: turn off timer tick for oneshot_stopped state Chris Metcalf
2017-11-03 17:18 ` Mark Rutland
2017-11-03 17:36 ` Chris Metcalf
2017-11-03 17:04 ` [PATCH v16 13/13] task_isolation self test Chris Metcalf
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
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=1509728692-10460-8-git-send-email-cmetcalf@mellanox.com \
--to=cmetcalf@mellanox.com \
--cc=akpm@linux-foundation.org \
--cc=catalin.marinas@arm.com \
--cc=cl@linux.com \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@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=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
all inboxes | Powered by JetHome®