mboxd_windows: Reset evicted windows

After copying a portion of the backing store to a window,
create_map_window() "resizes" the window to the aligned-up size reported
by copy_flash(). This allows use of the window size as the content size
elsewhere in the codebase.

However, if we needed to evict a window to satisfy a request, the window
properties were not reset. This lead to inefficient use of the reserved
memory by limiting the effective window size to the minimum size of all
requests that were previously allocated the window in question.

Inefficient use of reserved memory isn't the only side effect; the host
takes an eye-watering hit to throughput that gets exponentionally
worse over time:

From the petitboot shell without the patch applied:

    / # time cat /dev/mtd0 > /dev/null
    real    0m 49.77s
    user    0m 0.00s
    sys     0m 49.76s
    / # time cat /dev/mtd0 > /dev/null
    real    1m 33.57s
    user    0m 0.00s
    sys     1m 33.55s
    / # time cat /dev/mtd0 > /dev/null
    real    4m 45.37s
    user    0m 0.00s
    sys     4m 45.35s
    / # time cat /dev/mtd0 > /dev/null
    real    9m 17.77s
    user    0m 0.00s
    sys     9m 17.76s
    / #

And with the patch applied:

    / # time cat /dev/mtd0 > /dev/null
    real    0m 43.00s
    user    0m 0.00s
    sys     0m 42.99s
    / # time cat /dev/mtd0 > /dev/null
    real    0m 42.40s
    user    0m 0.00s
    sys     0m 42.39s
    / # time cat /dev/mtd0 > /dev/null
    real    0m 42.41s
    user    0m 0.00s
    sys     0m 42.39s
    / #

Reset the properties to allow use of the entire reserved memory region
allocated to the window, improving memory efficiency, throughput, and
minimising throughput variance.

Change-Id: I7be78ec5e0a9ee0caf31133b0861e333844b8975
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
diff --git a/mboxd_windows.c b/mboxd_windows.c
index 9742180..275f38a 100644
--- a/mboxd_windows.c
+++ b/mboxd_windows.c
@@ -568,6 +568,7 @@
 	if (!cur) {
 		MSG_DBG("No uninitialised window, evicting one\n");
 		cur = find_oldest_window(context);
+		reset_window(context, cur);
 	}
 
 /*
diff --git a/test/vpnor/Makefile.am.include b/test/vpnor/Makefile.am.include
index dac43c8..5f71697 100644
--- a/test/vpnor/Makefile.am.include
+++ b/test/vpnor/Makefile.am.include
@@ -318,5 +318,4 @@
 	%reldir%/create_read_window_remap
 
 XFAIL_TESTS += %reldir%/dump_flash
-XFAIL_TESTS += %reldir%/create_read_window_size
 endif