Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1157785

[PATCH v3 3/5] nohz: cpu_isolated strict mode configurable signal

Path csiph.com!aioe.org!news.servidellagleba.it!bofh.it!news.nic.it!robomod
From Chris Metcalf <cmetcalf@ezchip.com>
Newsgroups linux.kernel
Subject [PATCH v3 3/5] nohz: cpu_isolated strict mode configurable signal
Date Wed, 03 Jun 2015 17:40:03 +0200
Message-ID <pxiVR-5gl-25@gated-at.bofh.it> (permalink)
References <pxiVQ-5gl-3@gated-at.bofh.it>
X-Original-To Gilad Ben Yossef <giladb@ezchip.com>, 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>, <linux-doc@vger.kernel.org>, <linux-api@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Authentication-Results spf=fail (sender IP is 12.216.194.146) smtp.mailfrom=ezchip.com; ezchip.com; dkim=none (message not signed) header.d=none;
Received-Spf Fail (protection.outlook.com: domain of ezchip.com does not designate 12.216.194.146 as permitted sender) receiver=protection.outlook.com; client-ip=12.216.194.146; helo=ld-1.internal.tilera.com;
X-Mailer git-send-email 2.1.2
X-Microsoft-Exchange-Diagnostics 1;DB3FFO11FD050;1:/IDIzVZYfajJJn+M5xRGh7SPk2k/0scHYzqeChigQcfgrlzEOsxCfle5XQfFsapZ/6u7kkx5AdcXPvXNPT9Gn3ZcdCv9FrirglgA3ysHTIKJdM1w7p8Jk73GkkmzB/cCCvYSsOaf9Tl/KIItGmDzEtV1jW7yVZWWKOmjoScNgfflK+Ifm/bg3U2LBvtk5Fczd7N7iA+mRGkHcNu+j3x9zfehBbP2yv3B66oZ6wYHwpsMLORoGGRmRpf0iDjcAKamBiF4KOMrsCBsbBOatmNrn2zZMCVzLqh0Om861czC0t0=
X-Forefront-Antispam-Report CIP:12.216.194.146;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10009020)(6009001)(339900001)(199003)(189002)(4001540100001)(105606002)(48376002)(2950100001)(5001770100001)(64706001)(5001960100002)(77156002)(97736004)(62966003)(229853001)(189998001)(87936001)(19580405001)(106466001)(50986999)(81156007)(2201001)(46102003)(104016003)(107886002)(33646002)(76176999)(42186005)(50226001)(92566002)(86362001)(36756003)(5001830100001)(50466002)(5001860100001)(85426001)(575784001)(106356001)(6806004)(19580395003)(47776003)(106476002)(68736005)(9376004)(921003)(1121003)(4001430100001);DIR:OUT;SFP:1101;SCL:1;SRVR:AM2PR02MB0772;H:ld-1.internal.tilera.com;FPR:;SPF:Fail;PTR:InfoNoRecords;A:1;MX:1;LANG:en;
MIME-Version 1.0
Content-Type text/plain
X-Microsoft-Antispam UriScan:;BCL:0;PCL:0;RULEID:;SRVR:AM2PR02MB0772;
X-Microsoft-Antispam-Prvs <AM2PR02MB07728395017C7CC36D272F31AFB40@AM2PR02MB0772.eurprd02.prod.outlook.com>
X-Exchange-Antispam-Report-Test UriScan:;
X-Exchange-Antispam-Report-Cfa-Test BCL:0;PCL:0;RULEID:(601004)(5005006)(520003)(3002001);SRVR:AM2PR02MB0772;BCL:0;PCL:0;RULEID:;SRVR:AM2PR02MB0772;
X-Forefront-Prvs 05961EBAFC
X-Originatororg ezchip.com
X-Ms-Exchange-Crosstenant-Originalarrivaltime 03 Jun 2015 15:29:52.4646 (UTC)
X-Ms-Exchange-Crosstenant-ID 0fc16e0a-3cd3-4092-8b2f-0a42cff122c3
X-Ms-Exchange-Crosstenant-Originalattributedtenantconnectingip TenantId=0fc16e0a-3cd3-4092-8b2f-0a42cff122c3;Ip=[12.216.194.146];Helo=[ld-1.internal.tilera.com]
X-Ms-Exchange-Crosstenant-Fromentityheader HybridOnPrem
X-Ms-Exchange-Transport-Crosstenantheadersstamped AM2PR02MB0772
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 77
Organization linux.* mail to news gateway
X-Original-Cc Chris Metcalf <cmetcalf@ezchip.com>
X-Original-Date Wed, 3 Jun 2015 11:29:23 -0400
X-Original-Message-ID <1433345365-29506-4-git-send-email-cmetcalf@ezchip.com>
X-Original-References <1433345365-29506-1-git-send-email-cmetcalf@ezchip.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref aioe.org linux.kernel:1157785

Show key headers only | View raw


Allow userspace to override the default SIGKILL delivered
when a cpu_isolated process in STRICT mode does a syscall
or otherwise synchronously enters the kernel.

In addition to being able to set the signal, we now also
pass whether or not the interruption was from a syscall in
the si_code field of the siginfo.

Signed-off-by: Chris Metcalf <cmetcalf@ezchip.com>
---
 include/uapi/linux/prctl.h |  2 ++
 kernel/time/tick-sched.c   | 15 +++++++++++----
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/include/uapi/linux/prctl.h b/include/uapi/linux/prctl.h
index 0c11238a84fb..ab45bd3d5799 100644
--- a/include/uapi/linux/prctl.h
+++ b/include/uapi/linux/prctl.h
@@ -195,5 +195,7 @@ struct prctl_mm_map {
 #define PR_GET_CPU_ISOLATED	48
 # define PR_CPU_ISOLATED_ENABLE	(1 << 0)
 # define PR_CPU_ISOLATED_STRICT	(1 << 1)
+# define PR_CPU_ISOLATED_SET_SIG(sig)  (((sig) & 0x7f) << 8)
+# define PR_CPU_ISOLATED_GET_SIG(bits) (((bits) >> 8) & 0x7f)
 
 #endif /* _LINUX_PRCTL_H */
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index ce3bcf29a0f6..f09c003da22f 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -447,11 +447,18 @@ void tick_nohz_cpu_isolated_enter(void)
 	}
 }
 
-static void kill_cpu_isolated_strict_task(void)
+static void kill_cpu_isolated_strict_task(int is_syscall)
 {
+	siginfo_t info = {};
+	int sig;
+
 	dump_stack();
 	current->cpu_isolated_flags &= ~PR_CPU_ISOLATED_ENABLE;
-	send_sig(SIGKILL, current, 1);
+
+	sig = PR_CPU_ISOLATED_GET_SIG(current->cpu_isolated_flags) ?: SIGKILL;
+	info.si_signo = sig;
+	info.si_code = is_syscall;
+	send_sig_info(sig, &info, current);
 }
 
 /*
@@ -470,7 +477,7 @@ void tick_nohz_cpu_isolated_syscall(int syscall)
 
 	pr_warn("%s/%d: cpu_isolated strict mode violated by syscall %d\n",
 		current->comm, current->pid, syscall);
-	kill_cpu_isolated_strict_task();
+	kill_cpu_isolated_strict_task(1);
 }
 
 /*
@@ -481,7 +488,7 @@ void tick_nohz_cpu_isolated_exception(void)
 {
 	pr_warn("%s/%d: cpu_isolated strict mode violated by exception\n",
 		current->comm, current->pid);
-	kill_cpu_isolated_strict_task();
+	kill_cpu_isolated_strict_task(0);
 }
 
 #endif
-- 
2.1.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v3 0/5] support "cpu_isolated" mode for nohz_full Chris Metcalf <cmetcalf@ezchip.com> - 2015-06-03 17:40 +0200
  [PATCH v3 4/5] nohz: add cpu_isolated_debug boot flag Chris Metcalf <cmetcalf@ezchip.com> - 2015-06-03 17:40 +0200
  [PATCH v3 3/5] nohz: cpu_isolated strict mode configurable signal Chris Metcalf <cmetcalf@ezchip.com> - 2015-06-03 17:40 +0200
  [PATCH v3 2/5] nohz: support PR_CPU_ISOLATED_STRICT mode Chris Metcalf <cmetcalf@ezchip.com> - 2015-06-03 17:40 +0200

csiph-web