ide-test: tidy up after pio race fix
v2 cover ide-test: tidy up after pio race fix
Post-rc1 cleanup of the ATAPI tests that were problematic during the rc0 testing window. This set does two things:
(1) Fix the timeouts to be more deterministic, and
(2) Finish tidying up the PIO loop.
v2:
- Clarify the commit message on patch 1, and remove the second needless stack variable.
John Snow (1):
ide-test: fix timeouts
tests/ide-test.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
Signature · 1 line
2.4.3
PATCH v2 1/1 ide-test: fix timeouts
Use explicit timeouts instead of trying to approximate it by counting the cumulative duration of nsleep calls.
In practice, the timeout if inb() dwarfed the nsleep delays, and as a result the real timeout value became a lot larger than 5 seconds.
So: change the semantics from "Not sooner than 5 seconds" to "no more than 5 seconds" to ensure we don't hang the tester for very long.
--- tests/ide-test.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
tests/ide-test.c +12 -4
@@ -642,15 +642,19 @@ static void nsleep(int64_t nsecs)static uint8_t ide_wait_clear (uint8_t flag) { -int i;uint8_t data; +time_t st;/* Wait with a 5 second timeout */ -for (i =0 ; i <=12500000 ; i++) { +time (&st); +while (true) { data =inb (IDE_BASE + reg_status);if (!(data & flag)) {return data; } +if (difftime (time (NULL ), st) >5.0 ) { +break ; + }nsleep (400 ); }g_assert_not_reached ();
@@ -658,14 +662,18 @@ static uint8_t ide_wait_clear(uint8_t flag)static void ide_wait_intr (int irq) { -int i; +time_t st;bool intr; -for (i =0 ; i <=12500000 ; i++) { +time (&st); +while (true) { intr =get_irq (irq);if (intr) {return ; } +if (difftime (time (NULL ), st) >5.0 ) { +break ; + }nsleep (400 ); }
Signature · 1 line
2.4.3
Re: [Qemu-devel] [PATCH v2 1/1] ide-test: fix timeouts
Am 24.11.2015 um 20:36 hat John Snow geschrieben:
Quoted 10 lines
Use explicit timeouts instead of trying to approximate it by counting the cumulative duration of nsleep calls.
In practice, the timeout if
inb()dwarfed the nsleep delays, and as a result the real timeout value became a lot larger than 5 seconds.So: change the semantics from "Not sooner than 5 seconds" to "no more than 5 seconds" to ensure we don't hang the tester for very long.
Signed-off-by John Snow <[email protected]>
Quoted 10 lines · John Snow
Post-rc1 cleanup of the ATAPI tests that were problematic during the rc0 testing window. This set does two things:
(1) Fix the timeouts to be more deterministic, and
(2) Finish tidying up the PIO loop.v2:
- Clarify the commit message on patch 1, and remove the second needless stack variable.
Quoted 6 lines
John Snow (1):
ide-test: fix timeoutstests/ide-test.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
Script goofed up and didn't send the second one, but since Kevin already reviewed it, I'll just stage it.
--js