From: Wei Liu <wei.liu2@citrix.com>
To: Oleksandr Grytsov <al1img@gmail.com>
Cc: xen-devel@lists.xenproject.org, Wei Liu <wei.liu2@citrix.com>,
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: Wed, 12 Jul 2017 11:12:28 +0100 [thread overview]
Message-ID: <20170712101228.4n2xdaytcscr2jit@citrix.com> (raw)
In-Reply-To: <CACvf2oU42qUkZc+d=DCzJJFv1PAibQmLuUo83HNP-p7jO39GKg@mail.gmail.com>
On Mon, Jul 10, 2017 at 03:41:28PM +0300, Oleksandr Grytsov wrote:
> On Fri, Jul 7, 2017 at 1:56 PM, Oleksandr Grytsov <al1img@gmail.com> wrote:
> > On Fri, Jul 7, 2017 at 1:32 PM, Wei Liu <wei.liu2@citrix.com> wrote:
> >> On Fri, Jul 07, 2017 at 01:29:39PM +0300, Oleksandr Grytsov wrote:
> >> > 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.
> >>>
> >>> Please ignore my above comment. Actually it looks like my new approach
> >>> changes former behavior. I will rework this function to match former one.
> >>>
> >>> Actually new approach
> >>
> >> Hit "Send" too soon?
> >
> > Just forgot to remove this line. So, I will rework this part.
> >
>
> Few questions about former implementation (I address vtpm as reference
> but questions are related to all devices):
>
> 1. Using of libxl_device_vtpm vtpm_saved variable. It is unclear why
> we need this additional variable.
> There is no any rollback or cancellation with this variable.
> It is used to be added to the domain config but vtpm from input
> parameter can be used for this reason as well.
The vtpm_saved variable is a copy of the structure passed in by the caller.
We then pass vtpm to the _setdefault function which touches some of the
fields inside.
But then not all the fields changed by the _setdefault function need to
be written to our persistent domain configuration on disk. The fields we
care about are copied back to vtpm_saved by libxl__update_config_vtpm.
Then we save vtpm_saved.
For your particular device, you should provide a similar update_config
function.
>
> 2. Why libxl__update_config_vtpm(gc, &vtpm_saved, vtpm); is called if
> just before we copied
> vtpm_saved from vtpm?
>
> libxl_device_vtpm_init(&vtpm_saved);
> libxl_device_vtpm_copy(CTX, &vtpm_saved, vtpm);
>
> I see that dev id is updated but it could be done before copy operation.
>
But for different device type there are different things to save. Vtpm
is a bit more of a simplistic one. See also other update_config
function.
The code structure is deliberated. It is a pattern applicable for all
devices -- the implementer can easily follow the pattern.
> 3. What is reason to call libxl__set_domain_configuration(gc, domid,
> &d_config); in each
> xen store transaction attempt?
>
That would ensure the eventual consistency of the file written on disk
and the content in xenstore.
Keep in mind that there could be several threads competing with each
other to manipulate both the file on disk and xenstore.
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2017-07-12 10:12 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
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 [this message]
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=20170712101228.4n2xdaytcscr2jit@citrix.com \
--to=wei.liu2@citrix.com \
--cc=al1img@gmail.com \
--cc=ian.jackson@eu.citrix.com \
--cc=oleksandr_grytsov@epam.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).