From: Ian Campbell Subject: Re: [PATCH] libbxl: add support for pvscsi, iteration 1 Date: Fri, 2 May 2014 16:30:59 +0100 Message-ID: <1399044659.18944.18.camel@kazak.uk.xensource.com> References: <1398855802-29618-1-git-send-email-olaf@aepfle.de> <20140502143653.GA13295@aepfle.de> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20140502143653.GA13295@aepfle.de> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Olaf Hering Cc: Ondrej Holecek , Ian Jackson , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On Fri, 2014-05-02 at 16:36 +0200, Olaf Hering wrote: > On Wed, Apr 30, Olaf Hering wrote: > > > Add support for vscsi= in domU.cfg, add new xl commands scsi-attach, > > scsi-list, scsi-detach. The syntax follows what xend understood. > > > > pvscsi provides a dom0 SCSI device as-is to a domU. The backend and > > frontend drivers can be found in xen-linux, or its forward-ported > > variants. This patch was tested with an openSUSE dom0 and a SLES12 > > guest. Any openSUSE/SLE11/SLE12 dom0/domU combination will work. > > One question regarding device index handling in xenstore: > > If devices get removed and added at runtime, they will appear as > /local/domain/0/backend///, like > /local/domain/0/backend/vif/3/0. > > What is supposed to happen with index if, in this example, > network-attach adds another device, network-detach removes it again, > later network-attach adds yet another device? The first attach will most > likely use index==1. network-detach will remove the device with index 1. > Is the last network-attach supposed to use index 2, or is it allowed to > reuse index 1? Right now I'm not seeing an index counter for > /local/domain/0/backend/vif/3, so I assume it will pick 1. The function to look at is libxl__device_nextid, which I think is buggy in the scenario you describe since it only looks at the number of entries, not which ones are used. > While working on scsi-attach/scsi-detach I was wondering if the new code > should maintain some counter so that new vscsi hosts get a new number > which was not in use before. Same for vscsi devs. It looks like xend > maintained an internal global counter for (at least) all devs. Surely > such counter was easy to maintain for xend as it controls everything. > > If no such counter is required I have to assume that by the time the > toolstack reuses index 1 everything in backend/frontend has released all > references to index 1. No races should happen. > > Is that assumption correct for all kind of backend devices? I'm not sure. Perhaps libxl__device_nextid should use a xenstore transaction to read , increment and write a suitable counter, perhaps under /libxl? Ian.