From: "Denis V. Lunev" <den@openvz.org>
To: akpm@linux-foundation.org
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
"Denis V. Lunev" <den@openvz.org>,
Patrick McHardy <kaber@trash.net>,
Robert Olsson <robert.olsson@its.uu.se>,
Ben Greear <greearb@candelatech.com>
Subject: [PATCH 2/4] pktgen: make sure that pktgen_thread_worker has been executed
Date: Tue, 20 May 2008 13:59:47 +0400 [thread overview]
Message-ID: <1211277589-8565-2-git-send-email-den@openvz.org> (raw)
In-Reply-To: <1211277589-8565-1-git-send-email-den@openvz.org>
The following courruption can happen during pktgen stop:
list_del corruption. prev->next should be ffff81007e8a5e70, but was 6b6b6b6b6b6b6b6b
kernel BUG at lib/list_debug.c:67!
:pktgen:pktgen_thread_worker+0x374/0x10b0
? autoremove_wake_function+0x0/0x40
? _spin_unlock_irqrestore+0x42/0x80
? :pktgen:pktgen_thread_worker+0x0/0x10b0
kthread+0x4d/0x80
child_rip+0xa/0x12
? restore_args+0x0/0x30
? kthread+0x0/0x80
? child_rip+0x0/0x12
RIP list_del+0x48/0x70
The problem is that pktgen_thread_worker can not be executed if kthread_stop
has been called too early. Insert a completion on the normal initialization
path to make sure that pktgen_thread_worker will gain the control for sure.
Signed-off-by: Denis V. Lunev <den@openvz.org>
Cc: Patrick McHardy <kaber@trash.net>
Cc: Robert Olsson <robert.olsson@its.uu.se>
Cc: Ben Greear <greearb@candelatech.com>
Acked-by: Alexey Dobriyan <adobriyan@openvz.org>
---
net/core/pktgen.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 8dca211..fdf5377 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -390,6 +390,7 @@ struct pktgen_thread {
int cpu;
wait_queue_head_t queue;
+ struct completion start_done;
};
#define REMOVE 1
@@ -3414,6 +3415,7 @@ static int pktgen_thread_worker(void *arg)
BUG_ON(smp_processor_id() != cpu);
init_waitqueue_head(&t->queue);
+ complete(&t->start_done);
pr_debug("pktgen: starting pktgen/%d: pid=%d\n", cpu, task_pid_nr(current));
@@ -3615,6 +3617,7 @@ static int __init pktgen_create_thread(int cpu)
INIT_LIST_HEAD(&t->if_list);
list_add_tail(&t->th_list, &pktgen_threads);
+ init_completion(&t->start_done);
p = kthread_create(pktgen_thread_worker, t, "kpktgend_%d", cpu);
if (IS_ERR(p)) {
@@ -3639,6 +3642,7 @@ static int __init pktgen_create_thread(int cpu)
}
wake_up_process(p);
+ wait_for_completion(&t->start_done);
return 0;
}
--
1.5.3.rc5
next prev parent reply other threads:[~2008-05-20 10:00 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-20 9:59 [PATCH 1/4] proc: proc_get_inode should get module only once Denis V. Lunev
2008-05-20 9:59 ` Denis V. Lunev [this message]
2008-05-20 18:30 ` [PATCH 2/4] pktgen: make sure that pktgen_thread_worker has been executed Robert Olsson
2008-05-20 18:43 ` Denis V. Lunev
2008-05-20 19:59 ` Robert Olsson
2008-05-20 22:12 ` David Miller
2008-05-20 9:59 ` [PATCH 3/4] modules: proper cleanup of kobject without CONFIG_SYSFS Denis V. Lunev
2008-05-22 9:20 ` Rusty Russell
2008-05-22 11:44 ` Denis V. Lunev
2008-05-23 1:51 ` Rusty Russell
2008-05-22 17:54 ` Greg KH
2008-05-23 1:34 ` Rusty Russell
2008-05-20 9:59 ` [PATCH 4/4] flock: remove unused fields from file_lock_operations Denis V. Lunev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1211277589-8565-2-git-send-email-den@openvz.org \
--to=den@openvz.org \
--cc=akpm@linux-foundation.org \
--cc=greearb@candelatech.com \
--cc=kaber@trash.net \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=robert.olsson@its.uu.se \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).