linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] staging: vchiq: use interruptible waits
@ 2019-05-06 14:40 Nicolas Saenz Julienne
  2019-05-06 14:40 ` [PATCH v2 1/3] staging: vchiq_2835_arm: revert "quit using custom down_interruptible()" Nicolas Saenz Julienne
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Nicolas Saenz Julienne @ 2019-05-06 14:40 UTC (permalink / raw)
  To: linux-kernel
  Cc: phil, dan.carpenter, stefan.wahren, Nicolas Saenz Julienne,
	linux-rpi-kernel, linux-arm-kernel, devel

Hi,
this series tries to address an issue that came up in Raspbian's kernel
tree [1] and upstream distros [2][3].

We adopted some changes that moved wait calls from a custom
implementation to the more standard killable family of functions. Users
complained that all the VCHIQ threads showed up in D state (which is the
expected behaviour).

The custom implementation we deleted tried to mimic the killable family
of functions, yet accepted more signals than the later; SIGKILL |
SIGINT | SIGQUIT | SIGTRAP | SIGSTOP | SIGCONT for the custom
implementation as opposed to plain old SIGKILL.

Raspbian maintainers decided roll back some of those changes and leave
the wait functions as interruptible. Hence creating some divergence
between both trees.

One could argue that not liking having the threads stuck in D state is
not really a software issue. It's more a cosmetic thing that can scare
people when they look at "uptime". On the other hand, if we are ever to
unstage this driver, we'd really need a proper justification for using
the killable family of functions. Which I think it's not really clear at
the moment.

As Raspbian's kernel has been working for a while with interruptible
waits I propose we follow through. If needed we can always go back to
killable. But at least we'll have a proper understanding on the actual
needs. In the end the driver is in staging, and the potential for errors
small.

Regards,
Nicolas

[1] https://github.com/raspberrypi/linux/issues/2881
[2] https://archlinuxarm.org/forum/viewtopic.php?f=65&t=13485
[3] https://lists.fedoraproject.org/archives/list/arm@lists.fedoraproject.org/message/GBXGJ7DOV5CQQXFPOZCXTRD6W4BEPT4Q/

--

Changes since v1:
  - Proplery format revert commits
  - Add code comment to remind of this issue
  - Add Fixes tags

Nicolas Saenz Julienne (3):
  staging: vchiq_2835_arm: revert "quit using custom
    down_interruptible()"
  staging: vchiq: revert "switch to wait_for_completion_killable"
  staging: vchiq: make wait events interruptible

 .../interface/vchiq_arm/vchiq_2835_arm.c      |  2 +-
 .../interface/vchiq_arm/vchiq_arm.c           | 21 +++++++------
 .../interface/vchiq_arm/vchiq_core.c          | 31 ++++++++++++-------
 .../interface/vchiq_arm/vchiq_util.c          |  6 ++--
 4 files changed, 35 insertions(+), 25 deletions(-)

-- 
2.21.0


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

* [PATCH v2 1/3] staging: vchiq_2835_arm: revert "quit using custom down_interruptible()"
  2019-05-06 14:40 [PATCH v2 0/3] staging: vchiq: use interruptible waits Nicolas Saenz Julienne
@ 2019-05-06 14:40 ` Nicolas Saenz Julienne
  2019-05-06 14:40 ` [PATCH v2 2/3] staging: vchiq: revert "switch to wait_for_completion_killable" Nicolas Saenz Julienne
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 10+ messages in thread
From: Nicolas Saenz Julienne @ 2019-05-06 14:40 UTC (permalink / raw)
  To: linux-kernel
  Cc: phil, dan.carpenter, stefan.wahren, Nicolas Saenz Julienne,
	Eric Anholt, Greg Kroah-Hartman, linux-rpi-kernel,
	linux-arm-kernel, devel

The killable version of down() is meant to be used on situations where
it should not fail at all costs, but still have the convenience of being
able to kill it if really necessary. VCHIQ doesn't fit this criteria, as
it's mainly used as an interface to V4L2 and ALSA devices.

Fixes: ff5979ad8636 ("staging: vchiq_2835_arm: quit using custom down_interruptible()")
Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
---
 .../staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
index dd4898861b83..bfc064a5f884 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
@@ -541,7 +541,7 @@ create_pagelist(char __user *buf, size_t count, unsigned short type)
 		(g_cache_line_size - 1)))) {
 		char *fragments;
 
-		if (down_killable(&g_free_fragments_sema)) {
+		if (down_interruptible(&g_free_fragments_sema) != 0) {
 			cleanup_pagelistinfo(pagelistinfo);
 			return NULL;
 		}
-- 
2.21.0


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

* [PATCH v2 2/3] staging: vchiq: revert "switch to wait_for_completion_killable"
  2019-05-06 14:40 [PATCH v2 0/3] staging: vchiq: use interruptible waits Nicolas Saenz Julienne
  2019-05-06 14:40 ` [PATCH v2 1/3] staging: vchiq_2835_arm: revert "quit using custom down_interruptible()" Nicolas Saenz Julienne
@ 2019-05-06 14:40 ` Nicolas Saenz Julienne
  2019-05-06 15:20   ` Dan Carpenter
  2019-05-07  5:54   ` Dan Carpenter
  2019-05-06 14:40 ` [PATCH v2 3/3] staging: vchiq: make wait events interruptible Nicolas Saenz Julienne
  2019-05-06 18:12 ` [PATCH v2 0/3] staging: vchiq: use interruptible waits Stefan Wahren
  3 siblings, 2 replies; 10+ messages in thread
From: Nicolas Saenz Julienne @ 2019-05-06 14:40 UTC (permalink / raw)
  To: linux-kernel
  Cc: phil, dan.carpenter, stefan.wahren, Nicolas Saenz Julienne,
	Eric Anholt, Greg Kroah-Hartman, linux-rpi-kernel,
	linux-arm-kernel, devel

The killable version of wait_for_completion() is meant to be used on
situations where it should not fail at all costs, but still have the
convenience of being able to kill it if really necessary. VCHIQ doesn't
fit this criteria, as it's mainly used as an interface to V4L2 and ALSA
devices.

Fixes: a772f116702e ("staging: vchiq: switch to wait_for_completion_killable")
Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>

This reverts commit a772f116702e3f0afdd7e6acadc1b8fb3b20b9ff.
---
 .../interface/vchiq_arm/vchiq_arm.c           | 21 ++++++++++---------
 .../interface/vchiq_arm/vchiq_core.c          | 21 ++++++++++---------
 .../interface/vchiq_arm/vchiq_util.c          |  6 +++---
 3 files changed, 25 insertions(+), 23 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
index 064d0db4c51e..ccfb8218b83c 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
@@ -560,7 +560,8 @@ add_completion(VCHIQ_INSTANCE_T instance, VCHIQ_REASON_T reason,
 		vchiq_log_trace(vchiq_arm_log_level,
 			"%s - completion queue full", __func__);
 		DEBUG_COUNT(COMPLETION_QUEUE_FULL_COUNT);
-		if (wait_for_completion_killable( &instance->remove_event)) {
+		if (wait_for_completion_interruptible(
+					&instance->remove_event)) {
 			vchiq_log_info(vchiq_arm_log_level,
 				"service_callback interrupted");
 			return VCHIQ_RETRY;
@@ -671,7 +672,7 @@ service_callback(VCHIQ_REASON_T reason, struct vchiq_header *header,
 			}
 
 			DEBUG_TRACE(SERVICE_CALLBACK_LINE);
-			if (wait_for_completion_killable(
+			if (wait_for_completion_interruptible(
 						&user_service->remove_event)
 				!= 0) {
 				vchiq_log_info(vchiq_arm_log_level,
@@ -1006,7 +1007,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 		   has been closed until the client library calls the
 		   CLOSE_DELIVERED ioctl, signalling close_event. */
 		if (user_service->close_pending &&
-			wait_for_completion_killable(
+			wait_for_completion_interruptible(
 				&user_service->close_event))
 			status = VCHIQ_RETRY;
 		break;
@@ -1182,7 +1183,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 
 			DEBUG_TRACE(AWAIT_COMPLETION_LINE);
 			mutex_unlock(&instance->completion_mutex);
-			rc = wait_for_completion_killable(
+			rc = wait_for_completion_interruptible(
 						&instance->insert_event);
 			mutex_lock(&instance->completion_mutex);
 			if (rc != 0) {
@@ -1352,7 +1353,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 			do {
 				spin_unlock(&msg_queue_spinlock);
 				DEBUG_TRACE(DEQUEUE_MESSAGE_LINE);
-				if (wait_for_completion_killable(
+				if (wait_for_completion_interruptible(
 					&user_service->insert_event)) {
 					vchiq_log_info(vchiq_arm_log_level,
 						"DEQUEUE_MESSAGE interrupted");
@@ -2360,7 +2361,7 @@ vchiq_keepalive_thread_func(void *v)
 	while (1) {
 		long rc = 0, uc = 0;
 
-		if (wait_for_completion_killable(&arm_state->ka_evt)
+		if (wait_for_completion_interruptible(&arm_state->ka_evt)
 				!= 0) {
 			vchiq_log_error(vchiq_susp_log_level,
 				"%s interrupted", __func__);
@@ -2611,7 +2612,7 @@ block_resume(struct vchiq_arm_state *arm_state)
 		write_unlock_bh(&arm_state->susp_res_lock);
 		vchiq_log_info(vchiq_susp_log_level, "%s wait for previously "
 			"blocked clients", __func__);
-		if (wait_for_completion_killable_timeout(
+		if (wait_for_completion_interruptible_timeout(
 				&arm_state->blocked_blocker, timeout_val)
 					<= 0) {
 			vchiq_log_error(vchiq_susp_log_level, "%s wait for "
@@ -2637,7 +2638,7 @@ block_resume(struct vchiq_arm_state *arm_state)
 		write_unlock_bh(&arm_state->susp_res_lock);
 		vchiq_log_info(vchiq_susp_log_level, "%s wait for resume",
 			__func__);
-		if (wait_for_completion_killable_timeout(
+		if (wait_for_completion_interruptible_timeout(
 				&arm_state->vc_resume_complete, timeout_val)
 					<= 0) {
 			vchiq_log_error(vchiq_susp_log_level, "%s wait for "
@@ -2844,7 +2845,7 @@ vchiq_arm_force_suspend(struct vchiq_state *state)
 	do {
 		write_unlock_bh(&arm_state->susp_res_lock);
 
-		rc = wait_for_completion_killable_timeout(
+		rc = wait_for_completion_interruptible_timeout(
 				&arm_state->vc_suspend_complete,
 				msecs_to_jiffies(FORCE_SUSPEND_TIMEOUT_MS));
 
@@ -2940,7 +2941,7 @@ vchiq_arm_allow_resume(struct vchiq_state *state)
 	write_unlock_bh(&arm_state->susp_res_lock);
 
 	if (resume) {
-		if (wait_for_completion_killable(
+		if (wait_for_completion_interruptible(
 			&arm_state->vc_resume_complete) < 0) {
 			vchiq_log_error(vchiq_susp_log_level,
 				"%s interrupted", __func__);
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
index 53f5a1cb4636..50189223f05b 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
@@ -590,7 +590,7 @@ reserve_space(struct vchiq_state *state, size_t space, int is_blocking)
 			remote_event_signal(&state->remote->trigger);
 
 			if (!is_blocking ||
-				(wait_for_completion_killable(
+				(wait_for_completion_interruptible(
 				&state->slot_available_event)))
 				return NULL; /* No space available */
 		}
@@ -860,7 +860,7 @@ queue_message(struct vchiq_state *state, struct vchiq_service *service,
 			spin_unlock(&quota_spinlock);
 			mutex_unlock(&state->slot_mutex);
 
-			if (wait_for_completion_killable(
+			if (wait_for_completion_interruptible(
 						&state->data_quota_event))
 				return VCHIQ_RETRY;
 
@@ -891,7 +891,7 @@ queue_message(struct vchiq_state *state, struct vchiq_service *service,
 				service_quota->slot_use_count);
 			VCHIQ_SERVICE_STATS_INC(service, quota_stalls);
 			mutex_unlock(&state->slot_mutex);
-			if (wait_for_completion_killable(
+			if (wait_for_completion_interruptible(
 						&service_quota->quota_event))
 				return VCHIQ_RETRY;
 			if (service->closing)
@@ -1740,7 +1740,8 @@ parse_rx_slots(struct vchiq_state *state)
 					&service->bulk_rx : &service->bulk_tx;
 
 				DEBUG_TRACE(PARSE_LINE);
-				if (mutex_lock_killable(&service->bulk_mutex)) {
+				if (mutex_lock_killable(
+					&service->bulk_mutex) != 0) {
 					DEBUG_TRACE(PARSE_LINE);
 					goto bail_not_ready;
 				}
@@ -2456,7 +2457,7 @@ vchiq_open_service_internal(struct vchiq_service *service, int client_id)
 			       QMFLAGS_IS_BLOCKING);
 	if (status == VCHIQ_SUCCESS) {
 		/* Wait for the ACK/NAK */
-		if (wait_for_completion_killable(&service->remove_event)) {
+		if (wait_for_completion_interruptible(&service->remove_event)) {
 			status = VCHIQ_RETRY;
 			vchiq_release_service_internal(service);
 		} else if ((service->srvstate != VCHIQ_SRVSTATE_OPEN) &&
@@ -2823,7 +2824,7 @@ vchiq_connect_internal(struct vchiq_state *state, VCHIQ_INSTANCE_T instance)
 	}
 
 	if (state->conn_state == VCHIQ_CONNSTATE_CONNECTING) {
-		if (wait_for_completion_killable(&state->connect))
+		if (wait_for_completion_interruptible(&state->connect))
 			return VCHIQ_RETRY;
 
 		vchiq_set_conn_state(state, VCHIQ_CONNSTATE_CONNECTED);
@@ -2922,7 +2923,7 @@ vchiq_close_service(VCHIQ_SERVICE_HANDLE_T handle)
 	}
 
 	while (1) {
-		if (wait_for_completion_killable(&service->remove_event)) {
+		if (wait_for_completion_interruptible(&service->remove_event)) {
 			status = VCHIQ_RETRY;
 			break;
 		}
@@ -2983,7 +2984,7 @@ vchiq_remove_service(VCHIQ_SERVICE_HANDLE_T handle)
 		request_poll(service->state, service, VCHIQ_POLL_REMOVE);
 	}
 	while (1) {
-		if (wait_for_completion_killable(&service->remove_event)) {
+		if (wait_for_completion_interruptible(&service->remove_event)) {
 			status = VCHIQ_RETRY;
 			break;
 		}
@@ -3066,7 +3067,7 @@ VCHIQ_STATUS_T vchiq_bulk_transfer(VCHIQ_SERVICE_HANDLE_T handle,
 		VCHIQ_SERVICE_STATS_INC(service, bulk_stalls);
 		do {
 			mutex_unlock(&service->bulk_mutex);
-			if (wait_for_completion_killable(
+			if (wait_for_completion_interruptible(
 						&service->bulk_remove_event)) {
 				status = VCHIQ_RETRY;
 				goto error_exit;
@@ -3143,7 +3144,7 @@ VCHIQ_STATUS_T vchiq_bulk_transfer(VCHIQ_SERVICE_HANDLE_T handle,
 
 	if (bulk_waiter) {
 		bulk_waiter->bulk = bulk;
-		if (wait_for_completion_killable(&bulk_waiter->event))
+		if (wait_for_completion_interruptible(&bulk_waiter->event))
 			status = VCHIQ_RETRY;
 		else if (bulk_waiter->actual == VCHIQ_BULK_ACTUAL_ABORTED)
 			status = VCHIQ_ERROR;
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.c
index 55c5fd82b911..30deea1b57f7 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.c
@@ -80,7 +80,7 @@ void vchiu_queue_push(struct vchiu_queue *queue, struct vchiq_header *header)
 		return;
 
 	while (queue->write == queue->read + queue->size) {
-		if (wait_for_completion_killable(&queue->pop))
+		if (wait_for_completion_interruptible(&queue->pop))
 			flush_signals(current);
 	}
 
@@ -93,7 +93,7 @@ void vchiu_queue_push(struct vchiu_queue *queue, struct vchiq_header *header)
 struct vchiq_header *vchiu_queue_peek(struct vchiu_queue *queue)
 {
 	while (queue->write == queue->read) {
-		if (wait_for_completion_killable(&queue->push))
+		if (wait_for_completion_interruptible(&queue->push))
 			flush_signals(current);
 	}
 
@@ -107,7 +107,7 @@ struct vchiq_header *vchiu_queue_pop(struct vchiu_queue *queue)
 	struct vchiq_header *header;
 
 	while (queue->write == queue->read) {
-		if (wait_for_completion_killable(&queue->push))
+		if (wait_for_completion_interruptible(&queue->push))
 			flush_signals(current);
 	}
 
-- 
2.21.0


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

* [PATCH v2 3/3] staging: vchiq: make wait events interruptible
  2019-05-06 14:40 [PATCH v2 0/3] staging: vchiq: use interruptible waits Nicolas Saenz Julienne
  2019-05-06 14:40 ` [PATCH v2 1/3] staging: vchiq_2835_arm: revert "quit using custom down_interruptible()" Nicolas Saenz Julienne
  2019-05-06 14:40 ` [PATCH v2 2/3] staging: vchiq: revert "switch to wait_for_completion_killable" Nicolas Saenz Julienne
@ 2019-05-06 14:40 ` Nicolas Saenz Julienne
  2019-05-06 18:12 ` [PATCH v2 0/3] staging: vchiq: use interruptible waits Stefan Wahren
  3 siblings, 0 replies; 10+ messages in thread
From: Nicolas Saenz Julienne @ 2019-05-06 14:40 UTC (permalink / raw)
  To: linux-kernel
  Cc: phil, dan.carpenter, stefan.wahren, Nicolas Saenz Julienne,
	Eric Anholt, Greg Kroah-Hartman, linux-rpi-kernel,
	linux-arm-kernel, devel

The killable version of wait_event() is meant to be used on situations
where it should not fail at all costs, but still have the convenience of
being able to kill it if really necessary. Wait events in VCHIQ doesn't
fit this criteria, as it's mainly used as an interface to V4L2 and ALSA
devices.

Fixes: 852b2876a8a8 ("staging: vchiq: rework remove_event handling")
Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
---
 .../vc04_services/interface/vchiq_arm/vchiq_core.c     | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
index 50189223f05b..9676f83dcf78 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
@@ -425,13 +425,21 @@ remote_event_create(wait_queue_head_t *wq, struct remote_event *event)
 	init_waitqueue_head(wq);
 }
 
+/*
+ * All the event waiting routines in VCHIQ used a custom semaphore
+ * implementation that filtered most signals. This achieved a behaviour similar
+ * to the "killable" family of functions. While cleaning up this code all the
+ * routines where switched to the "interruptible" family of functions, as the
+ * former was deemed unjustified and the use "killable" set all VCHIQ's
+ * threads in D state.
+ */
 static inline int
 remote_event_wait(wait_queue_head_t *wq, struct remote_event *event)
 {
 	if (!event->fired) {
 		event->armed = 1;
 		dsb(sy);
-		if (wait_event_killable(*wq, event->fired)) {
+		if (wait_event_interruptible(*wq, event->fired)) {
 			event->armed = 0;
 			return 0;
 		}
-- 
2.21.0


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

* Re: [PATCH v2 2/3] staging: vchiq: revert "switch to wait_for_completion_killable"
  2019-05-06 14:40 ` [PATCH v2 2/3] staging: vchiq: revert "switch to wait_for_completion_killable" Nicolas Saenz Julienne
@ 2019-05-06 15:20   ` Dan Carpenter
  2019-05-06 15:59     ` Nicolas Saenz Julienne
  2019-05-07  5:54   ` Dan Carpenter
  1 sibling, 1 reply; 10+ messages in thread
From: Dan Carpenter @ 2019-05-06 15:20 UTC (permalink / raw)
  To: Nicolas Saenz Julienne
  Cc: linux-kernel, phil, stefan.wahren, Eric Anholt,
	Greg Kroah-Hartman, linux-rpi-kernel, linux-arm-kernel, devel

On Mon, May 06, 2019 at 04:40:29PM +0200, Nicolas Saenz Julienne wrote:
> @@ -1740,7 +1740,8 @@ parse_rx_slots(struct vchiq_state *state)
>  					&service->bulk_rx : &service->bulk_tx;
>  
>  				DEBUG_TRACE(PARSE_LINE);
> -				if (mutex_lock_killable(&service->bulk_mutex)) {
> +				if (mutex_lock_killable(
> +					&service->bulk_mutex) != 0) {

This series does't add != 0 consistently...  Personally, I would prefer
we just leave it out.  I use != 0 for two things.  1)  When I'm talking
about the number zero.

	if (len == 0) {

Or with strcmp():

	if (strcmp(a, b) == 0) { // a equals b
	if (strcmp(a, b) < 0) {  // a less than b.

But here zero means no errors, so I would just leave it out...

regards,
dan carpenter


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

* Re: [PATCH v2 2/3] staging: vchiq: revert "switch to wait_for_completion_killable"
  2019-05-06 15:20   ` Dan Carpenter
@ 2019-05-06 15:59     ` Nicolas Saenz Julienne
  2019-05-06 16:28       ` Stefan Wahren
  0 siblings, 1 reply; 10+ messages in thread
From: Nicolas Saenz Julienne @ 2019-05-06 15:59 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: linux-kernel, phil, stefan.wahren, Eric Anholt,
	Greg Kroah-Hartman, linux-rpi-kernel, linux-arm-kernel, devel

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

Hi Dan, thanks for reviewing.

On Mon, 2019-05-06 at 18:20 +0300, Dan Carpenter wrote:
> On Mon, May 06, 2019 at 04:40:29PM +0200, Nicolas Saenz Julienne wrote:
> > @@ -1740,7 +1740,8 @@ parse_rx_slots(struct vchiq_state *state)
> >  					&service->bulk_rx : &service->bulk_tx;
> >  
> >  				DEBUG_TRACE(PARSE_LINE);
> > -				if (mutex_lock_killable(&service->bulk_mutex)) {
> > +				if (mutex_lock_killable(
> > +					&service->bulk_mutex) != 0) {
> 
> This series does't add != 0 consistently...  Personally, I would prefer
> we just leave it out.  I use != 0 for two things.  1)  When I'm talking
> about the number zero.
> 
> 	if (len == 0) {
> 
> Or with strcmp():
> 
> 	if (strcmp(a, b) == 0) { // a equals b
> 	if (strcmp(a, b) < 0) {  // a less than b.
> 
> But here zero means no errors, so I would just leave it out...

I agree, I'll fix it.

Regards,
Nicolas


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH v2 2/3] staging: vchiq: revert "switch to wait_for_completion_killable"
  2019-05-06 15:59     ` Nicolas Saenz Julienne
@ 2019-05-06 16:28       ` Stefan Wahren
  0 siblings, 0 replies; 10+ messages in thread
From: Stefan Wahren @ 2019-05-06 16:28 UTC (permalink / raw)
  To: Nicolas Saenz Julienne, Dan Carpenter
  Cc: devel, Greg Kroah-Hartman, phil, linux-kernel, Eric Anholt,
	linux-rpi-kernel, linux-arm-kernel

Hi Nicolas,

Am 06.05.19 um 17:59 schrieb Nicolas Saenz Julienne:
> Hi Dan, thanks for reviewing.
>
> On Mon, 2019-05-06 at 18:20 +0300, Dan Carpenter wrote:
>> On Mon, May 06, 2019 at 04:40:29PM +0200, Nicolas Saenz Julienne wrote:
>>> @@ -1740,7 +1740,8 @@ parse_rx_slots(struct vchiq_state *state)
>>>  					&service->bulk_rx : &service->bulk_tx;
>>>  
>>>  				DEBUG_TRACE(PARSE_LINE);
>>> -				if (mutex_lock_killable(&service->bulk_mutex)) {
>>> +				if (mutex_lock_killable(
>>> +					&service->bulk_mutex) != 0) {
>> This series does't add != 0 consistently...  Personally, I would prefer
>> we just leave it out.  I use != 0 for two things.  1)  When I'm talking
>> about the number zero.
>>
>> 	if (len == 0) {
>>
>> Or with strcmp():
>>
>> 	if (strcmp(a, b) == 0) { // a equals b
>> 	if (strcmp(a, b) < 0) {  // a less than b.
>>
>> But here zero means no errors, so I would just leave it out...
> I agree, I'll fix it.

i also agree with Dan, but this specific patch should revert the changes
of a772f116702e3f0afdd7e6acadc1b8fb3b20b9ff . So mentioned style issue
should be fixed in a separate patch.

Regards Stefan

>
> Regards,
> Nicolas
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel


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

* Re: [PATCH v2 0/3] staging: vchiq: use interruptible waits
  2019-05-06 14:40 [PATCH v2 0/3] staging: vchiq: use interruptible waits Nicolas Saenz Julienne
                   ` (2 preceding siblings ...)
  2019-05-06 14:40 ` [PATCH v2 3/3] staging: vchiq: make wait events interruptible Nicolas Saenz Julienne
@ 2019-05-06 18:12 ` Stefan Wahren
  2019-05-06 18:51   ` Nicolas Saenz Julienne
  3 siblings, 1 reply; 10+ messages in thread
From: Stefan Wahren @ 2019-05-06 18:12 UTC (permalink / raw)
  To: Nicolas Saenz Julienne, linux-kernel
  Cc: phil, dan.carpenter, linux-rpi-kernel, linux-arm-kernel, devel

Hi Nicolas,

Am 06.05.19 um 16:40 schrieb Nicolas Saenz Julienne:
> Hi,
> ...
>
> Regards,
> Nicolas
>
> [1] https://github.com/raspberrypi/linux/issues/2881
> [2] https://archlinuxarm.org/forum/viewtopic.php?f=65&t=13485
> [3] https://lists.fedoraproject.org/archives/list/arm@lists.fedoraproject.org/message/GBXGJ7DOV5CQQXFPOZCXTRD6W4BEPT4Q/
>
> --
>
> Changes since v1:
>   - Proplery format revert commits
>   - Add code comment to remind of this issue
>   - Add Fixes tags
>
> Nicolas Saenz Julienne (3):
>   staging: vchiq_2835_arm: revert "quit using custom
>     down_interruptible()"
>   staging: vchiq: revert "switch to wait_for_completion_killable"
>   staging: vchiq: make wait events interruptible
>
>  .../interface/vchiq_arm/vchiq_2835_arm.c      |  2 +-
>  .../interface/vchiq_arm/vchiq_arm.c           | 21 +++++++------
>  .../interface/vchiq_arm/vchiq_core.c          | 31 ++++++++++++-------
>  .../interface/vchiq_arm/vchiq_util.c          |  6 ++--
>  4 files changed, 35 insertions(+), 25 deletions(-)
>
against which tree should this series apply?

Since the merge window opened the current staging-linus wont be
available soon.

Stefan


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

* Re: [PATCH v2 0/3] staging: vchiq: use interruptible waits
  2019-05-06 18:12 ` [PATCH v2 0/3] staging: vchiq: use interruptible waits Stefan Wahren
@ 2019-05-06 18:51   ` Nicolas Saenz Julienne
  0 siblings, 0 replies; 10+ messages in thread
From: Nicolas Saenz Julienne @ 2019-05-06 18:51 UTC (permalink / raw)
  To: Stefan Wahren, linux-kernel
  Cc: phil, dan.carpenter, linux-rpi-kernel, linux-arm-kernel, devel

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

On Mon, 2019-05-06 at 20:12 +0200, Stefan Wahren wrote:
> Hi Nicolas,
> 
> Am 06.05.19 um 16:40 schrieb Nicolas Saenz Julienne:
> > Hi,
> > ...
> > 
> > Regards,
> > Nicolas
> > 
> > [1] https://github.com/raspberrypi/linux/issues/2881
> > [2] https://archlinuxarm.org/forum/viewtopic.php?f=65&t=13485
> > [3] 
> > 
https://lists.fedoraproject.org/archives/list/arm@lists.fedoraproject.org/message/GBXGJ7DOV5CQQXFPOZCXTRD6W4BEPT4Q/
> > 
> > --
> > 
> > Changes since v1:
> >   - Proplery format revert commits
> >   - Add code comment to remind of this issue
> >   - Add Fixes tags
> > 
> > Nicolas Saenz Julienne (3):
> >   staging: vchiq_2835_arm: revert "quit using custom
> >     down_interruptible()"
> >   staging: vchiq: revert "switch to wait_for_completion_killable"
> >   staging: vchiq: make wait events interruptible
> > 
> >  .../interface/vchiq_arm/vchiq_2835_arm.c      |  2 +-
> >  .../interface/vchiq_arm/vchiq_arm.c           | 21 +++++++------
> >  .../interface/vchiq_arm/vchiq_core.c          | 31 ++++++++++++-------
> >  .../interface/vchiq_arm/vchiq_util.c          |  6 ++--
> >  4 files changed, 35 insertions(+), 25 deletions(-)
> > 
> against which tree should this series apply?
> 
> Since the merge window opened the current staging-linus wont be
> available soon.

I don't know if that's what you meant, but I guess we should wait for 5.2-rc1
and then push it, the fixes will eventually get into the stable version of 5.1.


Regards,
Nicolas


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH v2 2/3] staging: vchiq: revert "switch to wait_for_completion_killable"
  2019-05-06 14:40 ` [PATCH v2 2/3] staging: vchiq: revert "switch to wait_for_completion_killable" Nicolas Saenz Julienne
  2019-05-06 15:20   ` Dan Carpenter
@ 2019-05-07  5:54   ` Dan Carpenter
  1 sibling, 0 replies; 10+ messages in thread
From: Dan Carpenter @ 2019-05-07  5:54 UTC (permalink / raw)
  To: Nicolas Saenz Julienne
  Cc: linux-kernel, stefan.wahren, devel, linux-arm-kernel,
	Greg Kroah-Hartman, phil, Eric Anholt, linux-rpi-kernel

On Mon, May 06, 2019 at 04:40:29PM +0200, Nicolas Saenz Julienne wrote:
> The killable version of wait_for_completion() is meant to be used on
> situations where it should not fail at all costs, but still have the
> convenience of being able to kill it if really necessary. VCHIQ doesn't
> fit this criteria, as it's mainly used as an interface to V4L2 and ALSA
> devices.
> 
> Fixes: a772f116702e ("staging: vchiq: switch to wait_for_completion_killable")
> Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
> 
> This reverts commit a772f116702e3f0afdd7e6acadc1b8fb3b20b9ff.
> ---

Git just sets you up for failure with its revert.  That code was from
when git was really new and now everyone gets annoyed when they see a
raw git hash without a human readable subject.  Just say at the start of
the commit message:

This reverts commit a772f116702e ("staging: vchiq: switch to
wait_for_completion_killable").

The killable version of wait_for_completion() is meant to be used on
situations where it should not fail at all costs, but still have the
convenience of being able to kill it if really necessary. VCHIQ doesn't
fit this criteria, as it's mainly used as an interface to V4L2 and ALSA
devices.

Fixes: a772f116702e ("staging: vchiq: switch to wait_for_completion_killable")

regards,
dan carpenter


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

end of thread, other threads:[~2019-05-07  5:54 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-06 14:40 [PATCH v2 0/3] staging: vchiq: use interruptible waits Nicolas Saenz Julienne
2019-05-06 14:40 ` [PATCH v2 1/3] staging: vchiq_2835_arm: revert "quit using custom down_interruptible()" Nicolas Saenz Julienne
2019-05-06 14:40 ` [PATCH v2 2/3] staging: vchiq: revert "switch to wait_for_completion_killable" Nicolas Saenz Julienne
2019-05-06 15:20   ` Dan Carpenter
2019-05-06 15:59     ` Nicolas Saenz Julienne
2019-05-06 16:28       ` Stefan Wahren
2019-05-07  5:54   ` Dan Carpenter
2019-05-06 14:40 ` [PATCH v2 3/3] staging: vchiq: make wait events interruptible Nicolas Saenz Julienne
2019-05-06 18:12 ` [PATCH v2 0/3] staging: vchiq: use interruptible waits Stefan Wahren
2019-05-06 18:51   ` Nicolas Saenz Julienne

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).