Re: [net-next 02/11] e1000: Adding e1000_dump function

Michal Kubeček
2012-02-07T17:38:11Z

On Tuesday 07 of February 2012 04:33EN, Jeff Kirsher wrote:
> + if (netif_msg_pktdata(adapter) && buffer_info->dma != 0)
> + print_hex_dump(KERN_INFO, "", DUMP_PREFIX_ADDRESS,
> + 16, 1, phys_to_virt(buffer_info->dma),
> + buffer_info->length, true);

This might cause problems in Xen environment, we encountered a crash in
e1000e where phys_to_virt() is used the same way. I'm not familiar with
the details but this is what Jan Beulich wrote about it:

> And the use of phys_to_virt() here seems wrong - buffer_info->dma,
> afaict, is being obtained via the dma_map_*() APIs, which do NOT
> return a physical address (the fact that what they return is identical
> to the corresponding physical address on native doesn't mean this is
> universally so).
>
> bus_to_virt() is what should be used here on Xen (though that isn't
> universally correct either afaik, but there simply is no
> dma_to_virt(); it *is* consistent on x86 and ia64 at least, while
> ppc64 is lacking a definition altogether [I would be very surprised
> though if this use of phys_to_virt() was correct on this arch, given
> that e.g. dma_direct_map_page() uses get_dma_offset() to obtain the
> DMA address]).

Michal Kubeček