qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Lieven <pl@kamp.de>
To: Kevin Wolf <kwolf@redhat.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
	Juan Quintela <quintela@redhat.com>,
	QEMU Developers <qemu-devel@nongnu.org>,
	"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
	Amit Shah <amit.shah@redhat.com>, John Snow <jsnow@redhat.com>
Subject: Re: [Qemu-devel] [PULL 00/14] Migration pull request
Date: Fri, 20 Nov 2015 15:00:01 +0100	[thread overview]
Message-ID: <564F2761.8000200@kamp.de> (raw)
In-Reply-To: <20151120135355.GB4130@noname.redhat.com>

Am 20.11.2015 um 14:53 schrieb Kevin Wolf:
> Am 20.11.2015 um 14:44 hat Peter Lieven geschrieben:
>> Am 20.11.2015 um 12:33 schrieb Peter Maydell:
>>> On 20 November 2015 at 09:38, Peter Lieven <pl@kamp.de> wrote:
>>>> I wonder if there is a glitch in the PIO implementation of test-ide.c. As far as I understand the specs
>>>> it is not allowed to read data while the BSY flag is set. With the following change to the test-ide script
>>>> the test does not race:
>>>>
>>>> diff --git a/tests/ide-test.c b/tests/ide-test.c
>>>> index d1014bb..ab0489e 100644
>>>> --- a/tests/ide-test.c
>>>> +++ b/tests/ide-test.c
>>>> @@ -728,6 +728,7 @@ static void cdrom_pio_impl(int nblocks)
>>>>      for (i = 0; i < DIV_ROUND_UP(rxsize, limit); i++) {
>>>>          size_t offset = i * (limit / 2);
>>>>          size_t rem = (rxsize / 2) - offset;
>>>> +        ide_wait_clear(BSY);
>>>>          for (j = 0; j < MIN((limit / 2), rem); j++) {
>>>>              rx[offset + j] = le16_to_cpu(inw(IDE_BASE + reg_data));
>>>>          }
>>>>
>>>> Note: in the old sync version of the ATAPI PIO implementation this could not happen.
>>> This certainly fixes the stalls for me, though I don't know enough
>>> IDE to say whether it is the correct fix.
>> Thanks for testing.
>>
>> I hope that John or Kevin can verify this fix?
> The fix looks correct to me.
>
> While you're improving the test, you could also add an assertion that
> DRQ is set after BSY has been cleared.

I would actually move the check (which is already there) into the loop:

diff --git a/tests/ide-test.c b/tests/ide-test.c
index d1014bb..d7ee376 100644
--- a/tests/ide-test.c
+++ b/tests/ide-test.c
@@ -712,11 +712,6 @@ static void cdrom_pio_impl(int nblocks)
     /* HPD3: INTRQ_Wait */
     ide_wait_intr(IDE_PRIMARY_IRQ);
 
-    /* HPD2: Check_Status_B */
-    data = ide_wait_clear(BSY);
-    assert_bit_set(data, DRQ | DRDY);
-    assert_bit_clear(data, ERR | DF | BSY);
-
     /* Read data back: occurs in bursts of 'BYTE_COUNT_LIMIT' bytes.
      * If BYTE_COUNT_LIMIT is odd, we transfer BYTE_COUNT_LIMIT - 1 bytes.
      * We allow an odd limit only when the remaining transfer size is
@@ -728,6 +723,10 @@ static void cdrom_pio_impl(int nblocks)
     for (i = 0; i < DIV_ROUND_UP(rxsize, limit); i++) {
         size_t offset = i * (limit / 2);
         size_t rem = (rxsize / 2) - offset;
+        /* HPD2: Check_Status_B */
+        data = ide_wait_clear(BSY);
+        assert_bit_set(data, DRQ | DRDY);
+        assert_bit_clear(data, ERR | DF | BSY);
         for (j = 0; j < MIN((limit / 2), rem); j++) {
             rx[offset + j] = le16_to_cpu(inw(IDE_BASE + reg_data));
         }

Are you okay with that? @John, you also?

Peter

  reply	other threads:[~2015-11-20 14:00 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-19 11:20 [Qemu-devel] [PULL 00/14] Migration pull request Juan Quintela
2015-11-19 11:20 ` [Qemu-devel] [PULL 01/14] Set last_sent_block Juan Quintela
2015-11-19 11:20 ` [Qemu-devel] [PULL 02/14] migration: Dead assignment of current_time Juan Quintela
2015-11-19 11:20 ` [Qemu-devel] [PULL 03/14] Unneeded NULL check Juan Quintela
2015-11-19 11:20 ` [Qemu-devel] [PULL 04/14] snapshot: create helper to test that block drivers supports snapshots Juan Quintela
2015-11-19 11:21 ` [Qemu-devel] [PULL 05/14] snapshot: return error code from bdrv_snapshot_delete_by_id_or_name Juan Quintela
2015-11-19 11:21 ` [Qemu-devel] [PULL 06/14] snapshot: create bdrv_all_delete_snapshot helper Juan Quintela
2015-11-19 11:21 ` [Qemu-devel] [PULL 07/14] snapshot: create bdrv_all_goto_snapshot helper Juan Quintela
2015-11-19 11:21 ` [Qemu-devel] [PULL 08/14] migration: factor our snapshottability check in load_vmstate Juan Quintela
2015-11-19 11:21 ` [Qemu-devel] [PULL 09/14] snapshot: create bdrv_all_find_snapshot helper Juan Quintela
2015-11-19 11:21 ` [Qemu-devel] [PULL 10/14] migration: drop find_vmstate_bs check in hmp_delvm Juan Quintela
2015-11-19 11:21 ` [Qemu-devel] [PULL 11/14] snapshot: create bdrv_all_create_snapshot helper Juan Quintela
2015-11-19 11:21 ` [Qemu-devel] [PULL 12/14] migration: reorder processing in hmp_savevm Juan Quintela
2015-11-19 11:21 ` [Qemu-devel] [PULL 13/14] migration: implement bdrv_all_find_vmstate_bs helper Juan Quintela
2015-11-19 11:21 ` [Qemu-devel] [PULL 14/14] migration: normalize locking in migration/savevm.c Juan Quintela
2015-11-19 13:12 ` [Qemu-devel] [PULL 00/14] Migration pull request Peter Maydell
2015-11-19 13:21   ` Peter Maydell
2015-11-19 14:44     ` Peter Maydell
2015-11-19 15:03       ` Peter Maydell
2015-11-19 15:16         ` Dr. David Alan Gilbert
2015-11-20  8:03           ` Peter Lieven
2015-11-20  9:38           ` Peter Lieven
2015-11-20 11:33             ` Peter Maydell
2015-11-20 13:44               ` Peter Lieven
2015-11-20 13:53                 ` Kevin Wolf
2015-11-20 14:00                   ` Peter Lieven [this message]
2015-11-20 14:15                     ` Kevin Wolf
2015-11-19 17:32         ` John Snow
2015-11-19 15:56 ` Peter Maydell
  -- strict thread matches above, loose matches on Subject: below --
2017-06-13  9:51 [Qemu-devel] [PULL 00/14] Migration PULL request Juan Quintela
2017-06-13 13:40 ` Peter Maydell
2018-01-03  9:38 [Qemu-devel] [PULL 00/14] Migration pull request Juan Quintela
2018-01-05  0:30 ` Eric Blake
2018-01-05  9:29   ` Dr. David Alan Gilbert
2018-01-05  9:59   ` Juan Quintela
2018-01-09 18:24     ` Peter Maydell
2018-01-09 18:28       ` Juan Quintela
2018-01-10  4:58     ` Alexey Perevalov
2018-01-11 11:51 ` Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=564F2761.8000200@kamp.de \
    --to=pl@kamp.de \
    --cc=amit.shah@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).