All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eduardo Habkost <ehabkost@redhat.com>
To: "Gonglei (Arei)" <arei.gonglei@huawei.com>
Cc: "chenliang (T)" <chenliang88@huawei.com>,
	"Huangweidong (C)" <weidong.huang@huawei.com>,
	"mst@redhat.com" <mst@redhat.com>,
	"aik@ozlabs.ru" <aik@ozlabs.ru>,
	"hutao@cn.fujitsu.com" <hutao@cn.fujitsu.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	"armbru@redhat.com" <armbru@redhat.com>,
	Gerd Hoffmann <kraxel@redhat.com>,
	"akong@redhat.com" <akong@redhat.com>,
	"agraf@suse.de" <agraf@suse.de>,
	"aliguori@amazon.com" <aliguori@amazon.com>,
	Luonengjun <luonengjun@huawei.com>,
	"Huangpeng (Peter)" <peter.huangpeng@huawei.com>,
	"hani@linux.com" <hani@linux.com>,
	"stefanha@redhat.com" <stefanha@redhat.com>,
	"pbonzini@redhat.com" <pbonzini@redhat.com>,
	"lcapitulino@redhat.com" <lcapitulino@redhat.com>,
	"kwolf@redhat.com" <kwolf@redhat.com>,
	"peter.crosthwaite@xilinx.com" <peter.crosthwaite@xilinx.com>,
	"imammedo@redhat.com" <imammedo@redhat.com>,
	"afaerber@suse.de" <afaerber@suse.de>
Subject: Re: [Qemu-devel] [PATCH v6 02/27] bootindex: add del_boot_device_path function
Date: Thu, 4 Sep 2014 10:22:43 -0300	[thread overview]
Message-ID: <20140904132243.GZ32084@thinpad.lan.raisama.net> (raw)
In-Reply-To: <33183CC9F5247A488A2544077AF1902086DC365B@SZXEMA503-MBS.china.huawei.com>

On Thu, Sep 04, 2014 at 03:01:41AM +0000, Gonglei (Arei) wrote:
> Hi,
> 
> > From: Eduardo Habkost [mailto:ehabkost@redhat.com]
> > Sent: Thursday, September 04, 2014 2:13 AM
> > Subject: Re: [PATCH v6 02/27] bootindex: add del_boot_device_path function
> > 
> > On Wed, Sep 03, 2014 at 06:45:56AM +0000, Gonglei (Arei) wrote:
> > [...]
> > > > > 4. When we hotplug the virtio-net-pci device, only pass virtio-net-pci's
> > pointer
> > > > to
> > > > > del_boot_device_path(). But virtio-net-pci != virtio-net-device, so I add a
> > > > function
> > > > > named is_same_fw_dev_path() to handle this situation.
> > > >
> > > > When hot-unplugging virtio-net-pci I'd expect we free both
> > > > virtio-net-pci and virtio-net-device (and therefore call
> > > > del_boot_device_path twice, once for each device).  Can you check that?
> > > >
> > > Yes, I can.
> > >
> > > The del_boot_device_path() is called only once, just for virtio-net-pci.
> > > For its child, virtio-net-devcie's resource is cleaned by qbus->child unrealizing
> > > process, will not call device_finalize().
> > 
> > Then we need to fix this to make sure there's a corresponding
> > del_boot_device_path() call (with the same pointer) to every
> > add_boot_device_path() call, instead of adding a hack to
> > del_boot_device_path().
> > 
> Good idea. We can add functions named $device_finalize_bootindex(), such as:
> 
> static void virtio_net_set_bootindex(Object *obj, Visitor *v, void *opaque,
>                                      const char *name, Error **errp)
> {
>     VirtIONet *n = VIRTIO_NET(obj);
>     
>     set_bootindex(&n->nic_conf, v, name, errp);
>     add_boot_device_path(n->nic_conf.bootindex,
>                          DEVICE(obj), "/ethernet-phy@0"); 
> }
> 
> static void virtio_net_finalize_bootindex(Object *obj, const char *name,
>                                           void *opaque)
> {
>     del_boot_device_path(DEVICE(obj));
> }
> ...
> object_property_add(obj, "bootindex", "int",
>                         virtio_net_get_bootindex, 
>                         virtio_net_set_bootindex,
>                         virtio_net_finalize_bootindex, dev, NULL);
> 
> as the previous email, we lay add_boot_device_path() in $device_set_bootindex,
> and lay del_boot_device_path() in $device_finalize_bootindex is a good idea IMO.

Whatever the approach we use, can we have a wrapper to reduce code
duplication? e.g. a:
  void device_add_bootindex_property(DeviceState *dev, int32_t *field, const char *suffix)
function.

Then instead of reimplementing set/get/finalize functions, device code
could just call something like:
  device_add_bootindex_property(dev, &n->nic_conf.bootindex,
                                "/ethernet-phy@0");

-- 
Eduardo

  reply	other threads:[~2014-09-04 13:23 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-30 10:00 [Qemu-devel] [PATCH v6 00/27] modify boot order of guest, and take effect after rebooting arei.gonglei
2014-08-30 10:00 ` [Qemu-devel] [PATCH v6 01/27] bootindex: add check bootindex function arei.gonglei
2014-08-30 10:00 ` [Qemu-devel] [PATCH v6 02/27] bootindex: add del_boot_device_path function arei.gonglei
2014-09-01  6:43   ` Gerd Hoffmann
2014-09-01  6:47     ` Gonglei (Arei)
2014-09-02 18:00       ` Eduardo Habkost
2014-09-03  2:35         ` Gonglei (Arei)
2014-09-03  6:24           ` Gerd Hoffmann
2014-09-03  6:45             ` Gonglei (Arei)
2014-09-03 18:13               ` Eduardo Habkost
2014-09-04  3:01                 ` Gonglei (Arei)
2014-09-04 13:22                   ` Eduardo Habkost [this message]
2014-09-05  0:44                     ` Gonglei (Arei)
2014-09-05  2:20                       ` Eduardo Habkost
2014-09-05  2:42                         ` Gonglei (Arei)
2014-09-05 14:56                           ` Eduardo Habkost
2014-09-04  6:15                 ` Gonglei (Arei)
2014-09-04 11:48                   ` Gonglei (Arei)
2014-09-04 12:06                     ` Gonglei (Arei)
2014-09-03  2:40         ` Gonglei (Arei)
2014-08-30 10:00 ` [Qemu-devel] [PATCH v6 03/27] fw_cfg: add fw_cfg_machine_reset function arei.gonglei
2014-08-30 10:00 ` [Qemu-devel] [PATCH v6 04/27] bootindex: rework add_boot_device_path function arei.gonglei
2014-08-30 10:00 ` [Qemu-devel] [PATCH v6 05/27] bootindex: support to set a existent device's bootindex to -1 arei.gonglei
2014-08-30 10:00 ` [Qemu-devel] [PATCH v6 06/27] bootindex: move setting bootindex on reset() instead of realize/init() arei.gonglei
2014-09-04 14:50   ` Eduardo Habkost
2014-09-05  0:09     ` Gonglei (Arei)
2014-08-30 10:00 ` [Qemu-devel] [PATCH v6 07/27] vl.c: add setter/getter functions for bootindex property arei.gonglei
2014-08-31  9:58   ` Michael S. Tsirkin
2014-09-01  1:02     ` Gonglei (Arei)
2014-09-03  7:47   ` Gonglei (Arei)
2014-09-03  8:20     ` Gerd Hoffmann
2014-09-03  8:37       ` Gonglei (Arei)
2014-09-04 15:01   ` Eduardo Habkost
2014-09-05  0:37     ` Gonglei (Arei)
2014-09-05  1:55       ` Eduardo Habkost
2014-09-05  2:07         ` Gonglei (Arei)
2014-09-05  2:21           ` Eduardo Habkost
2014-09-05  2:44             ` Gonglei (Arei)
2014-08-30 10:00 ` [Qemu-devel] [PATCH v6 08/27] virtio-net: add bootindex to qom property arei.gonglei
2014-08-30 10:00 ` [Qemu-devel] [PATCH v6 09/27] e1000: " arei.gonglei
2014-08-30 10:00 ` [Qemu-devel] [PATCH v6 10/27] eepro100: " arei.gonglei
2014-08-30 10:00 ` [Qemu-devel] [PATCH v6 11/27] ne2000: " arei.gonglei
2014-08-30 10:00 ` [Qemu-devel] [PATCH v6 12/27] pcnet: " arei.gonglei
2014-08-30 10:00 ` [Qemu-devel] [PATCH v6 13/27] rtl8139: " arei.gonglei
2014-08-30 10:00 ` [Qemu-devel] [PATCH v6 14/27] spapr_lian: " arei.gonglei
2014-08-30 10:00 ` [Qemu-devel] [PATCH v6 15/27] vmxnet3: " arei.gonglei
2014-08-30 10:00 ` [Qemu-devel] [PATCH v6 16/27] usb-net: " arei.gonglei
2014-08-30 10:00 ` [Qemu-devel] [PATCH v6 17/27] net: remove bootindex property from qdev to qom arei.gonglei
2014-08-30 10:00 ` [Qemu-devel] [PATCH v6 18/27] host-libusb: " arei.gonglei
2014-08-30 10:00 ` [Qemu-devel] [PATCH v6 19/27] pci-assign: " arei.gonglei
2014-08-30 10:00 ` [Qemu-devel] [PATCH v6 20/27] vfio: " arei.gonglei
2014-08-30 10:00 ` [Qemu-devel] [PATCH v6 21/27] redirect: " arei.gonglei
2014-08-30 10:00 ` [Qemu-devel] [PATCH v6 22/27] isa-fdc: remove bootindexA/B " arei.gonglei
2014-08-30 10:00 ` [Qemu-devel] [PATCH v6 23/27] ide: add bootindex to qom property arei.gonglei
2014-08-30 10:00 ` [Qemu-devel] [PATCH v6 24/27] scsi: " arei.gonglei
2014-08-30 10:00 ` [Qemu-devel] [PATCH v6 25/27] virtio-blk: " arei.gonglei
2014-08-30 10:00 ` [Qemu-devel] [PATCH v6 26/27] block: remove bootindex property from qdev to qom arei.gonglei
2014-08-30 10:00 ` [Qemu-devel] [PATCH v6 27/27] bootindex: delete bootindex when device is removed arei.gonglei

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=20140904132243.GZ32084@thinpad.lan.raisama.net \
    --to=ehabkost@redhat.com \
    --cc=afaerber@suse.de \
    --cc=agraf@suse.de \
    --cc=aik@ozlabs.ru \
    --cc=akong@redhat.com \
    --cc=aliguori@amazon.com \
    --cc=arei.gonglei@huawei.com \
    --cc=armbru@redhat.com \
    --cc=chenliang88@huawei.com \
    --cc=hani@linux.com \
    --cc=hutao@cn.fujitsu.com \
    --cc=imammedo@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=luonengjun@huawei.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.crosthwaite@xilinx.com \
    --cc=peter.huangpeng@huawei.com \
    --cc=qemu-devel@nongnu.org \
    --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.