From: David Miller <davem@davemloft.net>
To: greearb@candelatech.com
Cc: Robert.Olsson@data.slu.se, adobriyan@gmail.com,
pavol.gono@gmail.com, netdev@vger.kernel.org
Subject: Re: pktgen
Date: Thu, 30 Nov 2006 20:14:23 -0800 (PST) [thread overview]
Message-ID: <20061130.201423.118625277.davem@davemloft.net> (raw)
In-Reply-To: <456F15F7.3000700@candelatech.com>
From: Ben Greear <greearb@candelatech.com>
Date: Thu, 30 Nov 2006 09:33:43 -0800
> Robert Olsson wrote:
> > @@ -3673,6 +3673,8 @@ static void __exit pg_cleanup(void)
> > struct list_head *q, *n;
> > wait_queue_head_t queue;
> > init_waitqueue_head(&queue);
> > +
> > + schedule_timeout_interruptible(msecs_to_jiffies(125));
> >
> > /* Stop all interfaces & threads */
> >
>
> That strikes me as a hack..surely there is a better method than just adding
> a sleep??
Agreed.
Robert, please fix this by using a completion so that we can
wait for the threads to start up, something like this:
...
#include <linux/completion.h>
...
struct pktgen_thread_info {
struct pktgen_thread *t;
struct completion *c;
};
static void pktgen_thread_worker(struct pktgen_thread_info *info)
{
struct pktgen_thread *t = info->t;
...
__set_current_state(TASK_INTERRUPTIBLE);
mb();
complete(info->c);
...
}
static int __init pktgen_create_thread(const char *name, int cpu)
{
...
struct pktgen_thread_info info;
struct complation started;
...
init_completion(&started);
info.t = t;
info.c = &started;
err = kernel_thread((void *)pktgen_thread_worker, (void *)t,
CLONE_FS | CLONE_FILES | CLONE_SIGHAND);
if (err < 0) {
printk("pktgen: kernel_thread() failed for cpu %d\n", t->cpu);
remove_proc_entry(t->name, pg_proc_dir);
list_del(&t->th_list);
kfree(t);
return err;
}
wait_for_completion(&started);
return 0;
}
We can horse around with fixing the initial t->control bit flipping
in pktgen_thread_worker() in a future changeset if we want.
next prev parent reply other threads:[~2006-12-01 4:14 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20061121174737.GA5220@martell.zuzino.mipt.ru>
[not found] ` <9fa31860611211236i104cb510mb5100ea056b657db@mail.gmail.com>
2006-11-21 21:22 ` pktgen (was Re: tests of kernel modules) Alexey Dobriyan
2006-11-28 23:33 ` pktgen David Miller
2006-11-29 20:04 ` pktgen Alexey Dobriyan
2006-11-30 1:49 ` pktgen David Miller
2006-11-30 7:30 ` pktgen Alexey Dobriyan
2006-11-30 8:45 ` pktgen Robert Olsson
2006-11-30 17:33 ` pktgen Ben Greear
2006-12-01 4:14 ` David Miller [this message]
2006-12-01 8:14 ` pktgen Robert Olsson
2006-12-01 9:51 ` pktgen Alexey Dobriyan
2006-12-01 17:18 ` pktgen Robert Olsson
2006-12-01 23:25 ` pktgen David Miller
2007-01-02 4:53 ` pktgen David Miller
2006-12-01 8:22 ` pktgen Christoph Hellwig
2006-12-01 23:17 ` pktgen David Miller
[not found] <20041110165318.GA19639@xi.wantstofly.org>
[not found] ` <20041111233507.GA3202@xi.wantstofly.org>
[not found] ` <20041124161848.GA18059@xi.wantstofly.org>
[not found] ` <16804.48120.375307.718766@robur.slu.se>
[not found] ` <20041124170948.GC18059@xi.wantstofly.org>
[not found] ` <16804.60621.990421.525393@robur.slu.se>
[not found] ` <20041125030450.GA24417@xi.wantstofly.org>
[not found] ` <16805.40983.937641.670275@robur.slu.se>
[not found] ` <20041127002841.GA17184@xi.wantstofly.org>
[not found] ` <20041127004325.GA17401@xi.wantstofly.org>
2004-11-27 12:04 ` pktgen Robert Olsson
2004-11-27 13:53 ` pktgen Lennert Buytenhek
2004-11-27 14:39 ` pktgen Lennert Buytenhek
2004-11-27 15:04 ` pktgen jamal
2004-11-28 18:31 ` pktgen Lennert Buytenhek
2004-11-29 13:49 ` pktgen jamal
2004-11-29 16:57 ` pktgen Grant Grundler
2004-11-29 15:27 ` pktgen Robert Olsson
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=20061130.201423.118625277.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=Robert.Olsson@data.slu.se \
--cc=adobriyan@gmail.com \
--cc=greearb@candelatech.com \
--cc=netdev@vger.kernel.org \
--cc=pavol.gono@gmail.com \
/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).