* [Qemu-devel] [PATCH 0/2] IDE: Do not flush empty drives
@ 2017-08-09 16:02 Stefan Hajnoczi
2017-08-09 16:02 ` [Qemu-devel] [PATCH 1/2] IDE: Do not flush empty CDROM drives Stefan Hajnoczi
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Stefan Hajnoczi @ 2017-08-09 16:02 UTC (permalink / raw)
To: qemu-devel
Cc: P J P, Kevin Wolf, Eric Blake, qemu-block, Paolo Bonzini,
John Snow, Dr . David Alan Gilbert, Stefan Hajnoczi
John Snow is offline until Monday, QEMU 2.10-rc3 is due to be tagged on
Tuesday, and so I've taken two patches John sent for 2.10 and addressed review
comments.
Kevin Wolf (1):
IDE: test flush on empty CDROM
Stefan Hajnoczi (1):
IDE: Do not flush empty CDROM drives
hw/ide/core.c | 10 +++++++++-
tests/ide-test.c | 19 +++++++++++++++++++
2 files changed, 28 insertions(+), 1 deletion(-)
--
2.13.3
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Qemu-devel] [PATCH 1/2] IDE: Do not flush empty CDROM drives
2017-08-09 16:02 [Qemu-devel] [PATCH 0/2] IDE: Do not flush empty drives Stefan Hajnoczi
@ 2017-08-09 16:02 ` Stefan Hajnoczi
2017-08-09 20:39 ` Eric Blake
2017-08-09 16:02 ` [Qemu-devel] [PATCH 2/2] IDE: test flush on empty CDROM Stefan Hajnoczi
2017-08-10 9:54 ` [Qemu-devel] [PATCH 0/2] IDE: Do not flush empty drives Stefan Hajnoczi
2 siblings, 1 reply; 5+ messages in thread
From: Stefan Hajnoczi @ 2017-08-09 16:02 UTC (permalink / raw)
To: qemu-devel
Cc: P J P, Kevin Wolf, Eric Blake, qemu-block, Paolo Bonzini,
John Snow, Dr . David Alan Gilbert, Stefan Hajnoczi
The block backend changed in a way that flushing empty CDROM drives now
crashes. Amend IDE to avoid doing so until the root problem can be
addressed for 2.11.
Original patch by John Snow <jsnow@redhat.com>.
Reported-by: Kieron Shorrock <kshorrock@paloaltonetworks.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
hw/ide/core.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/hw/ide/core.c b/hw/ide/core.c
index 0b48b64d3a..bea39536b0 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -1063,7 +1063,15 @@ static void ide_flush_cache(IDEState *s)
s->status |= BUSY_STAT;
ide_set_retry(s);
block_acct_start(blk_get_stats(s->blk), &s->acct, 0, BLOCK_ACCT_FLUSH);
- s->pio_aiocb = blk_aio_flush(s->blk, ide_flush_cb, s);
+
+ if (blk_bs(s->blk)) {
+ s->pio_aiocb = blk_aio_flush(s->blk, ide_flush_cb, s);
+ } else {
+ /* XXX blk_aio_flush() crashes when blk_bs(blk) is NULL, remove this
+ * temporary workaround when blk_aio_*() functions handle NULL blk_bs.
+ */
+ ide_flush_cb(s, 0);
+ }
}
static void ide_cfata_metadata_inquiry(IDEState *s)
--
2.13.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Qemu-devel] [PATCH 2/2] IDE: test flush on empty CDROM
2017-08-09 16:02 [Qemu-devel] [PATCH 0/2] IDE: Do not flush empty drives Stefan Hajnoczi
2017-08-09 16:02 ` [Qemu-devel] [PATCH 1/2] IDE: Do not flush empty CDROM drives Stefan Hajnoczi
@ 2017-08-09 16:02 ` Stefan Hajnoczi
2017-08-10 9:54 ` [Qemu-devel] [PATCH 0/2] IDE: Do not flush empty drives Stefan Hajnoczi
2 siblings, 0 replies; 5+ messages in thread
From: Stefan Hajnoczi @ 2017-08-09 16:02 UTC (permalink / raw)
To: qemu-devel
Cc: P J P, Kevin Wolf, Eric Blake, qemu-block, Paolo Bonzini,
John Snow, Dr . David Alan Gilbert, Stefan Hajnoczi
From: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
tests/ide-test.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/tests/ide-test.c b/tests/ide-test.c
index bfd79ddbdc..aa9de065fc 100644
--- a/tests/ide-test.c
+++ b/tests/ide-test.c
@@ -689,6 +689,24 @@ static void test_flush_nodev(void)
ide_test_quit();
}
+static void test_flush_empty_drive(void)
+{
+ QPCIDevice *dev;
+ QPCIBar bmdma_bar, ide_bar;
+
+ ide_test_start("-device ide-cd,bus=ide.0");
+ dev = get_pci_device(&bmdma_bar, &ide_bar);
+
+ /* FLUSH CACHE command on device 0 */
+ qpci_io_writeb(dev, ide_bar, reg_device, 0);
+ qpci_io_writeb(dev, ide_bar, reg_command, CMD_FLUSH_CACHE);
+
+ /* Just testing that qemu doesn't crash... */
+
+ free_pci_device(dev);
+ ide_test_quit();
+}
+
static void test_pci_retry_flush(void)
{
test_retry_flush("pc");
@@ -954,6 +972,7 @@ int main(int argc, char **argv)
qtest_add_func("/ide/flush", test_flush);
qtest_add_func("/ide/flush/nodev", test_flush_nodev);
+ qtest_add_func("/ide/flush/empty_drive", test_flush_empty_drive);
qtest_add_func("/ide/flush/retry_pci", test_pci_retry_flush);
qtest_add_func("/ide/flush/retry_isa", test_isa_retry_flush);
--
2.13.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH 1/2] IDE: Do not flush empty CDROM drives
2017-08-09 16:02 ` [Qemu-devel] [PATCH 1/2] IDE: Do not flush empty CDROM drives Stefan Hajnoczi
@ 2017-08-09 20:39 ` Eric Blake
0 siblings, 0 replies; 5+ messages in thread
From: Eric Blake @ 2017-08-09 20:39 UTC (permalink / raw)
To: Stefan Hajnoczi, qemu-devel
Cc: P J P, Kevin Wolf, qemu-block, Paolo Bonzini, John Snow,
Dr . David Alan Gilbert
[-- Attachment #1: Type: text/plain, Size: 1485 bytes --]
On 08/09/2017 11:02 AM, Stefan Hajnoczi wrote:
> The block backend changed in a way that flushing empty CDROM drives now
> crashes. Amend IDE to avoid doing so until the root problem can be
> addressed for 2.11.
>
> Original patch by John Snow <jsnow@redhat.com>.
>
> Reported-by: Kieron Shorrock <kshorrock@paloaltonetworks.com>
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
> hw/ide/core.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
Reviewed-by: Eric Blake <eblake@redhat.com>
>
> diff --git a/hw/ide/core.c b/hw/ide/core.c
> index 0b48b64d3a..bea39536b0 100644
> --- a/hw/ide/core.c
> +++ b/hw/ide/core.c
> @@ -1063,7 +1063,15 @@ static void ide_flush_cache(IDEState *s)
> s->status |= BUSY_STAT;
> ide_set_retry(s);
> block_acct_start(blk_get_stats(s->blk), &s->acct, 0, BLOCK_ACCT_FLUSH);
> - s->pio_aiocb = blk_aio_flush(s->blk, ide_flush_cb, s);
> +
> + if (blk_bs(s->blk)) {
> + s->pio_aiocb = blk_aio_flush(s->blk, ide_flush_cb, s);
> + } else {
> + /* XXX blk_aio_flush() crashes when blk_bs(blk) is NULL, remove this
> + * temporary workaround when blk_aio_*() functions handle NULL blk_bs.
> + */
> + ide_flush_cb(s, 0);
> + }
> }
>
> static void ide_cfata_metadata_inquiry(IDEState *s)
>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 619 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH 0/2] IDE: Do not flush empty drives
2017-08-09 16:02 [Qemu-devel] [PATCH 0/2] IDE: Do not flush empty drives Stefan Hajnoczi
2017-08-09 16:02 ` [Qemu-devel] [PATCH 1/2] IDE: Do not flush empty CDROM drives Stefan Hajnoczi
2017-08-09 16:02 ` [Qemu-devel] [PATCH 2/2] IDE: test flush on empty CDROM Stefan Hajnoczi
@ 2017-08-10 9:54 ` Stefan Hajnoczi
2 siblings, 0 replies; 5+ messages in thread
From: Stefan Hajnoczi @ 2017-08-10 9:54 UTC (permalink / raw)
To: qemu-devel
Cc: P J P, Kevin Wolf, Eric Blake, qemu-block, Paolo Bonzini,
John Snow, Dr . David Alan Gilbert
[-- Attachment #1: Type: text/plain, Size: 768 bytes --]
On Wed, Aug 09, 2017 at 05:02:10PM +0100, Stefan Hajnoczi wrote:
> John Snow is offline until Monday, QEMU 2.10-rc3 is due to be tagged on
> Tuesday, and so I've taken two patches John sent for 2.10 and addressed review
> comments.
>
> Kevin Wolf (1):
> IDE: test flush on empty CDROM
>
> Stefan Hajnoczi (1):
> IDE: Do not flush empty CDROM drives
>
> hw/ide/core.c | 10 +++++++++-
> tests/ide-test.c | 19 +++++++++++++++++++
> 2 files changed, 28 insertions(+), 1 deletion(-)
John: I am sending a pull request to get this fix into -rc3 (Aug 15th).
Feel free to send a follow-up/revert if you want to make changes when
you get back online.
Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block
Stefan
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-08-10 9:54 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-09 16:02 [Qemu-devel] [PATCH 0/2] IDE: Do not flush empty drives Stefan Hajnoczi
2017-08-09 16:02 ` [Qemu-devel] [PATCH 1/2] IDE: Do not flush empty CDROM drives Stefan Hajnoczi
2017-08-09 20:39 ` Eric Blake
2017-08-09 16:02 ` [Qemu-devel] [PATCH 2/2] IDE: test flush on empty CDROM Stefan Hajnoczi
2017-08-10 9:54 ` [Qemu-devel] [PATCH 0/2] IDE: Do not flush empty drives Stefan Hajnoczi
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).