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] [day] [month] [year] [list]
Message-ID: <20070109155504.GA183@tv-sign.ru>
Date:	Tue, 9 Jan 2007 18:55:04 +0300
From:	Oleg Nesterov <oleg@...sign.ru>
To:	Srivatsa Vaddagiri <vatsa@...ibm.com>
Cc:	Andrew Morton <akpm@...l.org>, Ingo Molnar <mingo@...e.hu>,
	David Howells <dhowells@...hat.com>,
	Christoph Hellwig <hch@...radead.org>,
	Gautham R Shenoy <ego@...ibm.com>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] reimplement flush_workqueue()

On 01/09, Srivatsa Vaddagiri wrote:
>
> On Fri, Dec 29, 2006 at 08:18:27PM +0300, Oleg Nesterov wrote:
> > Remove ->remove_sequence, ->insert_sequence, and ->work_done from struct
> > cpu_workqueue_struct. To implement flush_workqueue() we can queue a barrier
> > work on each CPU and wait for its completition.
> 
> Oleg,
> 	Because of this change, was curious to know if this is possible:
> 
> 
> CPU0					CPU1
> (Thread0)
> 
> flush_workqueue()
> 					queue_work(W1)	
>   flush_cpu_workqueue(cpu1)
>     insert_barrier(B1)
>       wait_on_completion();
> 	
> 					run_workqueue()
> 					   W1.func();
> 					     flush_workqueue();
> 						B1.func(); <- wakes Thread0
> 
> The intention of barrier B1 was to wait untill W1 was -complete-. If
> W1.func()->....->something() were to call flush_workqueue on the same
> workqueue, then we would be returning from the barrier prematurely.

But there is nothing new?

insert_sequence = remove_sequence = 0.

queue_work(W1) sets insert_sequence = 1.

flush_cpu_workqueue(cpu1):  wait until remove_sequence >= 1

Now suppose antother thread adds a work to cpu1 before W1.func()
calls flush_cpu_workqueue(cpu1). insert_sequence == 2.

When W1.func() does flush_workqueue(), run_workqueue() fires
that work, increments remove_sequence to 1 and wakes up Thread0.

In other words: currently flush_cpu_workqueue() waits until N
works form the queue will be flushed. If some work also does
flush_workqueue()->run_workqueue(), it just needs to execute one
"extra" work to confuse the first flush_cpu_workqueue().

Oleg.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ