xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Jean Baptiste Favre <xen-devel@jbfavre.org>
To: xen-devel@lists.xensource.com
Subject: Re: PCI passthrough issue
Date: Wed, 02 Feb 2011 16:56:57 +0100	[thread overview]
Message-ID: <4D497EC9.5080601@jbfavre.org> (raw)
In-Reply-To: <20110202153822.GA31878@dumpdata.com>


> >> Ping tests work whatever can be packet size.
> >>
> >> If I understood well what you explain to me, it's now clear that the
> >> problem is somewhat Xen related, isn't it ?
> >
> > It certainly seems that way. I'm not 100% sure that swiotlb=force will
> > have actually made the driver use the swiotlb, it may just have forced
>
> It should have.
>
> > the swiotlb to be allocated. Konrad?
>
> Both. It would allocate it and force all DMA operations to go through
> the bounce buffer.
>
> Let me take a look at the driver itself. Ah, so I had a similar card:
> 3c59x
> which hit the same type of failure way back in 2.6.31 time. It had the
> pci_dma_sync_single_for_cpu(.. PCI_DMA_FROMDEVICE) turned around so it
> would never
> copy properly. But in my tree (2.6.38) the sky driver looks to be
> doing just
> right.. It has PCI_DMA_FROMDEVICE..
>
> Well this looks odd:
>
> 2330         skb = netdev_alloc_skb_ip_align(sky2->netdev, length);
> 2331         if (likely(skb)) {
> 2332                 pci_dma_sync_single_for_cpu(sky2->hw->pdev,
> re->data_addr,
> 2333                                             length,
> PCI_DMA_FROMDEVICE);
> =======>             skb_copy_from_linear_data(re->skb, skb->data,
> length); <====
> 2335                 skb->ip_summed = re->skb->ip_summed;
> 2336                 skb->csum = re->skb->csum;
> 2337                 pci_dma_sync_single_for_device(sky2->hw->pdev,
> re->data_addr,
> 2338                                                length,
> PCI_DMA_FROMDEVICE);
> 2339                 re->skb->ip_summed = CHECKSUM_NONE;
> 2340                 skb_put(skb, length);
> 2341         }
>
> It copies from skb->data (just allocated) to re->skb (seems that the
> re->skb->data
> has been earlier DMA-mapped).
>
> But there is no data in skb->data as we just allocated it? Shouldn't this
> be the other way around? Like this:
>
>
> diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
> index 7d85a38..37c0631 100644
> --- a/drivers/net/sky2.c
> +++ b/drivers/net/sky2.c
> @@ -2331,7 +2331,7 @@ static struct sk_buff *receive_copy(struct
> sky2_port *sky2,
>      if (likely(skb)) {
>          pci_dma_sync_single_for_cpu(sky2->hw->pdev, re->data_addr,
>                          length, PCI_DMA_FROMDEVICE);
> -        skb_copy_from_linear_data(re->skb, skb->data, length);
> +        skb_copy_from_linear_data(skb, re->skb->data, length);
>          skb->ip_summed = re->skb->ip_summed;
>          skb->csum = re->skb->csum;
>          pci_dma_sync_single_for_device(sky2->hw->pdev, re->data_addr,
>
But, how could a "simple" driver bug automagically appear with Xen and
not as Baremetal ?
And why only with 32bits kernels ?

BTW, I'll try your patch as soon as I can.

> >
> >> I'll be able to continue any tests you want tomorrow.
> >> Do you still need me to compile domU kernel with "CONFIG_DMA_API_DEBUG"
> >> enabled ?
> >
> > Yes please.
> >
> >> If so, what tools will I need to get debug informations ?
> >
> > Uh, Konrad?
>
> Here, try this patch. Run it under baremetal and Xen and we can
> compare the
> outputs .. but I think the issue here is not off mis-using the DMA API but
> rather a driver bug.
OK, so if you first patch does not solve problem, I'll compile this one
as kernel module and load it, both on 32bits Baremetal and in 32bits DomU

Regards,
JB

  parent reply	other threads:[~2011-02-02 15:56 UTC|newest]

Thread overview: 73+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-12 15:38 PCI passthrough issue Jean Baptiste Favre
2011-01-12 15:43 ` Konrad Rzeszutek Wilk
2011-01-12 15:53   ` Jean Baptiste Favre
2011-01-12 16:09     ` Jean Baptiste Favre
2011-01-12 16:36     ` Konrad Rzeszutek Wilk
2011-01-12 16:56       ` Jean Baptiste Favre
2011-01-12 17:26         ` Konrad Rzeszutek Wilk
2011-01-12 17:44           ` Jean Baptiste Favre
2011-01-12 18:32             ` Konrad Rzeszutek Wilk
2011-01-12 20:07               ` Jean Baptiste Favre
2011-01-12 21:40                 ` Konrad Rzeszutek Wilk
2011-01-12 21:46                   ` Jean Baptiste Favre
2011-01-12 22:18                     ` Jean Baptiste Favre
2011-01-13 11:28                       ` Jean Baptiste Favre
2011-01-13 19:18                         ` Jean Baptiste Favre
2011-01-13 20:19                           ` Konrad Rzeszutek Wilk
2011-01-13 20:44                             ` Jean Baptiste Favre
2011-01-14 14:53                               ` Konrad Rzeszutek Wilk
2011-01-14 23:29                                 ` Jean Baptiste Favre
2011-01-17  8:59                                   ` Jean Baptiste Favre
2011-01-17 13:58                                     ` Jean Baptiste Favre
2011-01-22 10:22                                       ` Jean Baptiste Favre
2011-01-27 20:27                                         ` Konrad Rzeszutek Wilk
2011-01-27 21:47                                           ` Jean Baptiste Favre
2011-01-28 15:47                                             ` Jean Baptiste Favre
2011-02-01 11:34                                               ` Ian Campbell
2011-02-01 12:17                                                 ` Jean Baptiste Favre
2011-02-01 13:20                                                   ` Ian Campbell
2011-02-01 14:12                                                     ` Jean Baptiste Favre
2011-02-01 14:18                                                       ` Ian Campbell
2011-02-01 15:14                                                         ` Jean Baptiste Favre
2011-02-01 15:38                                                           ` Jean Baptiste Favre
2011-02-01 16:23                                                             ` Ian Campbell
2011-02-01 19:37                                                               ` Konrad Rzeszutek Wilk
2011-02-01 22:06                                                                 ` Jean Baptiste Favre
2011-02-02  9:12                                                                   ` Ian Campbell
2011-02-01 23:01                                                                 ` Jean Baptiste Favre
2011-02-02  9:44                                                                   ` Ian Campbell
2011-02-02 15:38                                                                     ` Konrad Rzeszutek Wilk
2011-02-02 15:55                                                                       ` Ian Campbell
2011-02-02 15:56                                                                       ` Jean Baptiste Favre [this message]
2011-02-01 22:04                                                               ` Jean Baptiste Favre
2011-02-02  9:27                                                                 ` Ian Campbell
2011-02-02 10:24                                                                   ` Jean Baptiste Favre
2011-02-02 10:59                                                                     ` Ian Campbell
2011-02-02 11:33                                                                       ` Jean Baptiste Favre
2011-02-02 17:42                                                                     ` Konrad Rzeszutek Wilk
2011-02-04  8:43                                                                       ` Jean Baptiste Favre
2011-02-04  8:53                                                                         ` Ian Campbell
2011-02-04  8:54                                                                           ` Jean Baptiste Favre
2011-02-04 10:12                                                                             ` Jean Baptiste Favre
2011-02-04 11:04                                                                               ` Ian Campbell
2011-02-04 11:25                                                                                 ` Jean Baptiste Favre
2011-02-04 11:28                                                                                   ` Ian Campbell
2011-02-04 13:15                                                                                     ` Jean Baptiste Favre
2011-02-04 13:50                                                                                       ` Ian Campbell
2011-02-04 14:01                                                                                         ` Jean Baptiste Favre
2011-02-09  9:59                                                                                           ` Jean Baptiste Favre
2011-02-18 21:14                                                                                             ` Jean Baptiste Favre
2011-02-25 14:40                                                                                               ` Konrad Rzeszutek Wilk
2011-02-28 10:00                                                                                                 ` Jean Baptiste Favre
2011-02-28 12:18                                                                                                 ` Jean Baptiste Favre
2011-02-28 15:01                                                                                                   ` Konrad Rzeszutek Wilk
2011-02-28 15:17                                                                                                     ` Jean Baptiste Favre
     [not found]                                                                                                       ` <4D6CB851.40103@jbfavre.org>
2011-03-03 22:12                                                                                                         ` Konrad Rzeszutek Wilk
2011-03-03 22:47                                                                                                           ` Jean Baptiste Favre
2011-03-03 22:58                                                                                                             ` Konrad Rzeszutek Wilk
2011-03-04  7:25                                                                                                               ` Jean Baptiste Favre
2011-03-16  3:14                                                                                                                 ` Konrad Rzeszutek Wilk
2011-03-25 13:06                                                                                                                   ` Jean Baptiste Favre
2011-02-01 15:38                                                           ` Ian Campbell
2011-02-01 16:16                                                             ` Jean Baptiste Favre
2011-01-12 21:44                 ` Jean Baptiste Favre

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D497EC9.5080601@jbfavre.org \
    --to=xen-devel@jbfavre.org \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).