lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 30 Nov 2006 20:14:23 -0800 (PST)
From:	David Miller <davem@...emloft.net>
To:	greearb@...delatech.com
Cc:	Robert.Olsson@...a.slu.se, adobriyan@...il.com,
	pavol.gono@...il.com, netdev@...r.kernel.org
Subject: Re: pktgen

From: Ben Greear <greearb@...delatech.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.
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ