From: Keir Fraser Subject: Re: [PATCH][RFC] fix some spinlock issues in vmsi Date: Fri, 06 Mar 2009 08:28:26 +0000 Message-ID: References: <20090306053117.GA23417@ub-qhe2> Mime-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20090306053117.GA23417@ub-qhe2> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Qing He , Kouya Shimura Cc: Isaku Yamahata , "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org On 06/03/2009 05:31, "Qing He" wrote: > A similar problem also exists in msixtbl_write/msixtbl_read. Currently, > these functions access the mapped msix table using the pointer stored > in pci_dev, and when pci_dev is removed without the knowledge of the > guest, pci_dev alongside the fixmaps will be removed and this > definitely will frustrate these functions. Unfortunately, adding > spinlocks to msixtbl_{read,write} seems quite expensive, especially for > multiple guest threads, that's why RCU based lock is used here. For a > completely secure handling of this, maybe we need a less brute, > asynchronous pci_remove hypercall or something. Add the locks, making it correct. Then optimise later as necessary, using RCU or (perhaps easier) just smaller locks: Per MSI-X or per-pci-dev or whatever. Throwing in racey code condemns us to subtle races forever more. -- Keir