From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Jackson Subject: [OSSTEST PATCH 09/13] Planner: ms-queuedaemon: Synchronise thinking multiple walkers Date: Wed, 2 Sep 2015 16:45:15 +0100 Message-ID: <1441208719-31336-10-git-send-email-ian.jackson@eu.citrix.com> References: <1441208719-31336-1-git-send-email-ian.jackson@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1ZXAEz-0000a6-DB for xen-devel@lists.xenproject.org; Wed, 02 Sep 2015 15:46:25 +0000 In-Reply-To: <1441208719-31336-1-git-send-email-ian.jackson@eu.citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org Cc: Ian Jackson , Ian Campbell List-Id: xen-devel@lists.xenproject.org If multiple walkers want to ask the same chan, we want to serialise them. This is actually straightforward: Firstly, we arrrange that each walker finishing a thought will prompt _all_ walkers to reconsider whether they need to continue. Then we can simply do nothing if we want to a chan to think that another walker is already waiting for; since that other walker will prompt us later. Still no actual functional change because there is still only one walker. Signed-off-by: Ian Jackson --- ms-queuedaemon | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/ms-queuedaemon b/ms-queuedaemon index 53ac655..779ede0 100755 --- a/ms-queuedaemon +++ b/ms-queuedaemon @@ -216,6 +216,12 @@ proc runneeded-2-requeue {} { # $w/thinking_after timeout # all the $w/ are generally upvar'd by walker-globals +proc walkers-perhaps-queue-steps {} { + foreach-walker w { + after idle queuerun-perhaps-step $w + } +} + proc plan-reset {w} { exec ./ms-planner -w$w reset < /dev/null } @@ -226,7 +232,7 @@ proc queuerun-start {w} { log-event "$w queuerun-start" plan-reset $w set queue_running $queue - after idle queuerun-perhaps-step plan + walkers-perhaps-queue-steps } proc queuerun-perhaps-step {w} { @@ -247,7 +253,9 @@ proc queuerun-perhaps-step {w} { set next [lindex $queue_running 0] set already [we-are-thinking $next] if {[llength $already]} { - error "next $next thinking $already but also want $w" + # $already will wake us via walkers-perhaps-queue-steps + log-event "$w queuerun-perhaps-step already $already" + return } set thinking $next @@ -304,7 +312,7 @@ proc queuerun-step-done {w why} { unset thinking_after } unset thinking - after idle queuerun-perhaps-step $w + walkers-perhaps-queue-steps } proc queue-thoughts-timedout {w} { -- 1.7.10.4