From: Luca Miccio <lucmic...@gmail.com>

The variable used to set the current way sized offset is wrongly
increased each time a bit range is used.
This means that if we have a discontinuous coloring configuration
we will end up wasting useful pages in the same offset.
Fix this issue and increase the offset factor only when all ranges
in the color bitmask have been evaluated.

Signed-off-by: Luca Miccio <lucmic...@gmail.com>
Reported-by: Carlo Nonato <carlo.nonat...@gmail.com>
Signed-off-by: Andrea Bastoni <andrea.bast...@tum.de>
---
 hypervisor/arch/arm64/coloring.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hypervisor/arch/arm64/coloring.c b/hypervisor/arch/arm64/coloring.c
index ea59e292..123e191b 100644
--- a/hypervisor/arch/arm64/coloring.c
+++ b/hypervisor/arch/arm64/coloring.c
@@ -167,7 +167,6 @@ int color_cell_op(struct cell *cell,
                        mr.virt_start = virt_start;
                        /* update next round */
                        virt_start += mr.size;
-                       n++;
 #if 0
                        col_print("V: 0x%08llx -> P: 0x%08llx (size = 
0x%08llx)\n",
                                        mr.virt_start, mr.phys_start,
@@ -177,6 +176,7 @@ int color_cell_op(struct cell *cell,
                        if (err)
                                return err;
                }
+               n++;
        }
 
        col_print("Result: %d\n", err);
-- 
2.29.2

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jailhouse-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jailhouse-dev/20210125120044.56794-17-andrea.bastoni%40tum.de.

Reply via email to