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]
Message-Id: <1673235231-30302-19-git-send-email-byungchul.park@lge.com>
Date:   Mon,  9 Jan 2023 12:33:46 +0900
From:   Byungchul Park <byungchul.park@....com>
To:     linux-kernel@...r.kernel.org
Cc:     torvalds@...ux-foundation.org, damien.lemoal@...nsource.wdc.com,
        linux-ide@...r.kernel.org, adilger.kernel@...ger.ca,
        linux-ext4@...r.kernel.org, mingo@...hat.com, peterz@...radead.org,
        will@...nel.org, tglx@...utronix.de, rostedt@...dmis.org,
        joel@...lfernandes.org, sashal@...nel.org, daniel.vetter@...ll.ch,
        duyuyang@...il.com, johannes.berg@...el.com, tj@...nel.org,
        tytso@....edu, willy@...radead.org, david@...morbit.com,
        amir73il@...il.com, gregkh@...uxfoundation.org,
        kernel-team@....com, linux-mm@...ck.org, akpm@...ux-foundation.org,
        mhocko@...nel.org, minchan@...nel.org, hannes@...xchg.org,
        vdavydov.dev@...il.com, sj@...nel.org, jglisse@...hat.com,
        dennis@...nel.org, cl@...ux.com, penberg@...nel.org,
        rientjes@...gle.com, vbabka@...e.cz, ngupta@...are.org,
        linux-block@...r.kernel.org, paolo.valente@...aro.org,
        josef@...icpanda.com, linux-fsdevel@...r.kernel.org,
        viro@...iv.linux.org.uk, jack@...e.cz, jlayton@...nel.org,
        dan.j.williams@...el.com, hch@...radead.org, djwong@...nel.org,
        dri-devel@...ts.freedesktop.org, rodrigosiqueiramelo@...il.com,
        melissa.srw@...il.com, hamohammed.sa@...il.com,
        42.hyeyoo@...il.com, chris.p.wilson@...el.com,
        gwan-gyeong.mun@...el.com
Subject: [PATCH RFC v7 18/23] dept: Apply timeout consideration to wait_for_completion()/complete()

Now that CONFIG_DEPT_AGGRESSIVE_TIMEOUT_WAIT was introduced, apply the
consideration to wait_for_completion()/complete().

Signed-off-by: Byungchul Park <byungchul.park@....com>
---
 include/linux/completion.h | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/include/linux/completion.h b/include/linux/completion.h
index 0408f6d..57a715f 100644
--- a/include/linux/completion.h
+++ b/include/linux/completion.h
@@ -11,6 +11,7 @@
 
 #include <linux/swait.h>
 #include <linux/dept_sdt.h>
+#include <linux/sched.h>
 
 /*
  * struct completion - structure used to maintain state for a "completion"
@@ -153,7 +154,10 @@ extern long raw_wait_for_completion_killable_timeout(
 #define wait_for_completion_timeout(x, t)			\
 ({								\
 	unsigned long __ret;					\
-	sdt_might_sleep_strong(NULL);				\
+	if ((t) == MAX_SCHEDULE_TIMEOUT)			\
+		sdt_might_sleep_strong(NULL);			\
+	else							\
+		sdt_might_sleep_strong_timeout(NULL);		\
 	__ret = raw_wait_for_completion_timeout(x, t);		\
 	sdt_might_sleep_finish();				\
 	__ret;							\
@@ -161,7 +165,10 @@ extern long raw_wait_for_completion_killable_timeout(
 #define wait_for_completion_io_timeout(x, t)			\
 ({								\
 	unsigned long __ret;					\
-	sdt_might_sleep_strong(NULL);				\
+	if ((t) == MAX_SCHEDULE_TIMEOUT)			\
+		sdt_might_sleep_strong(NULL);			\
+	else							\
+		sdt_might_sleep_strong_timeout(NULL);		\
 	__ret = raw_wait_for_completion_io_timeout(x, t);	\
 	sdt_might_sleep_finish();				\
 	__ret;							\
@@ -169,7 +176,10 @@ extern long raw_wait_for_completion_killable_timeout(
 #define wait_for_completion_interruptible_timeout(x, t)		\
 ({								\
 	long __ret;						\
-	sdt_might_sleep_strong(NULL);				\
+	if ((t) == MAX_SCHEDULE_TIMEOUT)			\
+		sdt_might_sleep_strong(NULL);			\
+	else							\
+		sdt_might_sleep_strong_timeout(NULL);		\
 	__ret = raw_wait_for_completion_interruptible_timeout(x, t);\
 	sdt_might_sleep_finish();				\
 	__ret;							\
@@ -177,7 +187,10 @@ extern long raw_wait_for_completion_killable_timeout(
 #define wait_for_completion_killable_timeout(x, t)		\
 ({								\
 	long __ret;						\
-	sdt_might_sleep_strong(NULL);				\
+	if ((t) == MAX_SCHEDULE_TIMEOUT)			\
+		sdt_might_sleep_strong(NULL);			\
+	else							\
+		sdt_might_sleep_strong_timeout(NULL);		\
 	__ret = raw_wait_for_completion_killable_timeout(x, t);	\
 	sdt_might_sleep_finish();				\
 	__ret;							\
-- 
1.9.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ