From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: Re: [PATCH v4 for 4.5 2/8] libxl: synchronise configuration when we hotplug a device Date: Tue, 16 Sep 2014 19:52:05 +0100 Message-ID: <1410893525.23505.27.camel@citrix.com> References: <1410861678-31428-1-git-send-email-wei.liu2@citrix.com> <1410861678-31428-3-git-send-email-wei.liu2@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1410861678-31428-3-git-send-email-wei.liu2@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Wei Liu Cc: ian.jackson@eu.citrix.com, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On Tue, 2014-09-16 at 11:01 +0100, Wei Liu wrote: > We update JSON version first, then write to xenstore, so that we > maintain the following invariant: any device which is present in > xenstore has a corresponding entry in JSON. > > The workflow is as followed: > lock json config > read json config > update in-memory json config with new entry, replacing > any stale entry > for loop > open xs transaction > check device existence, abort if it exists > write in-memory json config to disk > commit xs transaction > end for loop > unlock json config > > Please see comment in libxl_internal.h for correctness proof. > > As those routines are called both during domain creation and device > hotplug, we add a flag to indicate whether we need to update JSON > config. This flag is only set to true when we hotplug a device. We > cannot update JSON config during domain creation as JSON config is > committed to disk only when domain creation finishes. > > Signed-off-by: Wei Liu Acked-by: Ian Campbell