diff mbox

[4/4] Provide "write" function in the disk-label package

Message ID 1479214972-19153-5-git-send-email-thuth@redhat.com
State Accepted
Headers show

Commit Message

Thomas Huth Nov. 15, 2016, 1:02 p.m. UTC
As with the "read" function, the disk-label package should
forward the "write" function to its parent.

Reviewed-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 slof/fs/packages/disk-label.fs | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Alexey Kardashevskiy Nov. 24, 2016, 6:44 a.m. UTC | #1
On 16/11/16 00:02, Thomas Huth wrote:
> As with the "read" function, the disk-label package should
> forward the "write" function to its parent.
> 
> Reviewed-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
> Signed-off-by: Thomas Huth <thuth@redhat.com>

After this patch, I cannot boot a guest at all:


qemu-system-ppc64: Incorrect order for descriptors


This is my cmdline (basically, virtio-scsi):

/home/aik/p/qemu/ppc64-softmmu/qemu-system-ppc64 -nodefaults -chardev
stdio,id=STDIO0,signal=off,mux=on -device
spapr-vty,id=svty0,chardev=STDIO0,reg=0x71000100 -mon
id=MON0,chardev=STDIO0,mode=readline -nographic -vga none -enable-kvm
-device virtio-scsi-pci,id=vscsi0 -drive
id=DRIVE0,if=none,file=img/u16_04_32G_htx_406.qcow2,format=qcow2 -device
scsi-disk,id=scsi-disk0,drive=DRIVE0 -bios ./slof.bin -machine pseries





> ---
>  slof/fs/packages/disk-label.fs | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/slof/fs/packages/disk-label.fs b/slof/fs/packages/disk-label.fs
> index e034d64..8859fb0 100644
> --- a/slof/fs/packages/disk-label.fs
> +++ b/slof/fs/packages/disk-label.fs
> @@ -126,6 +126,11 @@ CONSTANT /gpt-part-entry
>     debug-disk-label? IF dup ." actual=" .d cr THEN
>  ;
>  
> +: write ( addr len -- actual )
> +   debug-disk-label? IF 2dup swap ." write-parent: addr=0x" u. ." len=" .d THEN
> +   s" write" $call-parent
> +   debug-disk-label? IF dup ." actual=" .d cr THEN
> +;
>  
>  \ read sector to array "block"
>  : read-sector ( sector-number -- )
>
Nikunj A Dadhania Nov. 24, 2016, 7:04 a.m. UTC | #2
Alexey Kardashevskiy <aik@ozlabs.ru> writes:

> On 16/11/16 00:02, Thomas Huth wrote:
>> As with the "read" function, the disk-label package should
>> forward the "write" function to its parent.
>> 
>> Reviewed-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
>> Signed-off-by: Thomas Huth <thuth@redhat.com>
>
> After this patch, I cannot boot a guest at all:

Works for me with the below command-line, am I missing something?

> qemu-system-ppc64: Incorrect order for descriptors
>
>
> This is my cmdline (basically, virtio-scsi):
>
> /home/aik/p/qemu/ppc64-softmmu/qemu-system-ppc64 -nodefaults -chardev
> stdio,id=STDIO0,signal=off,mux=on -device
> spapr-vty,id=svty0,chardev=STDIO0,reg=0x71000100 -mon
> id=MON0,chardev=STDIO0,mode=readline -nographic -vga none -enable-kvm
> -device virtio-scsi-pci,id=vscsi0 -drive
> id=DRIVE0,if=none,file=img/u16_04_32G_htx_406.qcow2,format=qcow2 -device
> scsi-disk,id=scsi-disk0,drive=DRIVE0 -bios ./slof.bin -machine pseries
>

./ppc64-softmmu/qemu-system-ppc64 -nodefaults -chardev  stdio,id=STDIO0,signal=off,mux=on -device spapr-vty,id=svty0,chardev=STDIO0,reg=0x71000100 -mon id=MON0,chardev=STDIO0,mode=readline -nographic -vga none -device virtio-scsi-pci,id=vscsi0 -drive id=DRIVE0,if=none,file=./u1604.01.img  -device scsi-disk,id=scsi-disk0,drive=DRIVE0 -bios ./slof.bin -machine pseries --enable-kvm


SLOF **********************************************************************
QEMU Starting
 Build Date = Nov 24 2016 12:25:29
 FW Version = git-24559a3a2429004f
 Press "s" to enter Open Firmware.

Populating /vdevice methods
Populating /vdevice/nvram@71000000
Populating /vdevice/vty@71000100
Populating /pci@800000020000000
                     00 0000 (D) : 1af4 1004    virtio [ scsi ]
Populating /pci@800000020000000/scsi@0
       SCSI: Looking for devices
          100000000000000 DISK     : "QEMU     QEMU HARDDISK    2.5+"
No NVRAM common partition, re-initializing...
Scanning USB 
Using default console: /vdevice/vty@71000100
     
  Welcome to Open Firmware

  Copyright (c) 2004, 2011 IBM Corporation All rights reserved.
  This program and the accompanying materials are made available
  under the terms of the BSD License available at
  http://www.opensource.org/licenses/bsd-license.php


Trying to load:  from: /pci@800000020000000/scsi@0/disk@100000000000000 ...   Successfully loaded
error: no suitable video mode found.



                    GNU GRUB  version 2.02~beta2-36ubuntu3.2

 +----------------------------------------------------------------------------+
 | Ubuntu                                                                     | 


Regards
Nikunj
Thomas Huth Nov. 24, 2016, 7:08 a.m. UTC | #3
On 24.11.2016 08:04, Nikunj A Dadhania wrote:
> Alexey Kardashevskiy <aik@ozlabs.ru> writes:
> 
>> On 16/11/16 00:02, Thomas Huth wrote:
>>> As with the "read" function, the disk-label package should
>>> forward the "write" function to its parent.
>>>
>>> Reviewed-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
>>> Signed-off-by: Thomas Huth <thuth@redhat.com>
>>
>> After this patch, I cannot boot a guest at all:
> 
> Works for me with the below command-line, am I missing something?

Did you try to use a "grub-reboot" command, so that grub also tries to
write to the disk?

>> qemu-system-ppc64: Incorrect order for descriptors
>>
>>
>> This is my cmdline (basically, virtio-scsi):

Sorry, I did not check virtio-scsi, only vscsi and virtio-blk ... I'll
have a look ...

 Thomas
Nikunj A Dadhania Nov. 24, 2016, 8:04 a.m. UTC | #4
Thomas Huth <thuth@redhat.com> writes:

> On 24.11.2016 08:04, Nikunj A Dadhania wrote:
>> Alexey Kardashevskiy <aik@ozlabs.ru> writes:
>> 
>>> On 16/11/16 00:02, Thomas Huth wrote:
>>>> As with the "read" function, the disk-label package should
>>>> forward the "write" function to its parent.
>>>>
>>>> Reviewed-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
>>>> Signed-off-by: Thomas Huth <thuth@redhat.com>
>>>
>>> After this patch, I cannot boot a guest at all:
>> 
>> Works for me with the below command-line, am I missing something?
>
> Did you try to use a "grub-reboot" command, so that grub also tries to
> write to the disk?

Nope, Alexey mentioned that guest does not boot at all.


>>> qemu-system-ppc64: Incorrect order for descriptors
>>>
>>>
>>> This is my cmdline (basically, virtio-scsi):
>
> Sorry, I did not check virtio-scsi, only vscsi and virtio-blk ... I'll
> have a look ...

Regards
Nikunj
Alexey Kardashevskiy Nov. 24, 2016, 8:06 a.m. UTC | #5
On 24/11/16 18:04, Nikunj A Dadhania wrote:
> Alexey Kardashevskiy <aik@ozlabs.ru> writes:
> 
>> On 16/11/16 00:02, Thomas Huth wrote:
>>> As with the "read" function, the disk-label package should
>>> forward the "write" function to its parent.
>>>
>>> Reviewed-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
>>> Signed-off-by: Thomas Huth <thuth@redhat.com>
>>
>> After this patch, I cannot boot a guest at all:
> 
> Works for me with the below command-line, am I missing something?

Did you boot the system or you stopped at grub?

I get to the grub and I choose what to boot and then I get an error.


> 
>> qemu-system-ppc64: Incorrect order for descriptors
>>
>>
>> This is my cmdline (basically, virtio-scsi):
>>
>> /home/aik/p/qemu/ppc64-softmmu/qemu-system-ppc64 -nodefaults -chardev
>> stdio,id=STDIO0,signal=off,mux=on -device
>> spapr-vty,id=svty0,chardev=STDIO0,reg=0x71000100 -mon
>> id=MON0,chardev=STDIO0,mode=readline -nographic -vga none -enable-kvm
>> -device virtio-scsi-pci,id=vscsi0 -drive
>> id=DRIVE0,if=none,file=img/u16_04_32G_htx_406.qcow2,format=qcow2 -device
>> scsi-disk,id=scsi-disk0,drive=DRIVE0 -bios ./slof.bin -machine pseries
>>
> 
> ./ppc64-softmmu/qemu-system-ppc64 -nodefaults -chardev  stdio,id=STDIO0,signal=off,mux=on -device spapr-vty,id=svty0,chardev=STDIO0,reg=0x71000100 -mon id=MON0,chardev=STDIO0,mode=readline -nographic -vga none -device virtio-scsi-pci,id=vscsi0 -drive id=DRIVE0,if=none,file=./u1604.01.img  -device scsi-disk,id=scsi-disk0,drive=DRIVE0 -bios ./slof.bin -machine pseries --enable-kvm
> 
> 
> SLOF **********************************************************************
> QEMU Starting
>  Build Date = Nov 24 2016 12:25:29
>  FW Version = git-24559a3a2429004f
>  Press "s" to enter Open Firmware.
> 
> Populating /vdevice methods
> Populating /vdevice/nvram@71000000
> Populating /vdevice/vty@71000100
> Populating /pci@800000020000000
>                      00 0000 (D) : 1af4 1004    virtio [ scsi ]
> Populating /pci@800000020000000/scsi@0
>        SCSI: Looking for devices
>           100000000000000 DISK     : "QEMU     QEMU HARDDISK    2.5+"
> No NVRAM common partition, re-initializing...
> Scanning USB 
> Using default console: /vdevice/vty@71000100
>      
>   Welcome to Open Firmware
> 
>   Copyright (c) 2004, 2011 IBM Corporation All rights reserved.
>   This program and the accompanying materials are made available
>   under the terms of the BSD License available at
>   http://www.opensource.org/licenses/bsd-license.php
> 
> 
> Trying to load:  from: /pci@800000020000000/scsi@0/disk@100000000000000 ...   Successfully loaded
> error: no suitable video mode found.
> 
> 
> 
>                     GNU GRUB  version 2.02~beta2-36ubuntu3.2
> 
>  +----------------------------------------------------------------------------+
>  | Ubuntu                                                                     | 
> 
> 
> Regards
> Nikunj
>
Nikunj A Dadhania Nov. 24, 2016, 8:20 a.m. UTC | #6
Alexey Kardashevskiy <aik@ozlabs.ru> writes:

> On 24/11/16 18:04, Nikunj A Dadhania wrote:
>> Alexey Kardashevskiy <aik@ozlabs.ru> writes:
>> 
>>> On 16/11/16 00:02, Thomas Huth wrote:
>>>> As with the "read" function, the disk-label package should
>>>> forward the "write" function to its parent.
>>>>
>>>> Reviewed-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
>>>> Signed-off-by: Thomas Huth <thuth@redhat.com>
>>>
>>> After this patch, I cannot boot a guest at all:
>> 
>> Works for me with the below command-line, am I missing something?
>
> Did you boot the system or you stopped at grub?
>
> I get to the grub and I choose what to boot and then I get an error.
>
>
>> 
>>> qemu-system-ppc64: Incorrect order for descriptors

As suggested by Thomas, I am able to reproduce this with following steps:

1) Boot the guest (boots till login)
2) use grub-reboot command
3) reboot the guest

Then during the reboot cycle I see this error.

Regards
Nikunj
Thomas Huth Nov. 24, 2016, 8:59 a.m. UTC | #7
On 24.11.2016 07:44, Alexey Kardashevskiy wrote:
> On 16/11/16 00:02, Thomas Huth wrote:
>> As with the "read" function, the disk-label package should
>> forward the "write" function to its parent.
>>
>> Reviewed-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
>> Signed-off-by: Thomas Huth <thuth@redhat.com>
> 
> After this patch, I cannot boot a guest at all:
> 
> 
> qemu-system-ppc64: Incorrect order for descriptors

OK, I just sent a patch for fixing virtio-scsi. If you want to maintain
bisectability of the tree, could you please commit it first, before
committing the four patches of this series? Thanks!

 Thomas
Alexey Kardashevskiy Nov. 24, 2016, 12:42 p.m. UTC | #8
On 24/11/16 18:08, Thomas Huth wrote:
> On 24.11.2016 08:04, Nikunj A Dadhania wrote:
>> Alexey Kardashevskiy <aik@ozlabs.ru> writes:
>>
>>> On 16/11/16 00:02, Thomas Huth wrote:
>>>> As with the "read" function, the disk-label package should
>>>> forward the "write" function to its parent.
>>>>
>>>> Reviewed-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
>>>> Signed-off-by: Thomas Huth <thuth@redhat.com>
>>>
>>> After this patch, I cannot boot a guest at all:
>>
>> Works for me with the below command-line, am I missing something?
> 
> Did you try to use a "grub-reboot" command, so that grub also tries to
> write to the disk?

Where/why would I use this "grub-reboot"? :) I just tried a disk image with
2 kernels to see if grub writes/reads the last choice.


>>> qemu-system-ppc64: Incorrect order for descriptors
>>>
>>>
>>> This is my cmdline (basically, virtio-scsi):
> 
> Sorry, I did not check virtio-scsi, only vscsi and virtio-blk ... I'll
> have a look ...

I am missing the point of virtio-blk and (especially) ibmvscsi, is there
any case when either is better than virtio-scsi?

btw I tried that "virtio-scsi: Fix descriptor order for SCSI WRITE
commands", it helped, now it boots and remembers the last choice, thanks!
Thomas Huth Nov. 24, 2016, 1:57 p.m. UTC | #9
On 24.11.2016 13:42, Alexey Kardashevskiy wrote:
> On 24/11/16 18:08, Thomas Huth wrote:
>> On 24.11.2016 08:04, Nikunj A Dadhania wrote:
>>> Alexey Kardashevskiy <aik@ozlabs.ru> writes:
>>>
>>>> On 16/11/16 00:02, Thomas Huth wrote:
>>>>> As with the "read" function, the disk-label package should
>>>>> forward the "write" function to its parent.
>>>>>
>>>>> Reviewed-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
>>>>> Signed-off-by: Thomas Huth <thuth@redhat.com>
>>>>
>>>> After this patch, I cannot boot a guest at all:
>>>
>>> Works for me with the below command-line, am I missing something?
>>
>> Did you try to use a "grub-reboot" command, so that grub also tries to
>> write to the disk?
> 
> Where/why would I use this "grub-reboot"? :) I just tried a disk image with
> 2 kernels to see if grub writes/reads the last choice.

It's a Linux command, so you've got to boot to the Linux shell prompt
first. ... and actually, it's called "grub2-reboot" on my system, sorry
for the confusion.

>>>> qemu-system-ppc64: Incorrect order for descriptors
>>>>
>>>>
>>>> This is my cmdline (basically, virtio-scsi):
>>
>> Sorry, I did not check virtio-scsi, only vscsi and virtio-blk ... I'll
>> have a look ...
> 
> I am missing the point of virtio-blk and (especially) ibmvscsi, is there
> any case when either is better than virtio-scsi?

I'm lazy, so when I fire up a guest from the command line, I normally
only type "-hda mydisk.qcow2" instead of the whole -driver & -device
dance. But with -hda, you only get a vscsi image, so this was where I
looked at first.
Then, after that, I thought I'd cover all SCSI disks, since my patch
only affected the generic SCSI code, so I just had another look at
virtio-block.

But to answer your question in a more profund way:
- Apart from the easier command line, vscsi has the only advantage that
it might also work with very, very old guests that do not have drivers
for virtio-block or virtio-scsi yet.
- virtio-block might be a tiny, tiny little bit faster than virtio-scsi
since you can skip the SCSI emulation layer in this case
- AFAIK virtio-scsi has more features than virtio-block.

 Thomas
diff mbox

Patch

diff --git a/slof/fs/packages/disk-label.fs b/slof/fs/packages/disk-label.fs
index e034d64..8859fb0 100644
--- a/slof/fs/packages/disk-label.fs
+++ b/slof/fs/packages/disk-label.fs
@@ -126,6 +126,11 @@  CONSTANT /gpt-part-entry
    debug-disk-label? IF dup ." actual=" .d cr THEN
 ;
 
+: write ( addr len -- actual )
+   debug-disk-label? IF 2dup swap ." write-parent: addr=0x" u. ." len=" .d THEN
+   s" write" $call-parent
+   debug-disk-label? IF dup ." actual=" .d cr THEN
+;
 
 \ read sector to array "block"
 : read-sector ( sector-number -- )