All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: "Gonglei (Arei)" <arei.gonglei@huawei.com>
Cc: "peter.maydell@linaro.org" <peter.maydell@linaro.org>,
	"Huangweidong (C)" <weidong.huang@huawei.com>,
	"mst@redhat.com" <mst@redhat.com>,
	"aik@ozlabs.ru" <aik@ozlabs.ru>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	"lcapitulino@redhat.com" <lcapitulino@redhat.com>,
	"kraxel@redhat.com" <kraxel@redhat.com>,
	"dmitry@daynix.com" <dmitry@daynix.com>,
	"akong@redhat.com" <akong@redhat.com>,
	"agraf@suse.de" <agraf@suse.de>,
	"lersek@redhat.com" <lersek@redhat.com>,
	Eduardo Habkost <ehabkost@redhat.com>,
	"marcel.a@redhat.com" <marcel.a@redhat.com>,
	"somlo@cmu.edu" <somlo@cmu.edu>,
	Luonengjun <luonengjun@huawei.com>,
	"peter.crosthwaite@xilinx.com" <peter.crosthwaite@xilinx.c.om>,
	"Huangpeng (Peter)" <peter.huangpeng@huawei.com>,
	"alex.williamson@redhat.com" <alex.williamson@redhat.com>,
	"stefanha@redhat.com" <stefanha@redhat.com>,
	"pbonzini@redhat.com" <pbonzini@redhat.com>,
	"rth@twiddle.net" <rth@twiddle.net>,
	"kwolf@redhat.com" <kwolf@redhat.com>,
	"chenliang (T)" <chenliang88@huawei.com>,
	"imammedo@redhat.com" <imammedo@redhat.com>,
	"afaerber@suse.de" <afaerber@suse.de>
Subject: Re: [Qemu-devel] [PATCH v2 5/7] qmp: add set-bootindex command
Date: Mon, 04 Aug 2014 13:46:55 +0200	[thread overview]
Message-ID: <87vbq81nps.fsf@blackfin.pond.sub.org> (raw)
In-Reply-To: <33183CC9F5247A488A2544077AF1902086C26E4B@SZXEMA503-MBS.china.huawei.com> (Gonglei's message of "Mon, 4 Aug 2014 11:04:22 +0000")

"Gonglei (Arei)" <arei.gonglei@huawei.com> writes:

> Hi, Markus
>
>> >> >> Subject: Re: [Qemu-devel] [PATCH v2 5/7] qmp: add set-bootindex
>> command
>> >> >>
>> >> >> On Fri, Jul 25, 2014 at 02:52:50PM +0800, arei.gonglei@huawei.com
>> wrote:
>> >> >> > From: Gonglei <arei.gonglei@huawei.com>
>> >> >> >
>> >> >> > Adds "set-bootindex id=xx,bootindex=xx,suffix=xx" QMP command.
>> >> >> >
>> >> >> > Example QMP command:
>> >> >> > -> { "execute": "set-bootindex", "arguments": { "id": "ide0-0-1",
>> >> >> > "bootindex":
>> >> >> 1, "suffix": "/disk@0"}}
>> >> >> > <- { "return": {} }
>> >> >> >
>> >> >> > Signed-off-by: Gonglei <arei.gonglei@huawei.com>
>> >> >> > Signed-off-by: Chenliang <chenliang88@huawei.com>
>> >> >> > ---
>> >> >> >  qapi-schema.json | 16 ++++++++++++++++
>> >> >> >  qmp-commands.hx  | 24 ++++++++++++++++++++++++
>> >> >> >  qmp.c            | 17 +++++++++++++++++
>> >> >> >  3 files changed, 57 insertions(+)
>> >> >> >
>> >> >> > diff --git a/qapi-schema.json b/qapi-schema.json
>> >> >> > index b11aad2..a9ef0be 100644
>> >> >> > --- a/qapi-schema.json
>> >> >> > +++ b/qapi-schema.json
>> >> >> > @@ -1704,6 +1704,22 @@
>> >> >> >  { 'command': 'device_del', 'data': {'id': 'str'} }
>> >> >> >
>> >> >> >  ##
>> >> >> > +# @set-bootindex:
>> >> >> > +#
>> >> >> > +# set bootindex of a devcie
>> >> >> > +#
>> >> >> > +# @id: the name of the device
>> >> >> > +# @bootindex: the bootindex of the device
>> >> >> > +# @suffix: #optional a suffix of the device
>> >> >> > +#
>> >> >> > +# Returns: Nothing on success
>> >> >> > +#          If @id is not a valid device, DeviceNotFound
>> >> >> > +#
>> >> >> > +# Since: 2.2
>> >> >> > +##
>> >> >> > +{ 'command': 'set-bootindex', 'data': {'id': 'str', 'bootindex':
>> >> >> > int', '*suffix':
>> >> >> 'str'} }
>> >> >> > +
>> >> >> > +##
>> >> >>
>> >> >> I wonder if we could simply use qom-set for that. How many devices
>> >> >> actually support having multiple bootindex entries with different
>> >> >> suffixes?
>> >> >>
>> >> > AFAICT, the floppy device support two bootindex with different suffixes.
>> >>
>> >> Block device models commonly a single block device.  By convention,
>> >> property "drive" is the backend, and property "bootindex" the bootindex,
>> >> if the device model supports that.
>> >>
>> >> The device ID suffices to identify a block device for such device
>> >> models.
>> >>
>> >> The floppy device model is an exception.  It folds multiple real-world
>> >> objects into one: the controller and the actual drives.  Have a look at
>> >> -device isa-fdc,help:
>> >>
>> >>     isa-fdc.iobase=uint32
>> >>     isa-fdc.irq=uint32
>> >>     isa-fdc.dma=uint32
>> >>     isa-fdc.driveA=drive
>> >>     isa-fdc.driveB=drive
>> >>     isa-fdc.bootindexA=int32
>> >>     isa-fdc.bootindexB=int32
>> >>     isa-fdc.check_media_rate=on/off
>> >>
>> >> The properties ending with 'A' or 'B' apply to the first and the second
>> >> drive, the others to the controller.
>> >>
>> >> Unfortunately, this means the device ID by itself doesn't identify the
>> >> floppy device.
>> >>
>> > Yes.
>> >
>> >> Arguably, this is lousy modeling --- we really should model separate
>> >> real-world objects as separate objects.  But making floppies pretty (or
>> >> even sane) isn't anyone's priority nowadays.
>> >>
>> > Hmm... Agreed.
>> >
>> >> Since qom-set works on *properties*, I can't see why it couldn't be used
>> >> for changing bootindexes.  There is no ambiguity even with floppy.
>> >
>> > Sorry?
>> >
>> >> You either set bootindexA or bootindexB.  No need to fuzz around with
>> >> suffixes.  Or am I missing something?
>> >
>> > Your mean that we just need to think about change one bootindex? Either
>> > set bootindexA or bootindexB, do not need pass suffix for identifying?
>> 
>> Eduardo suggested to think about using qom-set to update the bootindex.
>> 
>> Could look like
>> 
>>     { "execute": "qom-set",
>>       "arguments": { "path": "/machine/unattached/device[15]",
>>                      "property": "bootindexA", "value": 1 } }
>> 
>> Demonstrates an existing, well-defined way to identify the bootindex to
>> change.  Do we really want to invent another one, based on suffix?
>> 
>> The value of "path" is the QOM path.  I can't remember offhand how to go
>> from qdev ID to QOM path.  Onboard devices like isa-fdc don't have one
>> anyway.
>> 
>> I also don't remember whether there's a nicer QOM path than this one.
>
> Thanks for your explaining. TBH I haven't used "qom-set" before, so I

Few people have :)

> don't know what your mean (like Eduardo, sorry again). 
>
> But now, I have a look at the implement of "qom-set" command, and 
> I find the command is just change a device's property value, do not have
> any other logic. For my case, we really change value of the global
> fw_boot_order list,
> which the device's bootindex property worked for actually. Only in this way,
> we can attach our original target.

Why can't we delay the logic to the next reboot?  Let me explain.

Current code starts with empty fw_boot_order, then lets device realize
add to it.  Unplugging a device leaves a dangling DeviceState pointer in
the list (I think).

Could we instead build, use and free the list during reboot?  That way,
qom-set of bootindex affects the next reboot without additional logic.

  reply	other threads:[~2014-08-04 11:47 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-25  6:52 [Qemu-devel] [PATCH v2 0/7] modify boot order of guest, and take effect after rebooting arei.gonglei
2014-07-25  6:52 ` [Qemu-devel] [PATCH v2 1/7] bootindex: add modify_boot_device_path function arei.gonglei
2014-07-25  9:46   ` Gerd Hoffmann
2014-07-26  1:58     ` Gonglei (Arei)
2014-07-28  8:30       ` Gerd Hoffmann
2014-07-28  8:37         ` Gonglei (Arei)
2014-07-28  9:27           ` Gerd Hoffmann
2014-07-28  9:36             ` Gonglei (Arei)
2014-07-28 10:02               ` Gerd Hoffmann
2014-07-28 10:15                 ` Gonglei (Arei)
2014-07-29  3:56                 ` Gonglei (Arei)
2014-07-29  9:16                 ` Gonglei (Arei)
2014-07-25  6:52 ` [Qemu-devel] [PATCH v2 2/7] bootindex: add del_boot_device_path function arei.gonglei
2014-07-25  6:52 ` [Qemu-devel] [PATCH v2 3/7] fw_cfg: add fw_cfg_machine_reset function arei.gonglei
2014-07-25  6:52 ` [Qemu-devel] [PATCH v2 4/7] bootindex: delete bootindex when device is removed arei.gonglei
2014-07-25  9:51   ` Gerd Hoffmann
2014-07-26  1:49     ` Gonglei (Arei)
2014-07-30  7:29     ` Gonglei (Arei)
2014-08-01 14:33       ` Eduardo Habkost
2014-08-04  6:23         ` Gonglei (Arei)
2014-07-25  6:52 ` [Qemu-devel] [PATCH v2 5/7] qmp: add set-bootindex command arei.gonglei
2014-08-01 15:07   ` Eduardo Habkost
2014-08-04  6:36     ` Gonglei (Arei)
2014-08-04  8:14       ` Markus Armbruster
2014-08-04  8:34         ` Gonglei (Arei)
2014-08-04 10:00           ` Markus Armbruster
2014-08-04 11:04             ` Gonglei (Arei)
2014-08-04 11:46               ` Markus Armbruster [this message]
2014-08-04 12:13                 ` Gonglei (Arei)
2014-08-04 13:09                   ` Markus Armbruster
2014-08-05  2:29                     ` Gonglei (Arei)
2014-08-04 17:35             ` Eduardo Habkost
2014-07-25  6:52 ` [Qemu-devel] [PATCH v2 6/7] qemu-monitor: HMP set-bootindex wrapper arei.gonglei
2014-07-25  6:52 ` [Qemu-devel] [PATCH v2 7/7] spapr: fix possible memory leak arei.gonglei
2014-07-28 10:45   ` Alexander Graf
2014-07-29  0:54     ` Gonglei (Arei)

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=87vbq81nps.fsf@blackfin.pond.sub.org \
    --to=armbru@redhat.com \
    --cc=afaerber@suse.de \
    --cc=agraf@suse.de \
    --cc=aik@ozlabs.ru \
    --cc=akong@redhat.com \
    --cc=alex.williamson@redhat.com \
    --cc=arei.gonglei@huawei.com \
    --cc=chenliang88@huawei.com \
    --cc=dmitry@daynix.com \
    --cc=ehabkost@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=lersek@redhat.com \
    --cc=luonengjun@huawei.com \
    --cc=marcel.a@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.crosthwaite@xilinx.c.om \
    --cc=peter.huangpeng@huawei.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=somlo@cmu.edu \
    --cc=stefanha@redhat.com \
    --cc=weidong.huang@huawei.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 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.