]> xenbits.xensource.com Git - osstest.git/commitdiff
plan_search: Track last sharing state to determine $share_reuse
authorIan Jackson <ian.jackson@eu.citrix.com>
Wed, 8 Nov 2017 16:29:07 +0000 (16:29 +0000)
committerIan Jackson <iwj@xenproject.org>
Fri, 2 Oct 2020 15:49:13 +0000 (16:49 +0100)
What matters for the purpose of $share_reuse is not whether the host
is actually being _shared_ (ie, there are other concurrent allocations
and therefore a concurrent Event with Share information).  What we
really want to know is whether the *last* use of this host was a
suitable sharing setup - because we actually want to know if we will
be able to skip our setup.

So track that explicitly.  (The slightly odd structure, where there
are two loops in one, means that we reset $last_eshare when we go onto
the next $req ie the next host to check.)

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Osstest/Executive.pm

index 4083ae6b7956fa0cb4f37b33b7e51cb6166c5178..5f59c44e236991510696b0ae147507d556c040fd 100644 (file)
@@ -676,6 +676,7 @@ sub plan_search ($$$$) {
     my $try_time= 0;
     my $confirmedok= 0;
     my $share_reuse= 0;
+    my $last_eshare;
 
     for (;;) {
        my $req= $requestlist->[$reqix];
@@ -715,6 +716,10 @@ sub plan_search ($$$$) {
             # this period is entirely after the proposed slot;
             # so no need to check this or any later periods
 
+           $last_eshare = $startevt->{
+                $startevt->{Type} eq 'Unshare' ? 'PreviousShare' : 'Share'
+                                     };
+
            next PERIOD if $endevt->{Time} <= $try_time;
             # this period is entirely before the proposed slot;
             # it doesn't overlap, but must check subsequent periods
@@ -743,9 +748,10 @@ sub plan_search ($$$$) {
            " try=$try_time confirmed=$confirmedok reuse=$share_reuse");
 
        $confirmedok++;
-       $share_reuse++ if defined $share_wear;
+       $share_reuse++ if $last_eshare and $share_compat_ok->($last_eshare);
        $reqix++;
        $reqix %= @$requestlist;
+       undef $last_eshare;
        last if $confirmedok==@$requestlist;
     }