Skip to contentSkip to conversation

Revert "workqueue: remove unused cancel_work()"

PATCH Applied Andrey Grodzovsky 5 participants 10 messages May 19, 2022 – Jun 7, 2022 Workqueue

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Revert "workqueue: remove unused cancel_work()"

This reverts commit 6417250d3f894e66a68ba1cd93676143f2376a6f and exports the function.

We need this funtion in amdgpu driver to fix a bug.

---
 include/linux/workqueue.h | 1 +
 kernel/workqueue.c        | 9 +++++++++
 2 files changed, 10 insertions(+)
include/linux/workqueue.h +1 -0
index 7fee9b6cfede..9e41e1226193 100644
@@ -453,6 +453,7 @@ extern int schedule_on_each_cpu(work_func_t func);
 int execute_in_process_context(work_func_t fn, struct execute_work *);
 
 extern bool flush_work(struct work_struct *work);
+extern bool cancel_work(struct work_struct *work);
 extern bool cancel_work_sync(struct work_struct *work);
 
 extern bool flush_delayed_work(struct delayed_work *dwork);
kernel/workqueue.c +9 -0
index 613917bbc4e7..f94b596ebffd 100644
@@ -3267,6 +3267,15 @@ static bool __cancel_work(struct work_struct *work, bool is_dwork)
 	return ret;
 }
 
+/*
+ * See cancel_delayed_work()
+ */
+bool cancel_work(struct work_struct *work)
+{
+	return __cancel_work(work, false);
+}
+EXPORT_SYMBOL(cancel_work);
+
 /**
  * cancel_delayed_work - cancel a delayed work
  * @dwork: delayed_work to cancel
Signature · 1 line
2.25.1
reviewer
#1 lore raw
Quoted 5 lines · Andrey Grodzovsky

This reverts commit 6417250d3f894e66a68ba1cd93676143f2376a6f and exports the function.

We need this funtion in amdgpu driver to fix a bug.

Hello,

Could you specify the reason why it is needed in amdgpu driver rather than "fix a bug", please.

And there is a typo: "funtion".

And please avoid using "we" in the changelog. For example, the sentence can be changed to:

The amdgpu driver needs this function to cancel a work item in blabla context/situation or for blabla reason. (I'm not good at Engish, this is just an example of not using "we". No need to use the sentence.)

Thanks
Lai

Quoted 42 lines
---
 include/linux/workqueue.h | 1 +
 kernel/workqueue.c        | 9 +++++++++
 2 files changed, 10 insertions(+)
include/linux/workqueue.h +1 -0
index 7fee9b6cfede..9e41e1226193 100644
@@ -453,6 +453,7 @@ extern int schedule_on_each_cpu(work_func_t func);
 int execute_in_process_context(work_func_t fn, struct execute_work *);
 
 extern bool flush_work(struct work_struct *work);
+extern bool cancel_work(struct work_struct *work);
 extern bool cancel_work_sync(struct work_struct *work);
 
 extern bool flush_delayed_work(struct delayed_work *dwork);
kernel/workqueue.c +9 -1
index 613917bbc4e7..f94b596ebffd 100644
@@ -3267,6 +3267,15 @@ static bool __cancel_work(struct work_struct *work, bool is_dwork)
        return ret;
 }
 
+/*
+ * See cancel_delayed_work()
+ */
+bool cancel_work(struct work_struct *work)
+{
+       return __cancel_work(work, false);
+}
+EXPORT_SYMBOL(cancel_work);
+
 /**
  * cancel_delayed_work - cancel a delayed work
  * @dwork: delayed_work to cancel
--

2.25.1

#2 lore raw

See this patch-set https://www.spinics.net/lists/amd-gfx/msg78514.html, specifically patch 'drm/amdgpu: Switch to delayed work from work_struct.

I will just reiterate here -

We need to be able to do non blocking cancel pending reset works from within GPU reset. Currently kernel API allows this only for delayed_work and not for work_struct.

Andrey

Quoted 65 lines · Lai Jiangshan
Quoted 4 lines · Andrey Grodzovsky

This reverts commit 6417250d3f894e66a68ba1cd93676143f2376a6f and exports the function.

We need this funtion in amdgpu driver to fix a bug.

Hello,

Could you specify the reason why it is needed in amdgpu driver rather than "fix a bug", please.

And there is a typo: "funtion".

And please avoid using "we" in the changelog. For example, the sentence can be changed to:

The amdgpu driver needs this function to cancel a work item in blabla context/situation or for blabla reason. (I'm not good at Engish, this is just an example of not using "we". No need to use the sentence.)

Thanks
Lai

Quoted 41 lines
---
  include/linux/workqueue.h | 1 +
  kernel/workqueue.c        | 9 +++++++++
  2 files changed, 10 insertions(+)
include/linux/workqueue.h +1 -0
index 7fee9b6cfede..9e41e1226193 100644
@@ -453,6 +453,7 @@ extern int schedule_on_each_cpu(work_func_t func);
  int execute_in_process_context(work_func_t fn, struct execute_work *);
 
  extern bool flush_work(struct work_struct *work);
+extern bool cancel_work(struct work_struct *work);
  extern bool cancel_work_sync(struct work_struct *work);
 
  extern bool flush_delayed_work(struct delayed_work *dwork);
kernel/workqueue.c +9 -1
index 613917bbc4e7..f94b596ebffd 100644
@@ -3267,6 +3267,15 @@ static bool __cancel_work(struct work_struct *work, bool is_dwork)
         return ret;
  }
 
+/*
+ * See cancel_delayed_work()
+ */
+bool cancel_work(struct work_struct *work)
+{
+       return __cancel_work(work, false);
+}
+EXPORT_SYMBOL(cancel_work);
+
  /**
   * cancel_delayed_work - cancel a delayed work
   * @dwork: delayed_work to cancel
--

2.25.1

reviewer Reviewed-by
#3 lore raw
Quoted 10 lines · Andrey Grodzovsky

See this patch-set https://www.spinics.net/lists/amd-gfx/msg78514.html, specifically patch 'drm/amdgpu: Switch to delayed work from work_struct.

I will just reiterate here -

We need to be able to do non blocking cancel pending reset works from within GPU reset. Currently kernel API allows this only for delayed_work and not for work_struct.

I'm OK with the change.

With an updated changelog:

Thanks
Lai

#4 lore raw

Am 20.05.22 um 02:47 schrieb Lai Jiangshan:

Quoted 11 lines
Quoted 9 lines · Andrey Grodzovsky

See this patch-set https://www.spinics.net/lists/amd-gfx/msg78514.html, specifically patch 'drm/amdgpu: Switch to delayed work from work_struct.

I will just reiterate here -

We need to be able to do non blocking cancel pending reset works from within GPU reset. Currently kernel API allows this only for delayed_work and not for work_struct.

Quoted 5 lines

I'm OK with the change.

With an updated changelog:

Good morning guys,

for the patch itself Reviewed-by: Christian König <[email protected]>

And just for the record: We plan to push this upstream through the drm branches, if anybody has any objections to that please speak up.

Thanks,
Christian.

Quoted 4 lines

Thanks
Lai

maintainer
#5 lore raw
Quoted 16 lines · Christian König

Am 20.05.22 um 02:47 schrieb Lai Jiangshan:

Quoted 15 lines
Quoted 9 lines · Andrey Grodzovsky

See this patch-set https://www.spinics.net/lists/amd-gfx/msg78514.html, specifically patch 'drm/amdgpu: Switch to delayed work from work_struct.

I will just reiterate here -

We need to be able to do non blocking cancel pending reset works from within GPU reset. Currently kernel API allows this only for delayed_work and not for work_struct.

I'm OK with the change.

With an updated changelog:

Quoted 8 lines
Quoted 1 line

Good morning guys,

for the patch itself Reviewed-by: Christian König <[email protected]>

And just for the record: We plan to push this upstream through the drm branches, if anybody has any objections to that please speak up.

Andrey, care to resend with updated description?

Thanks.

Signature · 1 line
tejun
#6 lore raw
Quoted 21 lines · Tejun Heo
Quoted 20 lines · Christian König

Am 20.05.22 um 02:47 schrieb Lai Jiangshan:

Quoted 11 lines
Quoted 9 lines · Andrey Grodzovsky

See this patch-set https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.spinics.net%2Flists%2Famd-gfx%2Fmsg78514.html&amp;data=05%7C01%7Candrey.grodzovsky%40amd.com%7Cb25896b7e8b14e605a8d08da3a35a7c7%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637886299388464620%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=TRabWQQrhy6nwkLfuXI4A%2FOcF9f%2FtFKdxIRfGc8Das4%3D&amp;reserved=0, specifically patch 'drm/amdgpu: Switch to delayed work from work_struct.

I will just reiterate here -

We need to be able to do non blocking cancel pending reset works from within GPU reset. Currently kernel API allows this only for delayed_work and not for work_struct.

Quoted 5 lines

I'm OK with the change.

With an updated changelog:

Good morning guys,

Quoted 9 lines
Quoted 4 lines

for the patch itself Reviewed-by: Christian König <[email protected]>

And just for the record: We plan to push this upstream through the drm branches, if anybody has any objections to that please speak up.

Andrey, care to resend with updated description?

Thanks

Just adding here as attachment since only description changed changed.

Andrey

From 78df30cc97f10c885f5159a293e6afe2348aa60c Mon Sep 17 00:00:00 2001
From: Andrey Grodzovsky <[email protected]>
Date: Thu, 19 May 2022 09:47:28 -0400
Subject: Revert "workqueue: remove unused cancel_work()"

This reverts commit 6417250d3f894e66a68ba1cd93676143f2376a6f.

amdpgu need this function in order to prematurly stop pending reset works when another reset work already in progress.

---
 include/linux/workqueue.h | 1 +
 kernel/workqueue.c        | 9 +++++++++
 2 files changed, 10 insertions(+)
include/linux/workqueue.h +1 -0
index 7fee9b6cfede..9e41e1226193 100644
@@ -453,6 +453,7 @@ extern int schedule_on_each_cpu(work_func_t func);
 int execute_in_process_context(work_func_t fn, struct execute_work *);
 
 extern bool flush_work(struct work_struct *work);
+extern bool cancel_work(struct work_struct *work);
 extern bool cancel_work_sync(struct work_struct *work);
 
 extern bool flush_delayed_work(struct delayed_work *dwork);
kernel/workqueue.c +9 -0
index 613917bbc4e7..f94b596ebffd 100644
@@ -3267,6 +3267,15 @@ static bool __cancel_work(struct work_struct *work, bool is_dwork)
 	return ret;
 }
 
+/*
+ * See cancel_delayed_work()
+ */
+bool cancel_work(struct work_struct *work)
+{
+	return __cancel_work(work, false);
+}
+EXPORT_SYMBOL(cancel_work);
+
 /**
  * cancel_delayed_work - cancel a delayed work
  * @dwork: delayed_work to cancel
Signature · 1 line
2.25.1
maintainer Applied
#7 lore raw
Quoted 11 lines · Andrey Grodzovsky

From 78df30cc97f10c885f5159a293e6afe2348aa60c Mon Sep 17 00:00:00 2001
From: Andrey Grodzovsky <[email protected]>
Date: Thu, 19 May 2022 09:47:28 -0400
Subject: Revert "workqueue: remove unused cancel_work()"

This reverts commit 6417250d3f894e66a68ba1cd93676143f2376a6f.

amdpgu need this function in order to prematurly stop pending reset works when another reset work already in progress.

Applied to wq/for-5.19-fixes.

Thanks.

Signature · 1 line
tejun
#8 lore raw
Quoted 7 lines · Tejun Heo
Quoted 5 lines · Andrey Grodzovsky

From 78df30cc97f10c885f5159a293e6afe2348aa60c Mon Sep 17 00:00:00 2001
From: Andrey Grodzovsky <[email protected]>
Date: Thu, 19 May 2022 09:47:28 -0400
Subject: Revert "workqueue: remove unused cancel_work()"

Quoted 8 lines
Quoted 6 lines

This reverts commit 6417250d3f894e66a68ba1cd93676143f2376a6f.

amdpgu need this function in order to prematurly stop pending reset works when another reset work already in progress.

Applied to wq/for-5.19-fixes.

Could we take it through the drm tree so we can include it with Andrey's patches that depend on it?

Alex

Quoted 5 lines

Thanks.

--
tejun

maintainer Acked-by
#9 lore raw
Quoted 13 lines · Alex Deucher
Quoted 12 lines · Tejun Heo
Quoted 10 lines · Andrey Grodzovsky

From 78df30cc97f10c885f5159a293e6afe2348aa60c Mon Sep 17 00:00:00 2001
From: Andrey Grodzovsky <[email protected]>
Date: Thu, 19 May 2022 09:47:28 -0400
Subject: Revert "workqueue: remove unused cancel_work()"

This reverts commit 6417250d3f894e66a68ba1cd93676143f2376a6f.

amdpgu need this function in order to prematurly stop pending reset works when another reset work already in progress.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Applied to wq/for-5.19-fixes.

Could we take it through the drm tree so we can include it with Andrey's patches that depend on it?

Oh sure, please go ahead. Imma revert from my tree.

Thanks.

Signature · 1 line
tejun