lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 5 May 2023 19:33:12 +0800
From: Liu Jian <liujian56@...wei.com>
To: <corbet@....net>, <paulmck@...nel.org>, <frederic@...nel.org>,
	<quic_neeraju@...cinc.com>, <joel@...lfernandes.org>,
	<josh@...htriplett.org>, <boqun.feng@...il.com>, <rostedt@...dmis.org>,
	<mathieu.desnoyers@...icios.com>, <jiangshanlai@...il.com>,
	<qiang1.zhang@...el.com>, <jstultz@...gle.com>, <tglx@...utronix.de>,
	<sboyd@...nel.org>, <davem@...emloft.net>, <edumazet@...gle.com>,
	<kuba@...nel.org>, <pabeni@...hat.com>, <peterz@...radead.org>,
	<frankwoo@...gle.com>, <Rhinewuwu@...gle.com>
CC: <liujian56@...wei.com>, <linux-doc@...r.kernel.org>,
	<linux-kernel@...r.kernel.org>, <rcu@...r.kernel.org>,
	<netdev@...r.kernel.org>
Subject: [PATCH 6/9] softirq: Provide a softirq_needs_break() API

From: Peter Zijlstra <peterz@...radead.org>

So that all open_softirq() users can employ the same break conditions
and work off the same time-base in case of multiple pending vectors.

Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
Signed-off-by: Liu Jian <liujian56@...wei.com>
---
 include/linux/interrupt.h |  5 +++++
 kernel/softirq.c          | 16 ++++++++++++++++
 2 files changed, 21 insertions(+)

diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index a92bce40b04b..94d1047fe0c3 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -584,8 +584,13 @@ extern const char * const softirq_to_name[NR_SOFTIRQS];
 struct softirq_action
 {
 	void	(*action)(struct softirq_action *);
+	u64	start;
+	u64	timo;
 };
 
+extern struct softirq_action softirq_action_now(void);
+extern bool softirq_needs_break(struct softirq_action *action);
+
 asmlinkage void do_softirq(void);
 asmlinkage void __do_softirq(void);
 
diff --git a/kernel/softirq.c b/kernel/softirq.c
index baa08ae1604f..dc4299e40dad 100644
--- a/kernel/softirq.c
+++ b/kernel/softirq.c
@@ -533,6 +533,20 @@ static inline bool __softirq_needs_break(u64 start, u64 timo)
 	return false;
 }
 
+bool softirq_needs_break(struct softirq_action *h)
+{
+	return __softirq_needs_break(h->start, h->timo);
+}
+
+struct softirq_action softirq_action_now(void)
+{
+	struct softirq_action h = {
+		.start = sched_clock(),
+		.timo = MAX_SOFTIRQ_TIME,
+	};
+	return h;
+}
+
 asmlinkage __visible void __softirq_entry __do_softirq(void)
 {
 	unsigned int max_restart = MAX_SOFTIRQ_RESTART;
@@ -572,6 +586,8 @@ asmlinkage __visible void __softirq_entry __do_softirq(void)
 		__clear_bit(vec_nr, &pending);
 
 		h = softirq_vec + vec_nr;
+		h->start = start;
+		h->timo = timo;
 
 		prev_count = preempt_count();
 
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ