* [PATCH] tun: fix blocking read
@ 2019-02-23 11:53 Timur Celik
2019-02-25 6:12 ` David Miller
0 siblings, 1 reply; 8+ messages in thread
From: Timur Celik @ 2019-02-23 11:53 UTC (permalink / raw)
To: davem; +Cc: netdev, linux-kernel, Timur Celik
This patch moves setting of the current state into the loop. Otherwise
the task may end up in a busy wait loop if none of the break conditions
are met.
Signed-off-by: Timur Celik <mail@timurcelik.de>
---
drivers/net/tun.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index fed298c0cb39..d291762b9e9d 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -2167,9 +2167,9 @@ static void *tun_ring_recv(struct tun_file *tfile, int noblock, int *err)
}
add_wait_queue(&tfile->wq.wait, &wait);
- current->state = TASK_INTERRUPTIBLE;
while (1) {
+ set_current_state(TASK_INTERRUPTIBLE);
ptr = ptr_ring_consume(&tfile->tx_ring);
if (ptr)
break;
@@ -2185,7 +2185,7 @@ static void *tun_ring_recv(struct tun_file *tfile, int noblock, int *err)
schedule();
}
- current->state = TASK_RUNNING;
+ set_current_state(TASK_RUNNING);
remove_wait_queue(&tfile->wq.wait, &wait);
out:
--
2.20.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] tun: fix blocking read
2019-02-23 11:53 [PATCH] tun: fix blocking read Timur Celik
@ 2019-02-25 6:12 ` David Miller
2019-02-25 15:53 ` Eric Dumazet
0 siblings, 1 reply; 8+ messages in thread
From: David Miller @ 2019-02-25 6:12 UTC (permalink / raw)
To: mail; +Cc: netdev, linux-kernel
From: Timur Celik <mail@timurcelik.de>
Date: Sat, 23 Feb 2019 12:53:13 +0100
> This patch moves setting of the current state into the loop. Otherwise
> the task may end up in a busy wait loop if none of the break conditions
> are met.
>
> Signed-off-by: Timur Celik <mail@timurcelik.de>
Applied and queued up for -stable, thanks.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] tun: fix blocking read
2019-02-25 6:12 ` David Miller
@ 2019-02-25 15:53 ` Eric Dumazet
2019-02-25 18:25 ` David Miller
0 siblings, 1 reply; 8+ messages in thread
From: Eric Dumazet @ 2019-02-25 15:53 UTC (permalink / raw)
To: David Miller, mail; +Cc: netdev, linux-kernel
On 02/24/2019 10:12 PM, David Miller wrote:
> From: Timur Celik <mail@timurcelik.de>
> Date: Sat, 23 Feb 2019 12:53:13 +0100
>
>> This patch moves setting of the current state into the loop. Otherwise
>> the task may end up in a busy wait loop if none of the break conditions
>> are met.
>>
>> Signed-off-by: Timur Celik <mail@timurcelik.de>
>
> Applied and queued up for -stable, thanks.
>
First part of the patch was matching the changelog, however
the second change was not really needed, or should have used
__set_current_state(TASK_RUNNING);
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] tun: fix blocking read
2019-02-25 15:53 ` Eric Dumazet
@ 2019-02-25 18:25 ` David Miller
2019-02-25 20:12 ` Timur Celik
2019-02-25 20:13 ` [PATCH] tun: remove unnecessary memory barrier Timur Celik
0 siblings, 2 replies; 8+ messages in thread
From: David Miller @ 2019-02-25 18:25 UTC (permalink / raw)
To: eric.dumazet; +Cc: mail, netdev, linux-kernel
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Mon, 25 Feb 2019 07:53:08 -0800
>
>
> On 02/24/2019 10:12 PM, David Miller wrote:
>> From: Timur Celik <mail@timurcelik.de>
>> Date: Sat, 23 Feb 2019 12:53:13 +0100
>>
>>> This patch moves setting of the current state into the loop. Otherwise
>>> the task may end up in a busy wait loop if none of the break conditions
>>> are met.
>>>
>>> Signed-off-by: Timur Celik <mail@timurcelik.de>
>>
>> Applied and queued up for -stable, thanks.
>>
>
> First part of the patch was matching the changelog, however
> the second change was not really needed, or should have used
>
> __set_current_state(TASK_RUNNING);
Timur, please followup.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] tun: fix blocking read
2019-02-25 18:25 ` David Miller
@ 2019-02-25 20:12 ` Timur Celik
2019-02-25 20:13 ` [PATCH] tun: remove unnecessary memory barrier Timur Celik
1 sibling, 0 replies; 8+ messages in thread
From: Timur Celik @ 2019-02-25 20:12 UTC (permalink / raw)
To: David Miller; +Cc: eric.dumazet, netdev, linux-kernel
On Mon, Feb 25, 2019 at 10:25:48AM -0800, David Miller wrote:
> From: Eric Dumazet <eric.dumazet@gmail.com>
> Date: Mon, 25 Feb 2019 07:53:08 -0800
>
>>
>>
>> On 02/24/2019 10:12 PM, David Miller wrote:
>>> From: Timur Celik <mail@timurcelik.de>
>>> Date: Sat, 23 Feb 2019 12:53:13 +0100
>>>
>>>> This patch moves setting of the current state into the loop. Otherwise
>>>> the task may end up in a busy wait loop if none of the break conditions
>>>> are met.
>>>>
>>>> Signed-off-by: Timur Celik <mail@timurcelik.de>
>>>
>>> Applied and queued up for -stable, thanks.
>>>
>>
>> First part of the patch was matching the changelog, however
>> the second change was not really needed, or should have used
>>
>> __set_current_state(TASK_RUNNING);
>
> Timur, please followup.
Thanks for taking a look at this. Eric is right of course.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH] tun: remove unnecessary memory barrier
2019-02-25 18:25 ` David Miller
2019-02-25 20:12 ` Timur Celik
@ 2019-02-25 20:13 ` Timur Celik
2019-02-25 20:15 ` Eric Dumazet
2019-02-25 22:28 ` David Miller
1 sibling, 2 replies; 8+ messages in thread
From: Timur Celik @ 2019-02-25 20:13 UTC (permalink / raw)
To: David Miller; +Cc: eric.dumazet, netdev, linux-kernel
Replace set_current_state with __set_current_state since no memory
barrier is needed at this point.
Signed-off-by: Timur Celik <mail@timurcelik.de>
---
drivers/net/tun.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index d291762b9e9d..53f4f37b0ffd 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -2185,7 +2185,7 @@ static void *tun_ring_recv(struct tun_file *tfile, int noblock, int *err)
schedule();
}
- set_current_state(TASK_RUNNING);
+ __set_current_state(TASK_RUNNING);
remove_wait_queue(&tfile->wq.wait, &wait);
out:
--
2.20.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] tun: remove unnecessary memory barrier
2019-02-25 20:13 ` [PATCH] tun: remove unnecessary memory barrier Timur Celik
@ 2019-02-25 20:15 ` Eric Dumazet
2019-02-25 22:28 ` David Miller
1 sibling, 0 replies; 8+ messages in thread
From: Eric Dumazet @ 2019-02-25 20:15 UTC (permalink / raw)
To: Timur Celik, David Miller; +Cc: netdev, linux-kernel
On 02/25/2019 12:13 PM, Timur Celik wrote:
> Replace set_current_state with __set_current_state since no memory
> barrier is needed at this point.
>
> Signed-off-by: Timur Celik <mail@timurcelik.de>
> ---
> drivers/net/tun.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
SGTM, thanks.
Reviewed-by: Eric Dumazet <edumazet@google.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] tun: remove unnecessary memory barrier
2019-02-25 20:13 ` [PATCH] tun: remove unnecessary memory barrier Timur Celik
2019-02-25 20:15 ` Eric Dumazet
@ 2019-02-25 22:28 ` David Miller
1 sibling, 0 replies; 8+ messages in thread
From: David Miller @ 2019-02-25 22:28 UTC (permalink / raw)
To: mail; +Cc: eric.dumazet, netdev, linux-kernel
From: Timur Celik <mail@timurcelik.de>
Date: Mon, 25 Feb 2019 21:13:13 +0100
> Replace set_current_state with __set_current_state since no memory
> barrier is needed at this point.
>
> Signed-off-by: Timur Celik <mail@timurcelik.de>
Applied, thanks.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2019-02-25 22:28 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-23 11:53 [PATCH] tun: fix blocking read Timur Celik
2019-02-25 6:12 ` David Miller
2019-02-25 15:53 ` Eric Dumazet
2019-02-25 18:25 ` David Miller
2019-02-25 20:12 ` Timur Celik
2019-02-25 20:13 ` [PATCH] tun: remove unnecessary memory barrier Timur Celik
2019-02-25 20:15 ` Eric Dumazet
2019-02-25 22:28 ` David Miller
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).