* [PATCH 0/2] i386/a-b-bootblock: zero the first byte of each page on start
@ 2023-09-07 19:29 Daniil Tatianin
2023-09-07 19:29 ` [PATCH 1/2] i386/a-b-bootblock: factor test memory addresses out into constants Daniil Tatianin
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Daniil Tatianin @ 2023-09-07 19:29 UTC (permalink / raw)
To: Juan Quintela
Cc: Daniil Tatianin, Peter Xu, Leonardo Bras, qemu-devel, yc-core
This series fixes an issue where the outcome of the migration qtest
relies on the initial memory contents all being the same across the
first 100MiB of RAM, which is a very fragile invariant.
We fix this by making sure we zero the first byte of every testable page
in range beforehand.
Daniil Tatianin (2):
i386/a-b-bootblock: factor test memory addresses out into constants
i386/a-b-bootblock: zero the first byte of each page on start
tests/migration/i386/a-b-bootblock.S | 18 +++++++++++++++---
tests/migration/i386/a-b-bootblock.h | 16 ++++++++--------
2 files changed, 23 insertions(+), 11 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/2] i386/a-b-bootblock: factor test memory addresses out into constants
2023-09-07 19:29 [PATCH 0/2] i386/a-b-bootblock: zero the first byte of each page on start Daniil Tatianin
@ 2023-09-07 19:29 ` Daniil Tatianin
2023-09-26 20:31 ` Vladimir Sementsov-Ogievskiy
2023-09-07 19:29 ` [PATCH 2/2] i386/a-b-bootblock: zero the first byte of each page on start Daniil Tatianin
2023-09-26 21:01 ` [PATCH 0/2] " Peter Xu
2 siblings, 1 reply; 7+ messages in thread
From: Daniil Tatianin @ 2023-09-07 19:29 UTC (permalink / raw)
To: Juan Quintela
Cc: Daniil Tatianin, Peter Xu, Leonardo Bras, qemu-devel, yc-core
So that we have less magic numbers to deal with. This also allows us to
reuse these in the following commits.
Signed-off-by: Daniil Tatianin <d-tatianin@yandex-team.ru>
---
tests/migration/i386/a-b-bootblock.S | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/tests/migration/i386/a-b-bootblock.S b/tests/migration/i386/a-b-bootblock.S
index 3d464c7568..036216e4a7 100644
--- a/tests/migration/i386/a-b-bootblock.S
+++ b/tests/migration/i386/a-b-bootblock.S
@@ -34,6 +34,10 @@ start: # at 0x7c00 ?
mov $16,%eax
mov %eax,%ds
+# Start from 1MB
+.set TEST_MEM_START, (1024*1024)
+.set TEST_MEM_END, (100*1024*1024)
+
mov $65,%ax
mov $0x3f8,%dx
outb %al,%dx
@@ -41,12 +45,11 @@ start: # at 0x7c00 ?
# bl keeps a counter so we limit the output speed
mov $0, %bl
mainloop:
- # Start from 1MB
- mov $(1024*1024),%eax
+ mov $TEST_MEM_START,%eax
innerloop:
incb (%eax)
add $4096,%eax
- cmp $(100*1024*1024),%eax
+ cmp $TEST_MEM_END,%eax
jl innerloop
inc %bl
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/2] i386/a-b-bootblock: zero the first byte of each page on start
2023-09-07 19:29 [PATCH 0/2] i386/a-b-bootblock: zero the first byte of each page on start Daniil Tatianin
2023-09-07 19:29 ` [PATCH 1/2] i386/a-b-bootblock: factor test memory addresses out into constants Daniil Tatianin
@ 2023-09-07 19:29 ` Daniil Tatianin
2023-09-26 20:41 ` Vladimir Sementsov-Ogievskiy
2023-09-26 21:01 ` [PATCH 0/2] " Peter Xu
2 siblings, 1 reply; 7+ messages in thread
From: Daniil Tatianin @ 2023-09-07 19:29 UTC (permalink / raw)
To: Juan Quintela
Cc: Daniil Tatianin, Peter Xu, Leonardo Bras, qemu-devel, yc-core
The migration qtest all the way up to this point used to work by sheer
luck relying on the contents of all pages from 1MiB to 100MiB to contain
the same one value in the first byte initially.
This easily breaks if we reduce the amount of RAM for the test instances
from 150MiB to e.g 110MiB since that makes SeaBIOS dirty some of the
pages starting at about 0x5dd2000 (~93 MiB) as it reuses those for the
HighMemory allocator since commit dc88f9b72df ("malloc: use large
ZoneHigh when there is enough memory").
This would result in the following errors:
12/60 qemu:qtest+qtest-x86_64 / qtest-x86_64/migration-test ERROR 2.74s killed by signal 6 SIGABRT
stderr:
Memory content inconsistency at 5dd2000 first_byte = cc last_byte = cb current = 9e hit_edge = 1
Memory content inconsistency at 5dd3000 first_byte = cc last_byte = cb current = 89 hit_edge = 1
Memory content inconsistency at 5dd4000 first_byte = cc last_byte = cb current = 23 hit_edge = 1
Memory content inconsistency at 5dd5000 first_byte = cc last_byte = cb current = 31 hit_edge = 1
Memory content inconsistency at 5dd6000 first_byte = cc last_byte = cb current = 70 hit_edge = 1
Memory content inconsistency at 5dd7000 first_byte = cc last_byte = cb current = ff hit_edge = 1
Memory content inconsistency at 5dd8000 first_byte = cc last_byte = cb current = 54 hit_edge = 1
Memory content inconsistency at 5dd9000 first_byte = cc last_byte = cb current = 64 hit_edge = 1
Memory content inconsistency at 5dda000 first_byte = cc last_byte = cb current = 1d hit_edge = 1
Memory content inconsistency at 5ddb000 first_byte = cc last_byte = cb current = 1a hit_edge = 1
and in another 26 pages**
ERROR:../tests/qtest/migration-test.c:300:check_guests_ram: assertion failed: (bad == 0)
Fix this by always zeroing the first byte of each page in the range so
that we get consistent results no matter the initial contents.
Fixes: ea0c6d62391 ("test: Postcopy")
Signed-off-by: Daniil Tatianin <d-tatianin@yandex-team.ru>
---
tests/migration/i386/a-b-bootblock.S | 9 +++++++++
tests/migration/i386/a-b-bootblock.h | 16 ++++++++--------
2 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/tests/migration/i386/a-b-bootblock.S b/tests/migration/i386/a-b-bootblock.S
index 036216e4a7..6bb9999d60 100644
--- a/tests/migration/i386/a-b-bootblock.S
+++ b/tests/migration/i386/a-b-bootblock.S
@@ -44,6 +44,15 @@ start: # at 0x7c00 ?
# bl keeps a counter so we limit the output speed
mov $0, %bl
+
+pre_zero:
+ mov $TEST_MEM_START,%eax
+do_zero:
+ movb $0, (%eax)
+ add $4096,%eax
+ cmp $TEST_MEM_END,%eax
+ jl do_zero
+
mainloop:
mov $TEST_MEM_START,%eax
innerloop:
diff --git a/tests/migration/i386/a-b-bootblock.h b/tests/migration/i386/a-b-bootblock.h
index b7b0fce2ee..5b523917ce 100644
--- a/tests/migration/i386/a-b-bootblock.h
+++ b/tests/migration/i386/a-b-bootblock.h
@@ -4,18 +4,18 @@
* the header and the assembler differences in your patch submission.
*/
unsigned char x86_bootsect[] = {
- 0xfa, 0x0f, 0x01, 0x16, 0x78, 0x7c, 0x66, 0xb8, 0x01, 0x00, 0x00, 0x00,
+ 0xfa, 0x0f, 0x01, 0x16, 0x8c, 0x7c, 0x66, 0xb8, 0x01, 0x00, 0x00, 0x00,
0x0f, 0x22, 0xc0, 0x66, 0xea, 0x20, 0x7c, 0x00, 0x00, 0x08, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe4, 0x92, 0x0c, 0x02,
0xe6, 0x92, 0xb8, 0x10, 0x00, 0x00, 0x00, 0x8e, 0xd8, 0x66, 0xb8, 0x41,
0x00, 0x66, 0xba, 0xf8, 0x03, 0xee, 0xb3, 0x00, 0xb8, 0x00, 0x00, 0x10,
- 0x00, 0xfe, 0x00, 0x05, 0x00, 0x10, 0x00, 0x00, 0x3d, 0x00, 0x00, 0x40,
- 0x06, 0x7c, 0xf2, 0xfe, 0xc3, 0x80, 0xe3, 0x3f, 0x75, 0xe6, 0x66, 0xb8,
- 0x42, 0x00, 0x66, 0xba, 0xf8, 0x03, 0xee, 0xeb, 0xdb, 0x8d, 0x76, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00,
- 0x00, 0x9a, 0xcf, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x92, 0xcf, 0x00,
- 0x27, 0x00, 0x60, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0xc6, 0x00, 0x00, 0x05, 0x00, 0x10, 0x00, 0x00, 0x3d, 0x00, 0x00,
+ 0x40, 0x06, 0x7c, 0xf1, 0xb8, 0x00, 0x00, 0x10, 0x00, 0xfe, 0x00, 0x05,
+ 0x00, 0x10, 0x00, 0x00, 0x3d, 0x00, 0x00, 0x40, 0x06, 0x7c, 0xf2, 0xfe,
+ 0xc3, 0x80, 0xe3, 0x3f, 0x75, 0xe6, 0x66, 0xb8, 0x42, 0x00, 0x66, 0xba,
+ 0xf8, 0x03, 0xee, 0xeb, 0xdb, 0x8d, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x9a, 0xcf, 0x00,
+ 0xff, 0xff, 0x00, 0x00, 0x00, 0x92, 0xcf, 0x00, 0x27, 0x00, 0x74, 0x7c,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] i386/a-b-bootblock: factor test memory addresses out into constants
2023-09-07 19:29 ` [PATCH 1/2] i386/a-b-bootblock: factor test memory addresses out into constants Daniil Tatianin
@ 2023-09-26 20:31 ` Vladimir Sementsov-Ogievskiy
0 siblings, 0 replies; 7+ messages in thread
From: Vladimir Sementsov-Ogievskiy @ 2023-09-26 20:31 UTC (permalink / raw)
To: Daniil Tatianin, Juan Quintela
Cc: Peter Xu, Leonardo Bras, qemu-devel, yc-core
On 07.09.23 22:29, Daniil Tatianin wrote:
> So that we have less magic numbers to deal with. This also allows us to
> reuse these in the following commits.
>
> Signed-off-by: Daniil Tatianin<d-tatianin@yandex-team.ru>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
--
Best regards,
Vladimir
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] i386/a-b-bootblock: zero the first byte of each page on start
2023-09-07 19:29 ` [PATCH 2/2] i386/a-b-bootblock: zero the first byte of each page on start Daniil Tatianin
@ 2023-09-26 20:41 ` Vladimir Sementsov-Ogievskiy
2023-09-26 21:11 ` Daniil Tatianin
0 siblings, 1 reply; 7+ messages in thread
From: Vladimir Sementsov-Ogievskiy @ 2023-09-26 20:41 UTC (permalink / raw)
To: Daniil Tatianin, Juan Quintela
Cc: Peter Xu, Leonardo Bras, qemu-devel, yc-core
On 07.09.23 22:29, Daniil Tatianin wrote:
> The migration qtest all the way up to this point used to work by sheer
> luck relying on the contents of all pages from 1MiB to 100MiB to contain
> the same one value in the first byte initially.
>
> This easily breaks if we reduce the amount of RAM for the test instances
> from 150MiB to e.g 110MiB since that makes SeaBIOS dirty some of the
> pages starting at about 0x5dd2000 (~93 MiB) as it reuses those for the
> HighMemory allocator since commit dc88f9b72df ("malloc: use large
> ZoneHigh when there is enough memory").
>
> This would result in the following errors:
> 12/60 qemu:qtest+qtest-x86_64 / qtest-x86_64/migration-test ERROR 2.74s killed by signal 6 SIGABRT
> stderr:
> Memory content inconsistency at 5dd2000 first_byte = cc last_byte = cb current = 9e hit_edge = 1
> Memory content inconsistency at 5dd3000 first_byte = cc last_byte = cb current = 89 hit_edge = 1
> Memory content inconsistency at 5dd4000 first_byte = cc last_byte = cb current = 23 hit_edge = 1
> Memory content inconsistency at 5dd5000 first_byte = cc last_byte = cb current = 31 hit_edge = 1
> Memory content inconsistency at 5dd6000 first_byte = cc last_byte = cb current = 70 hit_edge = 1
> Memory content inconsistency at 5dd7000 first_byte = cc last_byte = cb current = ff hit_edge = 1
> Memory content inconsistency at 5dd8000 first_byte = cc last_byte = cb current = 54 hit_edge = 1
> Memory content inconsistency at 5dd9000 first_byte = cc last_byte = cb current = 64 hit_edge = 1
> Memory content inconsistency at 5dda000 first_byte = cc last_byte = cb current = 1d hit_edge = 1
> Memory content inconsistency at 5ddb000 first_byte = cc last_byte = cb current = 1a hit_edge = 1
> and in another 26 pages**
> ERROR:../tests/qtest/migration-test.c:300:check_guests_ram: assertion failed: (bad == 0)
>
> Fix this by always zeroing the first byte of each page in the range so
> that we get consistent results no matter the initial contents.
>
> Fixes: ea0c6d62391 ("test: Postcopy")
> Signed-off-by: Daniil Tatianin <d-tatianin@yandex-team.ru>
> ---
> tests/migration/i386/a-b-bootblock.S | 9 +++++++++
> tests/migration/i386/a-b-bootblock.h | 16 ++++++++--------
> 2 files changed, 17 insertions(+), 8 deletions(-)
>
> diff --git a/tests/migration/i386/a-b-bootblock.S b/tests/migration/i386/a-b-bootblock.S
> index 036216e4a7..6bb9999d60 100644
> --- a/tests/migration/i386/a-b-bootblock.S
> +++ b/tests/migration/i386/a-b-bootblock.S
> @@ -44,6 +44,15 @@ start: # at 0x7c00 ?
>
> # bl keeps a counter so we limit the output speed
> mov $0, %bl
> +
> +pre_zero:
> + mov $TEST_MEM_START,%eax
> +do_zero:
> + movb $0, (%eax)
> + add $4096,%eax
> + cmp $TEST_MEM_END,%eax
> + jl do_zero
> +
> mainloop:
> mov $TEST_MEM_START,%eax
> innerloop:
> diff --git a/tests/migration/i386/a-b-bootblock.h b/tests/migration/i386/a-b-bootblock.h
> index b7b0fce2ee..5b523917ce 100644
> --- a/tests/migration/i386/a-b-bootblock.h
> +++ b/tests/migration/i386/a-b-bootblock.h
> @@ -4,18 +4,18 @@
> * the header and the assembler differences in your patch submission.
> */
> unsigned char x86_bootsect[] = {
> - 0xfa, 0x0f, 0x01, 0x16, 0x78, 0x7c, 0x66, 0xb8, 0x01, 0x00, 0x00, 0x00,
> + 0xfa, 0x0f, 0x01, 0x16, 0x8c, 0x7c, 0x66, 0xb8, 0x01, 0x00, 0x00, 0x00,
> 0x0f, 0x22, 0xc0, 0x66, 0xea, 0x20, 0x7c, 0x00, 0x00, 0x08, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe4, 0x92, 0x0c, 0x02,
> 0xe6, 0x92, 0xb8, 0x10, 0x00, 0x00, 0x00, 0x8e, 0xd8, 0x66, 0xb8, 0x41,
> 0x00, 0x66, 0xba, 0xf8, 0x03, 0xee, 0xb3, 0x00, 0xb8, 0x00, 0x00, 0x10,
> - 0x00, 0xfe, 0x00, 0x05, 0x00, 0x10, 0x00, 0x00, 0x3d, 0x00, 0x00, 0x40,
> - 0x06, 0x7c, 0xf2, 0xfe, 0xc3, 0x80, 0xe3, 0x3f, 0x75, 0xe6, 0x66, 0xb8,
> - 0x42, 0x00, 0x66, 0xba, 0xf8, 0x03, 0xee, 0xeb, 0xdb, 0x8d, 0x76, 0x00,
> - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00,
> - 0x00, 0x9a, 0xcf, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x92, 0xcf, 0x00,
> - 0x27, 0x00, 0x60, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> + 0x00, 0xc6, 0x00, 0x00, 0x05, 0x00, 0x10, 0x00, 0x00, 0x3d, 0x00, 0x00,
> + 0x40, 0x06, 0x7c, 0xf1, 0xb8, 0x00, 0x00, 0x10, 0x00, 0xfe, 0x00, 0x05,
> + 0x00, 0x10, 0x00, 0x00, 0x3d, 0x00, 0x00, 0x40, 0x06, 0x7c, 0xf2, 0xfe,
> + 0xc3, 0x80, 0xe3, 0x3f, 0x75, 0xe6, 0x66, 0xb8, 0x42, 0x00, 0x66, 0xba,
> + 0xf8, 0x03, 0xee, 0xeb, 0xdb, 0x8d, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00,
> + 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x9a, 0xcf, 0x00,
> + 0xff, 0xff, 0x00, 0x00, 0x00, 0x92, 0xcf, 0x00, 0x27, 0x00, 0x74, 0x7c,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
I understand the idea of patch, but don't follow why and how this boot sector is changed. Could you note it in commit message?
--
Best regards,
Vladimir
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/2] i386/a-b-bootblock: zero the first byte of each page on start
2023-09-07 19:29 [PATCH 0/2] i386/a-b-bootblock: zero the first byte of each page on start Daniil Tatianin
2023-09-07 19:29 ` [PATCH 1/2] i386/a-b-bootblock: factor test memory addresses out into constants Daniil Tatianin
2023-09-07 19:29 ` [PATCH 2/2] i386/a-b-bootblock: zero the first byte of each page on start Daniil Tatianin
@ 2023-09-26 21:01 ` Peter Xu
2 siblings, 0 replies; 7+ messages in thread
From: Peter Xu @ 2023-09-26 21:01 UTC (permalink / raw)
To: Daniil Tatianin; +Cc: Juan Quintela, Leonardo Bras, qemu-devel, yc-core
On Thu, Sep 07, 2023 at 10:29:42PM +0300, Daniil Tatianin wrote:
> This series fixes an issue where the outcome of the migration qtest
> relies on the initial memory contents all being the same across the
> first 100MiB of RAM, which is a very fragile invariant.
>
> We fix this by making sure we zero the first byte of every testable page
> in range beforehand.
What's the difference between this one and:
https://lore.kernel.org/r/20230907193051.1609310-1-d-tatianin@yandex-team.ru
?
Thanks,
--
Peter Xu
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] i386/a-b-bootblock: zero the first byte of each page on start
2023-09-26 20:41 ` Vladimir Sementsov-Ogievskiy
@ 2023-09-26 21:11 ` Daniil Tatianin
0 siblings, 0 replies; 7+ messages in thread
From: Daniil Tatianin @ 2023-09-26 21:11 UTC (permalink / raw)
To: Vladimir Sementsov-Ogievskiy, Juan Quintela
Cc: Peter Xu, Leonardo Bras, qemu-devel@nongnu.org,
yc-core@yandex-team.ru
[-- Attachment #1: Type: text/html, Size: 6181 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-09-26 21:12 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-07 19:29 [PATCH 0/2] i386/a-b-bootblock: zero the first byte of each page on start Daniil Tatianin
2023-09-07 19:29 ` [PATCH 1/2] i386/a-b-bootblock: factor test memory addresses out into constants Daniil Tatianin
2023-09-26 20:31 ` Vladimir Sementsov-Ogievskiy
2023-09-07 19:29 ` [PATCH 2/2] i386/a-b-bootblock: zero the first byte of each page on start Daniil Tatianin
2023-09-26 20:41 ` Vladimir Sementsov-Ogievskiy
2023-09-26 21:11 ` Daniil Tatianin
2023-09-26 21:01 ` [PATCH 0/2] " Peter Xu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).