From: Eric Dumazet <hidden> Date: 2016-10-29 17:43:06
On Sat, 2016-10-29 at 19:06 +0200, Andrey Konovalov wrote:
Hi Cong,
Tested with your patch, still getting a warning, though it's a little different:
------------[ cut here ]------------
WARNING: CPU: 1 PID: 3876 at kernel/sched/core.c:7724
__might_sleep+0x14c/0x1a0 kernel/sched/core.c:7719
do not call blocking ops when !TASK_RUNNING; state=1 set at
[<ffffffff811f5a5c>] prepare_to_wait+0xbc/0x210
kernel/sched/wait.c:178
Modules linked in:
This looks like the following patch is needed, can you test it ?
Thanks !
Hi Eric,
Tested with both patches applied, still seeing the warning.
Thanks!
On Sat, Oct 29, 2016 at 7:43 PM, Eric Dumazet [off-list ref] wrote:
quoted hunk
On Sat, 2016-10-29 at 19:06 +0200, Andrey Konovalov wrote:
quoted
Hi Cong,
Tested with your patch, still getting a warning, though it's a little different:
------------[ cut here ]------------
WARNING: CPU: 1 PID: 3876 at kernel/sched/core.c:7724
__might_sleep+0x14c/0x1a0 kernel/sched/core.c:7719
do not call blocking ops when !TASK_RUNNING; state=1 set at
[<ffffffff811f5a5c>] prepare_to_wait+0xbc/0x210
kernel/sched/wait.c:178
Modules linked in:
This looks like the following patch is needed, can you test it ?
Thanks !
@@ -224,6 +224,11 @@ static int dccp_wait_for_ccid(struct sock *sk, unsigned long delay)prepare_to_wait(sk_sleep(sk),&wait,TASK_INTERRUPTIBLE);sk->sk_write_pending++;++/* release_sock()/lock_sock() will process socket backlog+*fromprocesscontext.Bepreparedtosleep!+*/+sched_annotate_sleep();release_sock(sk);remaining=schedule_timeout(delay);
Sorry, the warning is still there.
I'm not sure adding sched_annotate_sleep() does anything, since it's
defined as (in case CONFIG_DEBUG_ATOMIC_SLEEP is not set):
# define sched_annotate_sleep() do { } while (0)
On Sat, Oct 29, 2016 at 8:05 PM, Eric Dumazet [off-list ref] wrote:
quoted hunk
On Sat, 2016-10-29 at 19:59 +0200, Andrey Konovalov wrote:
quoted
Hi Eric,
Tested with both patches applied, still seeing the warning.
Thanks!
Arg, sorry, this was at the wrong place.
Thanks for testing !
@@ -224,6 +224,11 @@ static int dccp_wait_for_ccid(struct sock *sk, unsigned long delay)prepare_to_wait(sk_sleep(sk),&wait,TASK_INTERRUPTIBLE);sk->sk_write_pending++;++/* release_sock()/lock_sock() will process socket backlog+*fromprocesscontext.Bepreparedtosleep!+*/+sched_annotate_sleep();release_sock(sk);remaining=schedule_timeout(delay);
From: Eric Dumazet <hidden> Date: 2016-10-30 13:20:08
On Sun, 2016-10-30 at 05:41 +0100, Andrey Konovalov wrote:
Sorry, the warning is still there.
I'm not sure adding sched_annotate_sleep() does anything, since it's
defined as (in case CONFIG_DEBUG_ATOMIC_SLEEP is not set):
# define sched_annotate_sleep() do { } while (0)
Thanks again for testing.
But you do have CONFIG_DEBUG_ATOMIC_SLEEP set, which triggers a check in
__might_sleep() :
WARN_ONCE(current->state != TASK_RUNNING && current->task_state_change,
Relevant commit is 00845eb968ead28007338b2bb852b8beef816583
("sched: don't cause task state changes in nested sleep debugging")
Another relevant commit was 26cabd31259ba43f68026ce3f62b78094124333f
("sched, net: Clean up sk_wait_event() vs. might_sleep()")
Before release_sock() could process the backlog in process context, only
lock_sock() could trigger the issue, so my fix at that time was commit
cb7cf8a33ff73cf638481d1edf883d8968f934f8 ("inet: Clean up
inet_csk_wait_for_connect() vs. might_sleep()")
I guess we need something else now, because the following :
static int dccp_wait_for_ccid(struct sock *sk, unsigned long delay)
{
DEFINE_WAIT(wait);
long remaining;
prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);
sk->sk_write_pending++;
release_sock(sk);
...
can now process the socket backlog in process context from
release_sock(), so all GFP_KERNEL allocations might barf because of
TASK_INTERRUPTIBLE being used at that point.
sk_wait_event() probably also needs a fix.
Peter, any idea how this can be done ?
Thanks !
From: Cong Wang <hidden> Date: 2016-10-31 18:01:24
On Sun, Oct 30, 2016 at 6:20 AM, Eric Dumazet [off-list ref] wrote:
On Sun, 2016-10-30 at 05:41 +0100, Andrey Konovalov wrote:
quoted
Sorry, the warning is still there.
I'm not sure adding sched_annotate_sleep() does anything, since it's
defined as (in case CONFIG_DEBUG_ATOMIC_SLEEP is not set):
# define sched_annotate_sleep() do { } while (0)
Thanks again for testing.
But you do have CONFIG_DEBUG_ATOMIC_SLEEP set, which triggers a check in
__might_sleep() :
WARN_ONCE(current->state != TASK_RUNNING && current->task_state_change,
Relevant commit is 00845eb968ead28007338b2bb852b8beef816583
("sched: don't cause task state changes in nested sleep debugging")
Another relevant commit was 26cabd31259ba43f68026ce3f62b78094124333f
("sched, net: Clean up sk_wait_event() vs. might_sleep()")
Before release_sock() could process the backlog in process context, only
lock_sock() could trigger the issue, so my fix at that time was commit
cb7cf8a33ff73cf638481d1edf883d8968f934f8 ("inet: Clean up
inet_csk_wait_for_connect() vs. might_sleep()")
Thanks for the context, but isn't the original warning reported by Andrey is
from inet_wait_for_connect()? You seem only patch some dccp function
which is why it is still there?
It should be the following, no?
From: Eric Dumazet <hidden> Date: 2016-10-31 18:40:21
On Mon, 2016-10-31 at 11:00 -0700, Cong Wang wrote:
quoted hunk
On Sun, Oct 30, 2016 at 6:20 AM, Eric Dumazet [off-list ref] wrote:
quoted
On Sun, 2016-10-30 at 05:41 +0100, Andrey Konovalov wrote:
quoted
Sorry, the warning is still there.
I'm not sure adding sched_annotate_sleep() does anything, since it's
defined as (in case CONFIG_DEBUG_ATOMIC_SLEEP is not set):
# define sched_annotate_sleep() do { } while (0)
Thanks again for testing.
But you do have CONFIG_DEBUG_ATOMIC_SLEEP set, which triggers a check in
__might_sleep() :
WARN_ONCE(current->state != TASK_RUNNING && current->task_state_change,
Relevant commit is 00845eb968ead28007338b2bb852b8beef816583
("sched: don't cause task state changes in nested sleep debugging")
Another relevant commit was 26cabd31259ba43f68026ce3f62b78094124333f
("sched, net: Clean up sk_wait_event() vs. might_sleep()")
Before release_sock() could process the backlog in process context, only
lock_sock() could trigger the issue, so my fix at that time was commit
cb7cf8a33ff73cf638481d1edf883d8968f934f8 ("inet: Clean up
inet_csk_wait_for_connect() vs. might_sleep()")
Thanks for the context, but isn't the original warning reported by Andrey is
from inet_wait_for_connect()? You seem only patch some dccp function
which is why it is still there?
It should be the following, no?
Hi Cong,
Yes, your patches fix the warnings.
Tested-by: Andrey Konovalov <redacted>
Thanks!
On Mon, Oct 31, 2016 at 7:40 PM, Eric Dumazet [off-list ref] wrote:
On Mon, 2016-10-31 at 11:00 -0700, Cong Wang wrote:
quoted
On Sun, Oct 30, 2016 at 6:20 AM, Eric Dumazet [off-list ref] wrote:
quoted
On Sun, 2016-10-30 at 05:41 +0100, Andrey Konovalov wrote:
quoted
Sorry, the warning is still there.
I'm not sure adding sched_annotate_sleep() does anything, since it's
defined as (in case CONFIG_DEBUG_ATOMIC_SLEEP is not set):
# define sched_annotate_sleep() do { } while (0)
Thanks again for testing.
But you do have CONFIG_DEBUG_ATOMIC_SLEEP set, which triggers a check in
__might_sleep() :
WARN_ONCE(current->state != TASK_RUNNING && current->task_state_change,
Relevant commit is 00845eb968ead28007338b2bb852b8beef816583
("sched: don't cause task state changes in nested sleep debugging")
Another relevant commit was 26cabd31259ba43f68026ce3f62b78094124333f
("sched, net: Clean up sk_wait_event() vs. might_sleep()")
Before release_sock() could process the backlog in process context, only
lock_sock() could trigger the issue, so my fix at that time was commit
cb7cf8a33ff73cf638481d1edf883d8968f934f8 ("inet: Clean up
inet_csk_wait_for_connect() vs. might_sleep()")
Thanks for the context, but isn't the original warning reported by Andrey is
from inet_wait_for_connect()? You seem only patch some dccp function
which is why it is still there?
It should be the following, no?