All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: Michal Privoznik <mprivozn@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PULL 22/27] vl: Create block backends before setting machine properties
Date: Mon, 03 Jun 2019 19:40:32 +0200	[thread overview]
Message-ID: <87zhmysh2n.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: ea01ee11-8888-444d-1f51-387dc73464f5@redhat.com

I apologize for the delay, got distracted.

Michal Privoznik <mprivozn@redhat.com> writes:

> On 5/16/19 1:43 PM, Markus Armbruster wrote:
> <snip/>
>
>>> Actually, there is more problems with this. Trying to run a guest with
>>> persistent reservations fails after this patch is applied (git bisect
>>> points me to this commit). My command line is:
>>>
>>> qemu.git $ ./x86_64-softmmu/qemu-system-x86_64 \
>>> -monitor stdio \
>>> -object pr-manager-helper,id=pr-helper0,path=/tmp/pr-helper0.sock
>>> -drive
>>> file=/dev/mapper/crypt,file.pr-manager=pr-helper0,format=raw,if=none,id=drive-scsi0-0-0-2
>>> \
>>> -device
>>> scsi-block,bus=scsi0.0,channel=0,scsi-id=0,lun=2,drive=drive-scsi0-0-0-2,id=scsi0-0-0-2
>>>
>>> Honestly, I have no idea how to fix it, so I'm just raising this issue
>>> here. Do you want me to open a bug or something?
>>
>> Let's skip the bug filing bureaucracy and go straight to debugging.
>
> Agreed.
>
>>
>> Actual and expected behavior of your reproducer, please :)
>>
>
> Actual is that qemu fails to parse cmd line:
>
>
> qemu-system-x86_64: -drive
> file=/dev/mapper/crypt,file.pr-manager=pr-helper0,format=raw,if=none,id=drive-scsi0-0-0-2:
> No persistent reservation manager with id 'pr-helper0'
>
>
> Which obviously is not correct, because pr-helper0 is specified.
> Expected result is that qemu suceeds in parsing the cmd line and
> starts the guest. To test it you don't need /dev/mapper/* really, I
> mean, if qemu fails with a different error message (e.g. it can't open
> the disk or EPERM or whatever), it's a sign it got past the cmd line
> parsing successfuly.

Reproduced, thanks!

Here's what happens.  Our general problem is that qemu-system-FOO's
main() acts on command line arguments in its own idiosyncratic order.
There's not much method to its madness.  Whenever we find a case where
one kind of command line argument needs to refer to something created
for another kind later, we rejigger the order.

Some time back, Dan Berrangé ran into an "impossible" instance of this
general problem: some kinds of -object get referenced by certain
character devices (therefore, -object must be acted on before character
devices), but other kinds of -object reference other character devices
(therefore, -object must be acted on after character devices).  He
solved the problem by sorting the -object into two buckets (commit
f08f9271bfe):

* Normal ones are created pretty early, so they can be referenced by
  (most) other things.

* Delayed ones are created pretty late, so they can reference (most)
  other things.

The pr-manager-helper object is a delayed one (commit 7c9e527659c).

Worked because block backends got created even after delayed objects:

    qemu_opts_foreach(qemu_find_opts("object"),
                      user_creatable_add_opts_foreach,
                      object_create_initial, &error_fatal);
    [...]
    qemu_opts_foreach(qemu_find_opts("object"),
                      user_creatable_add_opts_foreach,
                      object_create_delayed, &error_fatal);
    [...]
    configure_blockdev(&bdo_queue, machine_class, snapshot);

Commit cda4aa9a5a0 moved the configure_blockdev() up:

    qemu_opts_foreach(qemu_find_opts("object"),
                      user_creatable_add_opts_foreach,
                      object_create_initial, &error_fatal);
    [...]
    /*
     * Note: we need to create block backends before
     * machine_set_property(), so machine properties can refer to
     * them.
     */
    configure_blockdev(&bdo_queue, machine_class, snapshot);
    [...]
    qemu_opts_foreach(qemu_find_opts("object"),
                      user_creatable_add_opts_foreach,
                      object_create_delayed, &error_fatal);

Now file-posix property "pr-manager" can no longer reference a
pr-manager-helper object.  Regression.

If I make pr-manager-helper a normal object, it again can reference it.

Paolo, why is pr-manager-helper a delayed object?  Why this hunk of
commit 7c9e527659c:

    diff --git a/vl.c b/vl.c
    index 9bb5058c3a..a121a65731 100644
    --- a/vl.c
    +++ b/vl.c
    @@ -2893,7 +2893,8 @@ static int machine_set_property(void *opaque,
      */
     static bool object_create_initial(const char *type)
     {
    -    if (g_str_equal(type, "rng-egd")) {
    +    if (g_str_equal(type, "rng-egd") ||
    +        g_str_has_prefix(type, "pr-manager-")) {
             return false;
         }



  reply	other threads:[~2019-06-03 17:41 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-11 22:08 [Qemu-devel] [PULL 00/27] Pflash and firmware configuration patches for 2019-03-11 Markus Armbruster
2019-03-11 22:08 ` [Qemu-devel] [PULL 01/27] pflash: Rename pflash_t to PFlashCFI01, PFlashCFI02 Markus Armbruster
2019-03-11 22:08 ` [Qemu-devel] [PULL 02/27] pflash_cfi01: Do not exit() on guest aborting "write to buffer" Markus Armbruster
2019-03-11 22:08 ` [Qemu-devel] [PULL 03/27] pflash_cfi01: Log use of flawed " Markus Armbruster
2019-03-11 22:08 ` [Qemu-devel] [PULL 04/27] pflash: Rename *CFI_PFLASH* to *PFLASH_CFI* Markus Armbruster
2019-03-11 22:08 ` [Qemu-devel] [PULL 05/27] hw: Use PFLASH_CFI0{1, 2} and TYPE_PFLASH_CFI0{1, 2} Markus Armbruster
2019-03-11 22:08 ` [Qemu-devel] [PULL 06/27] sam460ex: Don't size flash memory to match backing image Markus Armbruster
2019-03-11 22:08 ` [Qemu-devel] [PULL 07/27] ppc405_boards: Delete stale, disabled DEBUG_BOARD_INIT code Markus Armbruster
2019-03-11 22:08 ` [Qemu-devel] [PULL 08/27] ppc405_boards: Don't size flash memory to match backing image Markus Armbruster
2020-03-20 15:25   ` Peter Maydell
2020-03-20 16:10     ` Markus Armbruster
2019-03-11 22:08 ` [Qemu-devel] [PULL 09/27] r2d: Fix flash memory size, sector size, width, device ID Markus Armbruster
2019-03-11 22:08 ` [Qemu-devel] [PULL 10/27] mips_malta: Delete disabled, broken DEBUG_BOARD_INIT code Markus Armbruster
2019-03-11 22:08 ` [Qemu-devel] [PULL 11/27] hw/mips/malta: Remove fl_sectors variable Markus Armbruster
2019-03-11 22:08 ` [Qemu-devel] [PULL 12/27] hw/mips/malta: Restrict 'bios_size' variable scope Markus Armbruster
2019-03-11 22:08 ` [Qemu-devel] [PULL 13/27] mips_malta: Clean up definition of flash memory size somewhat Markus Armbruster
2019-03-11 22:08 ` [Qemu-devel] [PULL 14/27] pflash: Clean up after commit 368a354f02b, part 1 Markus Armbruster
2019-03-11 22:08 ` [Qemu-devel] [PULL 15/27] pflash: Clean up after commit 368a354f02b, part 2 Markus Armbruster
2019-03-11 22:08 ` [Qemu-devel] [PULL 16/27] qdev: Fix latent bug with compat_props and onboard devices Markus Armbruster
2019-03-11 22:08 ` [Qemu-devel] [PULL 17/27] qom: Move compat_props machinery from qdev to QOM Markus Armbruster
2019-03-11 22:08 ` [Qemu-devel] [PULL 18/27] vl: Fix latent bug with -global and onboard devices Markus Armbruster
2019-03-11 22:08 ` [Qemu-devel] [PULL 19/27] sysbus: Fix latent bug with " Markus Armbruster
2019-03-11 22:08 ` [Qemu-devel] [PULL 20/27] vl: Improve legibility of BlockdevOptions queue Markus Armbruster
2019-03-11 22:08 ` [Qemu-devel] [PULL 21/27] vl: Factor configure_blockdev() out of main() Markus Armbruster
2019-03-11 22:08 ` [Qemu-devel] [PULL 22/27] vl: Create block backends before setting machine properties Markus Armbruster
2019-05-16  8:29   ` Michal Privoznik
2019-05-16 11:43     ` Markus Armbruster
2019-05-16 12:44       ` Michal Privoznik
2019-06-03 17:40         ` Markus Armbruster [this message]
2019-06-04 13:29           ` Paolo Bonzini
2019-03-11 22:08 ` [Qemu-devel] [PULL 23/27] pflash_cfi01: Add pflash_cfi01_get_blk() helper Markus Armbruster
2019-03-11 22:08 ` [Qemu-devel] [PULL 24/27] pc_sysfw: Remove unused PcSysFwDevice Markus Armbruster
2019-03-11 22:08 ` [Qemu-devel] [PULL 25/27] pc_sysfw: Pass PCMachineState to pc_system_firmware_init() Markus Armbruster
2019-03-11 22:08 ` [Qemu-devel] [PULL 26/27] pc: Support firmware configuration with -blockdev Markus Armbruster
2019-03-11 22:08 ` [Qemu-devel] [PULL 27/27] docs/interop/firmware.json: Prefer -machine to if=pflash Markus Armbruster

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=87zhmysh2n.fsf@dusky.pond.sub.org \
    --to=armbru@redhat.com \
    --cc=mprivozn@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.