Skip to contentSkip to conversation

hw/vexpress: set default block type to SD

PATCH In review Aurelien Jarno 4 participants 17 messages Mar 5, 2013 – Mar 18, 2013 Arm/versatile express platform

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/vexpress: set default block type to SD

The versatile express has no SCSI card, but instead boot on an SD card. Change block_default_type accordingly.

---
 hw/vexpress.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/vexpress.c +2 -2
index 741b044..969aae6 100644
@@ -477,7 +477,7 @@ static QEMUMachine vexpress_a9_machine = {
     .name = "vexpress-a9",
     .desc = "ARM Versatile Express for Cortex-A9",
     .init = vexpress_a9_init,
-    .block_default_type = IF_SCSI,
+    .block_default_type = IF_SD,
     .max_cpus = 4,
     DEFAULT_MACHINE_OPTIONS,
 };
@@ -486,7 +486,7 @@ static QEMUMachine vexpress_a15_machine = {
     .name = "vexpress-a15",
     .desc = "ARM Versatile Express for Cortex-A15",
     .init = vexpress_a15_init,
-    .block_default_type = IF_SCSI,
+    .block_default_type = IF_SD,
     .max_cpus = 4,
     DEFAULT_MACHINE_OPTIONS,
 };
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 2 lines · Aurelien Jarno

The versatile express has no SCSI card, but instead boot on an SD card. Change block_default_type accordingly.

I notice that no other board has SD as the block_default_type...

What effect does this actually have on the user experience? Also, won't vl.c now try to create a cdrom drive on the SD interface?

-- PMM

#2 lore raw
Quoted 7 lines · Peter Maydell
Quoted 2 lines · Aurelien Jarno

The versatile express has no SCSI card, but instead boot on an SD card. Change block_default_type accordingly.

I notice that no other board has SD as the block_default_type...

What effect does this actually have on the user experience?

The effect is that the user don't has to specify the interface type. Basically:

-drive file=/path/to/file,if=sd
can be replaced by
-drive file=/path/to/file

It means the user doesn't have to know the details of the machine to know how to attach a disk. Note that the user here can also be a script, which then becomes a bit simpler.

Quoted 2 lines

Also, won't vl.c now try to create a cdrom drive on the SD interface?

It still creates a cdrom drive as before, but still doesn't try to connect it to the SD interface. In short the behaviour on that side is unchanged.

Signature · 2 lines
Aurelien Jarno                          GPG: 1024D/F1BCDB73
[email protected]                 http://www.aurel32.net
#3 lore raw
Quoted 12 lines · Aurelien Jarno
Quoted 7 lines · Peter Maydell
Quoted 2 lines · Aurelien Jarno

The versatile express has no SCSI card, but instead boot on an SD card. Change block_default_type accordingly.

I notice that no other board has SD as the block_default_type...

What effect does this actually have on the user experience?

The effect is that the user don't has to specify the interface type. Basically:

Quoted 6 lines

-drive file=/path/to/file,if=sd
can be replaced by
-drive file=/path/to/file

It means the user doesn't have to know the details of the machine to know how to attach a disk.

Correct. Also affects monitor commands.

See commit 2d0d2837.

Quoted 9 lines

Note that the user here can also be a script,
which then becomes a bit simpler.

Quoted 2 lines

Also, won't vl.c now try to create a cdrom drive on the SD interface?

It still creates a cdrom drive as before, but still doesn't try to connect it to the SD interface. In short the behaviour on that side is unchanged.

An if=sd CD-ROM is weird, but unused weirdness has no effect.

If it bothers you, set .no_cdrom along with .block_default_type.

See also my unsuccessful attempt at getting rid of unused default drives[*], and observations made during review of Peter's followup attempt to improve SD cards[**].

[*] http://lists.nongnu.org/archive/html/qemu-devel/2012-08/msg02993.html
[**] http://lists.nongnu.org/archive/html/qemu-devel/2012-08/msg03160.html

#4 lore raw
In reply to Aurelien Jarno
Quoted 6 lines · Aurelien Jarno
Quoted 1 line · Peter Maydell

What effect does this actually have on the user experience?

The effect is that the user don't has to specify the interface type. Basically:

Quoted 7 lines

-drive file=/path/to/file,if=sd
can be replaced by
-drive file=/path/to/file

It means the user doesn't have to know the details of the machine to know how to attach a disk. Note that the user here can also be a script, which then becomes a bit simpler.

I'm not convinced this is a good thing -- I think you should have to know that you're attaching an SD card and not a hard disk, because the performance is much worse. In particular if you don't specify 'cache=writeback' your performance will be dreadful, so you need to do something different from hard disks anyhow.

-- PMM

#5 lore raw
Quoted 15 lines · Peter Maydell
Quoted 6 lines · Aurelien Jarno
Quoted 1 line · Peter Maydell

What effect does this actually have on the user experience?

The effect is that the user don't has to specify the interface type. Basically:

Quoted 7 lines

-drive file=/path/to/file,if=sd
can be replaced by
-drive file=/path/to/file

It means the user doesn't have to know the details of the machine to know how to attach a disk. Note that the user here can also be a script, which then becomes a bit simpler.

Quoted 7 lines

I'm not convinced this is a good thing -- I think you should have to know that you're attaching an SD card and not a hard disk, because the performance is much worse. In particular if you don't specify 'cache=writeback' your performance will be dreadful, so you need to do something different from hard disks anyhow.

Being a good thing or not, the current code is wrong: the default interface type is set to SCSI (I guess it has been copied from versatilepb.c), while the vexpress machine has no SCSI interface.

Signature · 2 lines
Aurelien Jarno	                        GPG: 1024D/F1BCDB73
[email protected]                 http://www.aurel32.net
#6 lore raw
Quoted 8 lines · Aurelien Jarno
Quoted 6 lines · Peter Maydell

I'm not convinced this is a good thing -- I think you should have to know that you're attaching an SD card and not a hard disk, because the performance is much worse. In particular if you don't specify 'cache=writeback' your performance will be dreadful, so you need to do something different from hard disks anyhow.

Quoted 4 lines

Being a good thing or not, the current code is wrong: the default interface type is set to SCSI (I guess it has been copied from versatilepb.c), while the vexpress machine has no SCSI interface.

I agree we shouldn't be claiming to have a scsi interface, yes.

-- PMM

#7 lore raw
Quoted 9 lines · Peter Maydell
Quoted 7 lines · Aurelien Jarno
Quoted 6 lines · Peter Maydell

I'm not convinced this is a good thing -- I think you should have to know that you're attaching an SD card and not a hard disk, because the performance is much worse. In particular if you don't specify 'cache=writeback' your performance will be dreadful, so you need to do something different from hard disks anyhow.

Quoted 7 lines
Quoted 4 lines

Being a good thing or not, the current code is wrong: the default interface type is set to SCSI (I guess it has been copied from versatilepb.c), while the vexpress machine has no SCSI interface.

I agree we shouldn't be claiming to have a scsi interface, yes.

Does it means you are going to accept the patch?

In anycase let me give you some more arguments in favor of it. Even if you believe that users should always provide a cache= argument, I don't think it should be done by setting a wrong default interfaces. Users are likely to simply google for a command line and paste it without understanding the consequences of cache=writeback. The way to go there is to make the writeback argument mandatory for some machines if you really believe it's need by all users.

That said I don't share this opinion. I have made some tests comparing a versatile and a vexpress machine, running Debian Wheezy, armel for the first one and armhf for the second one. This has been done on a Core i5 2500 machine with a ST2000DM001 hard drive. Here are the results:

| boot | install build-dep | build lm-sensors |
------------------------+------+-------------------+------------------+

  versatile               | 1:09 |             2:27  |             4:09 |
  versatile cache=wb      | 1:08 |             2:25  |             3:44 |
  vexpress                | 1:11 |             3:07  |             3:49 |
  vexpress cache=wb       | 1:07 |             3:07  |             3:47 |

Note: the install build-dep time doesn't include the download time.

So even if the two systems are not directly comparable, it shows that the SD card emulation is indeed slower than the hard disk one. That said while cache=writeback makes a difference for the versatile platform, it doesn't really change anything for the vexpress platform. Therefore forcing the users to add this option doesn't seems to be a good idea.

Signature · 2 lines
Aurelien Jarno                          GPG: 1024D/F1BCDB73
[email protected]                 http://www.aurel32.net
#8 lore raw
Quoted 15 lines · Aurelien Jarno
Quoted 14 lines · Peter Maydell
Quoted 12 lines · Aurelien Jarno
Quoted 6 lines · Peter Maydell

I'm not convinced this is a good thing -- I think you should have to know that you're attaching an SD card and not a hard disk, because the performance is much worse. In particular if you don't specify 'cache=writeback' your performance will be dreadful, so you need to do something different from hard disks anyhow.

Being a good thing or not, the current code is wrong: the default interface type is set to SCSI (I guess it has been copied from versatilepb.c), while the vexpress machine has no SCSI interface.

Quoted 4 lines
Quoted 2 lines

I agree we shouldn't be claiming to have a scsi interface, yes.

Does it means you are going to accept the patch?

No, I meant I'd accept a patch which stops us reporting that we have a SCSI interface when we don't.

Quoted 7 lines

In anycase let me give you some more arguments in favor of it. Even if you believe that users should always provide a cache= argument, I don't think it should be done by setting a wrong default interfaces. Users are likely to simply google for a command line and paste it without understanding the consequences of cache=writeback. The way to go there is to make the writeback argument mandatory for some machines if you really believe it's need by all users.

writeback shouldn't be mandatory randomly for some machines and interfaces and not others.

Quoted 12 lines

That said I don't share this opinion. I have made some tests comparing a versatile and a vexpress machine, running Debian Wheezy, armel for the first one and armhf for the second one. This has been done on a Core i5 2500 machine with a ST2000DM001 hard drive. Here are the results:

| boot | install build-dep | build lm-sensors |
------------------------+------+-------------------+------------------+

  versatile               | 1:09 |             2:27  |             4:09 |
  versatile cache=wb      | 1:08 |             2:25  |             3:44 |
  vexpress                | 1:11 |             3:07  |             3:49 |
  vexpress cache=wb       | 1:07 |             3:07  |             3:47 |
Quoted 7 lines

Note: the install build-dep time doesn't include the download time.

So even if the two systems are not directly comparable, it shows that the SD card emulation is indeed slower than the hard disk one. That said while cache=writeback makes a difference for the versatile platform, it doesn't really change anything for the vexpress platform. Therefore forcing the users to add this option doesn't seems to be a good idea.

Maybe the default has changed. Certainly it used to be the case that sd card emulation was incredibly slow without some kind of caching option, because it writes 512 bytes at a time, synchronously, and the SD card interface has no way for the guest to say 'write; write; write; ok now make sure that's all committed'.

-- PMM

#9 lore raw
Quoted 16 lines · Peter Maydell
Quoted 15 lines · Aurelien Jarno
Quoted 14 lines · Peter Maydell
Quoted 12 lines · Aurelien Jarno
Quoted 6 lines · Peter Maydell

I'm not convinced this is a good thing -- I think you should have to know that you're attaching an SD card and not a hard disk, because the performance is much worse. In particular if you don't specify 'cache=writeback' your performance will be dreadful, so you need to do something different from hard disks anyhow.

Being a good thing or not, the current code is wrong: the default interface type is set to SCSI (I guess it has been copied from versatilepb.c), while the vexpress machine has no SCSI interface.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

I agree we shouldn't be claiming to have a scsi interface, yes.

Does it means you are going to accept the patch?

No, I meant I'd accept a patch which stops us reporting that we have a SCSI interface when we don't.

That's what the patch does, by correctly saying it's an SD interface and not a SCSI one.

Quoted 10 lines
Quoted 7 lines

In anycase let me give you some more arguments in favor of it. Even if you believe that users should always provide a cache= argument, I don't think it should be done by setting a wrong default interfaces. Users are likely to simply google for a command line and paste it without understanding the consequences of cache=writeback. The way to go there is to make the writeback argument mandatory for some machines if you really believe it's need by all users.

writeback shouldn't be mandatory randomly for some machines and interfaces and not others.

I don't get your point there. You don't want to make it mandatory at the QEMU level, but you want users to understand they have to specify it for some machines, by making if= mandatory randomly for some machines and not others?

Quoted 20 lines
Quoted 12 lines

That said I don't share this opinion. I have made some tests comparing a versatile and a vexpress machine, running Debian Wheezy, armel for the first one and armhf for the second one. This has been done on a Core i5 2500 machine with a ST2000DM001 hard drive. Here are the results:

| boot | install build-dep | build lm-sensors |
------------------------+------+-------------------+------------------+

  versatile               | 1:09 |             2:27  |             4:09 |
  versatile cache=wb      | 1:08 |             2:25  |             3:44 |
  vexpress                | 1:11 |             3:07  |             3:49 |
  vexpress cache=wb       | 1:07 |             3:07  |             3:47 |
Quoted 7 lines

Note: the install build-dep time doesn't include the download time.

So even if the two systems are not directly comparable, it shows that the SD card emulation is indeed slower than the hard disk one. That said while cache=writeback makes a difference for the versatile platform, it doesn't really change anything for the vexpress platform. Therefore forcing the users to add this option doesn't seems to be a good idea.

Quoted 6 lines

Maybe the default has changed. Certainly it used to be the case that sd card emulation was incredibly slow without some kind of caching option, because it writes 512 bytes at a time, synchronously, and the SD card interface has no way for the guest to say 'write; write; write; ok now make sure that's all committed'.

I don't know what has changed, but with the current code the argument saying that the vexpress machine without cache=writeback has dreadful performance is wrong.

Signature · 2 lines
Aurelien Jarno                          GPG: 1024D/F1BCDB73
[email protected]                 http://www.aurel32.net
#10 lore raw
Quoted 6 lines · Aurelien Jarno
Quoted 5 lines · Peter Maydell
Quoted 4 lines · Aurelien Jarno
Quoted 2 lines · Peter Maydell

I agree we shouldn't be claiming to have a scsi interface, yes.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Does it means you are going to accept the patch?

No, I meant I'd accept a patch which stops us reporting that we have a SCSI interface when we don't.

That's what the patch does, by correctly saying it's an SD interface and not a SCSI one.

The patch does two things:
* stops claiming a default SCSI interface [obviously right]
* starts claiming a default SD interface [what we're arguing about]

Quoted 8 lines
Quoted 8 lines
Quoted 7 lines

In anycase let me give you some more arguments in favor of it. Even if you believe that users should always provide a cache= argument, I don't think it should be done by setting a wrong default interfaces. Users are likely to simply google for a command line and paste it without understanding the consequences of cache=writeback. The way to go there is to make the writeback argument mandatory for some machines if you really believe it's need by all users.

Quoted 7 lines
Quoted 2 lines

writeback shouldn't be mandatory randomly for some machines and interfaces and not others.

I don't get your point there. You don't want to make it mandatory at the QEMU level, but you want users to understand they have to specify it for some machines, by making if= mandatory randomly for some machines and not others?

My point is that I don't think there's a good solution to "modelled SD cards aren't a good substitute for modelled hard disks".

That said, I want to postpone the rest of this conversation until I've had a chance to look into what has changed regarding performance of SD with the default cache settings.

-- PMM

#11 lore raw
In reply to Aurelien Jarno

Il 17/03/2013 01:04, Aurelien Jarno ha scritto:

Quoted 4 lines

| boot | install build-dep | build lm-sensors |
------------------------+------+-------------------+------------------+

  versatile               | 1:09 |             2:27  |             4:09 |
  versatile cache=wb      | 1:08 |             2:25  |             3:44 |

Strange, cache=wb should be the default.

The real problem with SD is that it doesn't have a flush command, hence it cannot be made safe against power losses. But the solution is to add support for virtio-mmio in those boards.

Paolo

Quoted 10 lines
  vexpress                | 1:11 |             3:07  |             3:49 |
  vexpress cache=wb       | 1:07 |             3:07  |             3:47 |

Note: the install build-dep time doesn't include the download time.

So even if the two systems are not directly comparable, it shows that the SD card emulation is indeed slower than the hard disk one. That said while cache=writeback makes a difference for the versatile platform, it doesn't really change anything for the vexpress platform. Therefore forcing the users to add this option doesn't seems to be a good idea.

#12 lore raw
Quoted 10 lines · Paolo Bonzini

Il 17/03/2013 01:04, Aurelien Jarno ha scritto:

Quoted 4 lines

| boot | install build-dep | build lm-sensors |
------------------------+------+-------------------+------------------+

  versatile               | 1:09 |             2:27  |             4:09 |
  versatile cache=wb      | 1:08 |             2:25  |             3:44 |

Strange, cache=wb should be the default.

The real problem with SD is that it doesn't have a flush command, hence it cannot be made safe against power losses.

So, two things here:
(a) the way to make it safe against power loss is that when the guest writes a block of data it has to really hit the emulated disk, because this is how the hardware works
(b) I thought this was the reason cache=wb wasn't the default (ie that we weren't defaulting to 'may lose data on powerloss'). At the time I last looked into command line options for these boards I'm pretty sure it wasn't the default, because the performance improvement from turning on caching was huge.

-- PMM

#13 lore raw
Quoted 12 lines · Peter Maydell
Quoted 10 lines · Paolo Bonzini

Il 17/03/2013 01:04, Aurelien Jarno ha scritto:

Quoted 4 lines

| boot | install build-dep | build lm-sensors |
------------------------+------+-------------------+------------------+

  versatile               | 1:09 |             2:27  |             4:09 |
  versatile cache=wb      | 1:08 |             2:25  |             3:44 |

Strange, cache=wb should be the default.

The real problem with SD is that it doesn't have a flush command, hence it cannot be made safe against power losses.

Quoted 10 lines

So, two things here:
(a) the way to make it safe against power loss is that when the guest writes a block of data it has to really hit the emulated disk, because this is how the hardware works
(b) I thought this was the reason cache=wb wasn't the default (ie that we weren't defaulting to 'may lose data on powerloss'). At the time I last looked into command line options for these boards I'm pretty sure it wasn't the default, because the performance improvement from turning on caching was huge.

For the record, this has been changed in this commit:

commit 1f212b9d3edd8679bafd3bcf0301795206438724

Author: Paolo Bonzini <[email protected]>
Date:   Thu Aug 9 16:07:21 2012 +0200

blockdev: flip default cache mode from writethrough to writeback

Now all major device models (IDE, SCSI, virtio) can choose between writethrough and writeback at run-time, and virtio will even revert to writethrough if the guest is not capable of sending flushes. So we can change the default to writeback at last.

Tested, for lack of a better idea, with a breakpoint on bdrv_open and all cache choices one by one.

Signature · 2 lines
Aurelien Jarno	                        GPG: 1024D/F1BCDB73
[email protected]                 http://www.aurel32.net
#14 lore raw
In reply to Peter Maydell

Il 17/03/2013 19:54, Peter Maydell ha scritto:

Quoted 12 lines · Paolo Bonzini
Quoted 10 lines

Il 17/03/2013 01:04, Aurelien Jarno ha scritto:

Quoted 4 lines

| boot | install build-dep | build lm-sensors |
------------------------+------+-------------------+------------------+

  versatile               | 1:09 |             2:27  |             4:09 |
  versatile cache=wb      | 1:08 |             2:25  |             3:44 |

Strange, cache=wb should be the default.

The real problem with SD is that it doesn't have a flush command, hence it cannot be made safe against power losses.

Quoted 6 lines

So, two things here:
(a) the way to make it safe against power loss is that when the guest writes a block of data it has to really hit the emulated disk, because this is how the hardware works
(b) I thought this was the reason cache=wb wasn't the default (ie that we weren't defaulting to 'may lose data on powerloss').

See the commit message that Aurelien posted. The combination of "virtio-blk will auto-toggle to writethrough on very old kernels", "guests can toggle it for all of IDE/SCSI/virtio", "memory cards are anyway unusable with writethrough" finally made the balance tilt in favor of cache=wb.

Paolo

#15 lore raw
In reply to Paolo Bonzini
Quoted 7 lines · Paolo Bonzini

Il 17/03/2013 01:04, Aurelien Jarno ha scritto:

Quoted 4 lines

| boot | install build-dep | build lm-sensors |
------------------------+------+-------------------+------------------+

  versatile               | 1:09 |             2:27  |             4:09 |
  versatile cache=wb      | 1:08 |             2:25  |             3:44 |

Strange, cache=wb should be the default.

I agree it's strange, maybe there were other effects, but I am sure when I did the tests cache=wb the build time was clearly shorter.

Quoted 9 lines

The real problem with SD is that it doesn't have a flush command, hence it cannot be made safe against power losses. But the solution is to add support for virtio-mmio in those boards.

Paolo

Quoted 3 lines
  vexpress                | 1:11 |             3:07  |             3:49 |
  vexpress cache=wb       | 1:07 |             3:07  |             3:47 |

Here the results are more consistent with the default being cache=wb.

I'll try to do the same tests on another machine to see if the results are still the same.

Signature · 2 lines
Aurelien Jarno	                        GPG: 1024D/F1BCDB73
[email protected]                 http://www.aurel32.net
#16 lore raw
In reply to Peter Maydell

Il 15/03/2013 16:35, Peter Maydell ha scritto:

Quoted 15 lines · Aurelien Jarno
Quoted 6 lines · Peter Maydell
Quoted 1 line

What effect does this actually have on the user experience?

The effect is that the user don't has to specify the interface type. Basically:

Quoted 7 lines

-drive file=/path/to/file,if=sd
can be replaced by
-drive file=/path/to/file

It means the user doesn't have to know the details of the machine to know how to attach a disk. Note that the user here can also be a script, which then becomes a bit simpler.

Quoted 6 lines

I'm not convinced this is a good thing -- I think you should have to know that you're attaching an SD card and not a hard disk, because the performance is much worse. In particular if you don't specify 'cache=writeback' your performance will be dreadful, so you need to do something different from hard disks anyhow.

cache=writeback has been the default for a few releases.

Paolo