This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


Re: [Xen-devel] [VTD][patch 1/5] HVM device assignment using vt-d

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: Re: [Xen-devel] [VTD][patch 1/5] HVM device assignment using vt-d
From: Mark Williamson <mark.williamson@xxxxxxxxxxxx>
Date: Thu, 31 May 2007 02:37:34 +0100
Cc: "Kay, Allen M" <allen.m.kay@xxxxxxxxx>
Delivery-date: Wed, 30 May 2007 18:35:46 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <255498EAB77FB240B3951466AD2340D502FD3891@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <255498EAB77FB240B3951466AD2340D502FD3891@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: KMail/1.9.6
On Wednesday 30 May 2007, Kay, Allen M wrote:
> vtd1.patch:
>     - vt-d specific code
>     - low risk changes in common code
> Signed-off-by: Allen Kay <allen.m.kay@xxxxxxxxx>
> Signed-off-by: Xiaohui Xin <xiaohui.xin@xxxxxxxxx>

iommu_set_root_entry can exit with locking.  Is this unintentional behaviour?

/* iommu handling */
static int iommu_set_root_entry(struct iommu *iommu)
    void *addr;
    u32 cmd, sts;
    struct root_entry *root;
    unsigned long flags;

    if (iommu == NULL)
        gdprintk(XENLOG_ERR VTDPREFIX,
            "iommu_set_root_entry: iommu == NULL\n");

    spin_lock_irqsave(&iommu->lock, flags);

MAW: if iommu->root_entry is already set at this point

    if (!iommu->root_entry) {
        spin_unlock_irqrestore(&iommu->lock, flags);
        root = (struct root_entry *)alloc_xenheap_page();
        memset((u8*)root, 0, PAGE_SIZE);
        iommu_flush_cache_page(iommu, root);
        spin_lock_irqsave(&iommu->lock, flags);

        if (!root && !iommu->root_entry) {
            spin_unlock_irqrestore(&iommu->lock, flags);
            return -ENOMEM;

        if (!iommu->root_entry)
            iommu->root_entry = root;
        else /* somebody is fast */
            free_xenheap_page((void *)root);
        spin_unlock_irqrestore(&iommu->lock, flags);

MAW: then we never unlock iommu->lock.  In all other cases it's released 
before we return.


Dave: Just a question. What use is a unicyle with no seat?  And no pedals!
Mark: To answer a question with a question: What use is a skateboard?
Dave: Skateboards have wheels.
Mark: My wheel has a wheel!

Xen-devel mailing list

<Prev in Thread] Current Thread [Next in Thread>