xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Oleksandr Grytsov <al1img@gmail.com>
To: Wei Liu <wei.liu2@citrix.com>
Cc: xen-devel@lists.xenproject.org,
	Ian Jackson <ian.jackson@eu.citrix.com>,
	Oleksandr Grytsov <oleksandr_grytsov@epam.com>
Subject: Re: [PATCH v3 04/11] libxl: add generic function to add device
Date: Fri, 7 Jul 2017 12:49:10 +0300	[thread overview]
Message-ID: <CACvf2oXmsx7RLAybP94heMC5Ax9u_sqXOQgJFfpsoUv=LizafQ@mail.gmail.com> (raw)
In-Reply-To: <20170706155105.n5kp76wd266xjgic@citrix.com>

On Thu, Jul 6, 2017 at 6:51 PM, Wei Liu <wei.liu2@citrix.com> wrote:
> On Tue, Jun 27, 2017 at 01:03:20PM +0300, Oleksandr Grytsov wrote:
>> From: Oleksandr Grytsov <oleksandr_grytsov@epam.com>
>>
>> Add libxl__device_add functio.
>> Almost all devices have similar libxl__device_xxxx_add function.
>> This generic function implements same functionality but
>> using the device handling framework. The device specific
>> part this is setting xen store configuration. This part
>> is moved to set_xenstore_config callback of the device framework.
>>
>> Signed-off-by: Oleksandr Grytsov <oleksandr_grytsov@epam.com>
> [...]
>> +
>> +void libxl__device_add(libxl__egc *egc, uint32_t domid,
>> +                       const struct libxl_device_type *dt, void *type,
>> +                       libxl__ao_device *aodev)
>> +{
>> +    STATE_AO_GC(aodev->ao);
>> +    libxl__device *device;
>> +    int rc;
>> +
>> +    rc = dt->set_default(gc, domid, type);
>> +    if (rc) goto out;
>> +
>> +    GCNEW(device);
>> +    rc = dt->to_device(gc, domid, type, device);
>> +    if ( rc != 0 ) goto out;
>> +
>> +    rc = libxl__device_exists(gc, XBT_NULL, device);
>> +    if (rc < 0) goto out;
>> +    if (rc == 1) {              /* already exists in xenstore */
>> +        LOGD(ERROR, domid, "device already exists in xenstore");
>> +        aodev->action = LIBXL__DEVICE_ACTION_ADD; /* for error message */
>> +        rc = ERROR_DEVICE_EXISTS;
>> +        goto out;
>> +    }
>> +
>> +    if (aodev->update_json) {
>> +        rc = device_add_domain_config(gc, domid, dt, type);
>> +        if (rc) goto out;
>> +    }
>> +
>> +    if (dt->set_xenstore_config) {
>> +        rc = dt->set_xenstore_config(gc, domid, type);
>> +        if (rc) goto out;
>> +    }
>> +
>
> This has changed the locking hierarchy we define in libxl_internal.h.
> See libxl_internal.h:L2592.
>
> Either you need to preserve the hierarchy or you need to prove the
> correctness of the new approach. The former is probably easier.

Actually my the first patch probably was done on the old codebase
which doesn't have locking in add function. So new approach is
definitely wrong and I will use former one.

-- 
Best Regards,
Oleksandr Grytsov.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  reply	other threads:[~2017-07-07  9:49 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-27 10:03 [PATCH v3 00/11] libxl: add PV display device driver interface Oleksandr Grytsov
2017-06-27 10:03 ` [PATCH v3 01/11] libxl: add vdispl structures to idl Oleksandr Grytsov
2017-06-29 17:36   ` Wei Liu
2017-06-30 10:36     ` Oleksandr Grytsov
2017-06-30 14:15       ` Wei Liu
2017-06-27 10:03 ` [PATCH v3 02/11] libxl: add API for PV display device driver Oleksandr Grytsov
2017-06-27 10:03 ` [PATCH v3 03/11] libxl: add generic function to get and free device list Oleksandr Grytsov
2017-06-29 17:36   ` Wei Liu
2017-06-30 13:24     ` Oleksandr Grytsov
2017-07-06 15:29   ` Wei Liu
2017-07-10 12:22     ` Oleksandr Grytsov
2017-07-10 12:26       ` Oleksandr Grytsov
2017-07-12  9:51         ` Wei Liu
2017-07-12 13:43           ` Oleksandr Grytsov
2017-07-12 14:06             ` Wei Liu
2017-07-12  9:50       ` Wei Liu
2017-06-27 10:03 ` [PATCH v3 04/11] libxl: add generic function to add device Oleksandr Grytsov
2017-06-29 17:36   ` Wei Liu
2017-06-30 13:24     ` Oleksandr Grytsov
2017-06-30 14:16       ` Wei Liu
2017-06-30 14:18         ` Wei Liu
2017-07-03 12:53           ` Oleksandr Grytsov
2017-07-03 12:57             ` Wei Liu
2017-07-04  9:41               ` Oleksandr Grytsov
2017-07-12 16:13                 ` Oleksandr Grytsov
2017-07-18 13:35                   ` Wei Liu
2017-07-06 15:51   ` Wei Liu
2017-07-07  9:49     ` Oleksandr Grytsov [this message]
2017-07-07 10:29       ` Oleksandr Grytsov
2017-07-07 10:32         ` Wei Liu
2017-07-07 10:56           ` Oleksandr Grytsov
2017-07-10 12:41             ` Oleksandr Grytsov
2017-07-12 10:12               ` Wei Liu
2017-06-27 10:03 ` [PATCH v3 05/11] libxl: add vdispl setting xen store configuration Oleksandr Grytsov
2017-06-27 10:03 ` [PATCH v3 06/11] libxl: implement vdispl get info function Oleksandr Grytsov
2017-06-27 10:03 ` [PATCH v3 07/11] libxl: implement device_from_vdispl and update_config_vdispl Oleksandr Grytsov
2017-06-27 10:03 ` [PATCH v3 08/11] libxl: add libxl__vdispl_devtype to device_type_tbl Oleksandr Grytsov
2017-06-27 10:03 ` [PATCH v3 09/11] libxl: add libxl_devid_to_device_vdispl interface function Oleksandr Grytsov
2017-06-27 10:03 ` [PATCH v3 10/11] xl: add PV display device commands Oleksandr Grytsov
2017-06-27 10:03 ` [PATCH v3 11/11] docs: add PV display driver information Oleksandr Grytsov
2017-06-29 17:36   ` Wei Liu
2017-06-30 10:43     ` Oleksandr Grytsov
2017-06-29 17:38 ` [PATCH v3 00/11] libxl: add PV display device driver interface Wei Liu
2017-06-30 10:45   ` Oleksandr Grytsov
2017-06-30 14:20     ` Wei Liu

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='CACvf2oXmsx7RLAybP94heMC5Ax9u_sqXOQgJFfpsoUv=LizafQ@mail.gmail.com' \
    --to=al1img@gmail.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=oleksandr_grytsov@epam.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xenproject.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).