WARNING - OLD ARCHIVES

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/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] mthca use of dma_sync_single is bogus

To: mst@xxxxxxxxxxxxxx, general@xxxxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] mthca use of dma_sync_single is bogus
From: Roland Dreier <rdreier@xxxxxxxxx>
Date: Mon, 09 Jul 2007 14:16:19 -0700
Authentication-results: sj-dkim-2; header.From=rdreier@xxxxxxxxx; dkim=pass ( sig from cisco.com/sjdkim2002 verified; );
Cc: Lukas Hejtmanek <xhejtman@xxxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxx, Keir Fraser <keir@xxxxxxxxxxxxx>
Delivery-date: Tue, 10 Jul 2007 10:10:30 -0700
Dkim-signature: v=0.5; a=rsa-sha256; q=dns/txt; l=1465; t=1184015780; x=1184879780; c=relaxed/simple; s=sjdkim2002; h=Content-Type:From:Subject:Content-Transfer-Encoding:MIME-Version; d=cisco.com; i=rdreier@xxxxxxxxx; z=From:=20Roland=20Dreier=20<rdreier@xxxxxxxxx> |Subject:=20mthca=20use=20of=20dma_sync_single=20is=20bogus |Sender:=20; bh=9bkKstb3J11cs/kKDq1tuQIeep0t/CZMrwGRVzxzaP0=; b=EzrJGfBr1i3ZVvEuqo+1/MjQxNupfLW2CAJ7E9S53LaHghUzjDT0ZHcyeZes8eiSJMXOdu9Q gBtvR2I5mkDBgUAnZTLH2sn+y2aqfPFVlmH15NbXnI6gtm4oN4C3Z6V6;
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
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>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.4.20 (linux)
It seems the problems running mthca in a Xen domU have uncovered a bug
in mthca: mthca uses dma_sync_single in mthca_arbel_write_mtt_seg()
and mthca_arbel_map_phys_fmr() to sync the MTTs that get written.
However, Documentation/DMA-API.txt says:

    void
    dma_sync_single(struct device *dev, dma_addr_t dma_handle, size_t size,
                enum dma_data_direction direction)

    synchronise a single contiguous or scatter/gather mapping.  All the
    parameters must be the same as those passed into the single mapping
    API.

and mthca is *not* following this clear rule: it is trying to sync
only a subrange of the mapping.  Later on in the document, there is:

    void
    dma_sync_single_range(struct device *dev, dma_addr_t dma_handle,
                      unsigned long offset, size_t size,
                      enum dma_data_direction direction)
    
    does a partial sync.  starting at offset and continuing for size.  You
    must be careful to observe the cache alignment and width when doing
    anything like this.  You must also be extra careful about accessing
    memory you intend to sync partially.

but that is in a section dealing with non-consistent memory so it's
not entirely clear to me whether it's kosher to use this as mthca
wants.

The other alternative is to put the MTT table in coherent memory just
like the MPT table.  That might be the best solution I suppose...

Michael, anyone else, thoughts on this?

 - R.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel