The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH 0/4]  Use complete() instead of complete_all()
@ 2016-08-05  9:25 Daniel Wagner
  2016-08-05  9:26 ` [PATCH 1/4] misc: mic: scif: use " Daniel Wagner
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Daniel Wagner @ 2016-08-05  9:25 UTC (permalink / raw)
  To: linux-kernel
  Cc: Alex Dubov, Ashutosh Dixit, Greg Kroah-Hartman, Sudeep Dutt,
	Wolfram Sang, Daniel Wagner

From: Daniel Wagner <daniel.wagner@bmw-carit.de>

Hi,

Using complete_all() is not wrong per se but it suggest that there
might be more than one reader. For -rt I am reviewing all
complete_all() users and would like to leave only the real ones in the
tree. The main problem for -rt about complete_all() is that it can be
uses inside IRQ context and that can lead to unbounded amount work
inside the interrupt handler. That is a no no for -rt.

The patches grouped per subsystem and in small batches to allow
reviewing. Unfortanatly I am not so good in coming up with unique
commit message, so please bear with me in that regard. I could also
squash them together, although each patch containts a very short
reasoning why there is only one waiter. Let me know what you rather
prefer. One patch which updates all complete_all() users or those 4
patches with some reasoning.

It is only test compiled because I don't have the all the hardware.

cheers,
daniel

Daniel Wagner (4):
  misc: mic: scif: use complete() instead of complete_all()
  misc: mic: vop: use complete() instead of complete_all()
  misc: ti-st: use complete() instead of complete_all()
  misc: tifm: use complete() instead of complete_all()

 drivers/misc/mic/scif/scif_nodeqp.c | 2 +-
 drivers/misc/mic/vop/vop_main.c     | 2 +-
 drivers/misc/ti-st/st_kim.c         | 2 +-
 drivers/misc/tifm_7xx1.c            | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

-- 
2.7.4

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/4] misc: mic: scif: use complete() instead of complete_all()
  2016-08-05  9:25 [PATCH 0/4] Use complete() instead of complete_all() Daniel Wagner
@ 2016-08-05  9:26 ` Daniel Wagner
  2016-08-05  9:26 ` [PATCH 2/4] misc: mic: vop: " Daniel Wagner
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Daniel Wagner @ 2016-08-05  9:26 UTC (permalink / raw)
  To: linux-kernel
  Cc: Alex Dubov, Ashutosh Dixit, Greg Kroah-Hartman, Sudeep Dutt,
	Wolfram Sang, Daniel Wagner

From: Daniel Wagner <daniel.wagner@bmw-carit.de>

There is only one waiter for the completion, therefore there
is no need to use complete_all(). Let's make that clear by
using complete() instead of complete_all().

The usage pattern of the completion is:

waiter context                          waker context

scif_get_node_info()
  DECLARE_COMPLETION_ONSTACK(node_info);
  msg->payload[3] = node_info
  scif_nodeqp_send()
  wait_for_completion(node_info)

                                        scif_get_node_info_resp()
                                          node_info = msg->payload[3]
                                          complete(node_info)

Signed-off-by: Daniel Wagner <daniel.wagner@bmw-carit.de>
---
 drivers/misc/mic/scif/scif_nodeqp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/mic/scif/scif_nodeqp.c b/drivers/misc/mic/scif/scif_nodeqp.c
index c66ca1a..c9b3b64 100644
--- a/drivers/misc/mic/scif/scif_nodeqp.c
+++ b/drivers/misc/mic/scif/scif_nodeqp.c
@@ -1009,7 +1009,7 @@ scif_get_node_info_resp(struct scif_dev *scifdev, struct scifmsg *msg)
 		mutex_lock(&scif_info.conflock);
 		scif_info.maxid = msg->payload[1];
 		scif_info.total = msg->payload[2];
-		complete_all(node_info);
+		complete(node_info);
 		mutex_unlock(&scif_info.conflock);
 	}
 }
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/4] misc: mic: vop: use complete() instead of complete_all()
  2016-08-05  9:25 [PATCH 0/4] Use complete() instead of complete_all() Daniel Wagner
  2016-08-05  9:26 ` [PATCH 1/4] misc: mic: scif: use " Daniel Wagner
@ 2016-08-05  9:26 ` Daniel Wagner
  2016-08-05  9:26 ` [PATCH 3/4] misc: ti-st: " Daniel Wagner
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Daniel Wagner @ 2016-08-05  9:26 UTC (permalink / raw)
  To: linux-kernel
  Cc: Alex Dubov, Ashutosh Dixit, Greg Kroah-Hartman, Sudeep Dutt,
	Wolfram Sang, Daniel Wagner

From: Daniel Wagner <daniel.wagner@bmw-carit.de>

There is only one waiter for the completion, therefore there
is no need to use complete_all(). Let's make that clear by
using complete() instead of complete_all().

The usage pattern of the completion is:

waiter context                          waker context

_vop_remove_device()
  reinit_completion()
  wait_for_completion()
                                        vop_reset()
                                          complete()

Signed-off-by: Daniel Wagner <daniel.wagner@bmw-carit.de>
---
 drivers/misc/mic/vop/vop_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/mic/vop/vop_main.c b/drivers/misc/mic/vop/vop_main.c
index 1a2b67f3..f4ed4a8 100644
--- a/drivers/misc/mic/vop/vop_main.c
+++ b/drivers/misc/mic/vop/vop_main.c
@@ -229,7 +229,7 @@ static void vop_reset(struct virtio_device *dev)
 		__func__, dev->id.device);
 
 	vop_reset_inform_host(dev);
-	complete_all(&vdev->reset_done);
+	complete(&vdev->reset_done);
 }
 
 /*
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/4] misc: ti-st: use complete() instead of complete_all()
  2016-08-05  9:25 [PATCH 0/4] Use complete() instead of complete_all() Daniel Wagner
  2016-08-05  9:26 ` [PATCH 1/4] misc: mic: scif: use " Daniel Wagner
  2016-08-05  9:26 ` [PATCH 2/4] misc: mic: vop: " Daniel Wagner
@ 2016-08-05  9:26 ` Daniel Wagner
  2016-08-05  9:26 ` [PATCH 4/4] misc: tifm: " Daniel Wagner
  2016-08-14 22:51 ` [PATCH 0/4] Use " Wolfram Sang
  4 siblings, 0 replies; 6+ messages in thread
From: Daniel Wagner @ 2016-08-05  9:26 UTC (permalink / raw)
  To: linux-kernel
  Cc: Alex Dubov, Ashutosh Dixit, Greg Kroah-Hartman, Sudeep Dutt,
	Wolfram Sang, Daniel Wagner

From: Daniel Wagner <daniel.wagner@bmw-carit.de>

There is only one waiter for the completion, therefore there
is no need to use complete_all(). Let's make that clear by
using complete() instead of complete_all().

The usage pattern of the completion is:

waiter context                          waker context

read_local_version()
  reinit_completion()
  st_int_write()
  wait_for_completion_interruptible_timeout()

                                        validate_firmware_response()
                                          complete()
  reinit_completion()

Signed-off-by: Daniel Wagner <daniel.wagner@bmw-carit.de>
---
 drivers/misc/ti-st/st_kim.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/ti-st/st_kim.c b/drivers/misc/ti-st/st_kim.c
index bf0d770..0e1c94a 100644
--- a/drivers/misc/ti-st/st_kim.c
+++ b/drivers/misc/ti-st/st_kim.c
@@ -88,7 +88,7 @@ static void validate_firmware_response(struct kim_data_s *kim_gdata)
 		return;		/* keep waiting for the proper response */
 	}
 	/* becos of all the script being downloaded */
-	complete_all(&kim_gdata->kim_rcvd);
+	complete(&kim_gdata->kim_rcvd);
 	kfree_skb(skb);
 }
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 4/4] misc: tifm: use complete() instead of complete_all()
  2016-08-05  9:25 [PATCH 0/4] Use complete() instead of complete_all() Daniel Wagner
                   ` (2 preceding siblings ...)
  2016-08-05  9:26 ` [PATCH 3/4] misc: ti-st: " Daniel Wagner
@ 2016-08-05  9:26 ` Daniel Wagner
  2016-08-14 22:51 ` [PATCH 0/4] Use " Wolfram Sang
  4 siblings, 0 replies; 6+ messages in thread
From: Daniel Wagner @ 2016-08-05  9:26 UTC (permalink / raw)
  To: linux-kernel
  Cc: Alex Dubov, Ashutosh Dixit, Greg Kroah-Hartman, Sudeep Dutt,
	Wolfram Sang, Daniel Wagner

From: Daniel Wagner <daniel.wagner@bmw-carit.de>

There is only one waiter for the completion, therefore there
is no need to use complete_all(). Let's make that clear by
using complete() instead of complete_all().

The usage pattern of the completion is:

waiter context                          waker context

tifm_7xx1_resume()
  DECLARE_COMPLETION_ONSTACK(finish_resume)
  fm->finish_me = finish_resume
  /* enable irq */
  wait_for_completion_timeout(finish_resume)

                                        tifm_7xx1_isr()
                                          complete(fm->finish_me)

Signed-off-by: Daniel Wagner <daniel.wagner@bmw-carit.de>
---
 drivers/misc/tifm_7xx1.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/tifm_7xx1.c b/drivers/misc/tifm_7xx1.c
index a37a42f..77af41c 100644
--- a/drivers/misc/tifm_7xx1.c
+++ b/drivers/misc/tifm_7xx1.c
@@ -69,7 +69,7 @@ static irqreturn_t tifm_7xx1_isr(int irq, void *dev_id)
 	writel(irq_status, fm->addr + FM_INTERRUPT_STATUS);
 
 	if (fm->finish_me)
-		complete_all(fm->finish_me);
+		complete(fm->finish_me);
 	else if (!fm->socket_change_set)
 		writel(TIFM_IRQ_ENABLE, fm->addr + FM_SET_INTERRUPT_ENABLE);
 	else
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/4]  Use complete() instead of complete_all()
  2016-08-05  9:25 [PATCH 0/4] Use complete() instead of complete_all() Daniel Wagner
                   ` (3 preceding siblings ...)
  2016-08-05  9:26 ` [PATCH 4/4] misc: tifm: " Daniel Wagner
@ 2016-08-14 22:51 ` Wolfram Sang
  4 siblings, 0 replies; 6+ messages in thread
From: Wolfram Sang @ 2016-08-14 22:51 UTC (permalink / raw)
  To: Daniel Wagner
  Cc: linux-kernel, Alex Dubov, Ashutosh Dixit, Greg Kroah-Hartman,
	Sudeep Dutt, Daniel Wagner

[-- Attachment #1: Type: text/plain, Size: 1106 bytes --]

On Fri, Aug 05, 2016 at 11:25:59AM +0200, Daniel Wagner wrote:
> From: Daniel Wagner <daniel.wagner@bmw-carit.de>
> 
> Hi,
> 
> Using complete_all() is not wrong per se but it suggest that there
> might be more than one reader. For -rt I am reviewing all
> complete_all() users and would like to leave only the real ones in the
> tree. The main problem for -rt about complete_all() is that it can be
> uses inside IRQ context and that can lead to unbounded amount work
> inside the interrupt handler. That is a no no for -rt.
> 
> The patches grouped per subsystem and in small batches to allow
> reviewing. Unfortanatly I am not so good in coming up with unique
> commit message, so please bear with me in that regard. I could also
> squash them together, although each patch containts a very short
> reasoning why there is only one waiter. Let me know what you rather
> prefer. One patch which updates all complete_all() users or those 4
> patches with some reasoning.
> 
> It is only test compiled because I don't have the all the hardware.

All applied to for-current, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-08-14 22:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-05  9:25 [PATCH 0/4] Use complete() instead of complete_all() Daniel Wagner
2016-08-05  9:26 ` [PATCH 1/4] misc: mic: scif: use " Daniel Wagner
2016-08-05  9:26 ` [PATCH 2/4] misc: mic: vop: " Daniel Wagner
2016-08-05  9:26 ` [PATCH 3/4] misc: ti-st: " Daniel Wagner
2016-08-05  9:26 ` [PATCH 4/4] misc: tifm: " Daniel Wagner
2016-08-14 22:51 ` [PATCH 0/4] Use " Wolfram Sang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox