public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jon Burgess <jburgess777@googlemail.com>
To: linux-dvb@linuxtv.org
Cc: v4l-dvb-maintainer@linuxtv.org,
	Markus Rechberger <mrechberger@gmail.com>,
	Gregoire Favre <Gregoire.Favre@gmail.com>,
	linux-kernel@vger.kernel.org, Lee Revell <rlrevell@joe-job.com>
Subject: Re: [PATCH] Re: More than 2Gb problem (dvb related) ?
Date: Sat, 28 Apr 2007 21:14:37 +0100	[thread overview]
Message-ID: <1177791277.5170.11.camel@localhost.localdomain> (raw)
In-Reply-To: <1177780652.7152.14.camel@localhost.localdomain>

[-- Attachment #1: Type: text/plain, Size: 1564 bytes --]

On Sat, 2007-04-28 at 18:17 +0100, Jon Burgess wrote:
> On Fri, 2007-04-27 at 18:06 -0400, Lee Revell wrote:
> > On 4/27/07, Jon Burgess <jburgess777@googlemail.com> wrote:
> > > Interesting - I see similar symptoms after upgrading my PC:
> > > * old PC was AMD Athlon 64 3000 w/ 2GB of RAM which had no issues
> > > * new PC is a Intel Core 2 Duo w/ 4GB of RAM and fails in the way you
> > > describe.
> > 
> > Driver using an incorrect DMA mask?
> > 
> > Lee
> 
> It appears the problem is that the driver is using streamed PCI and
> needs to explicitly sync the data otherwise it breaks when the SWIOTLB
> is in use. A call to pci_unmap_sg() was missing too.
> 
> This patch is against the current v4l-dvb HG tree.
> 
> I've only tested the change with a budget-ci card.
> 
> 	Jon
> 
> Signed-off-by: Jon Burgess <jburgess777@googlemail.com>

While the above patch works, it seems the underlying causes is that
vmalloc_32() is providing memory above 4Gb on x86-64 which is not what
the driver expects. This same issue came up a few weeks ago with regards
to DRM on radeon http://lkml.org/lkml/2007/4/1/257

Andi Kleen included a patch to ensure vmalloc_32() returns memory <4Gb
in a patch which is currently in -mm
 http://kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.21-rc7/2.6.21-rc7-mm2/broken-out/x86_64-mm-vmalloc-32.patch

With this patch applied the current driver appears to work OK. 

Attached is a smaller patch against v4l-dvb which just adds the missing
pci_unmap_sg() call.

	Jon

Signed-off-by: Jon Burgess <jburgess777@googlemail.com>

[-- Attachment #2: dvb-pci-unmap-sg.patch --]
[-- Type: text/x-patch, Size: 1166 bytes --]

diff -r a8b2a0738f4e linux/drivers/media/common/saa7146_core.c
--- a/linux/drivers/media/common/saa7146_core.c	Thu Apr 19 17:07:37 2007 -0300
+++ b/linux/drivers/media/common/saa7146_core.c	Sat Apr 28 20:55:30 2007 +0100
@@ -152,6 +152,7 @@ char *saa7146_vmalloc_build_pgtable(stru
 		return NULL;
 	}
 
+	pt->nents = pages;
 	slen = pci_map_sg(pci,pt->slist,pages,PCI_DMA_FROMDEVICE);
 	if (0 != saa7146_pgtable_build_single(pci, pt, pt->slist, slen)) {
 		return NULL;
@@ -165,6 +166,7 @@ void saa7146_pgtable_free(struct pci_dev
 	if (NULL == pt->cpu)
 		return;
 	pci_free_consistent(pci, pt->size, pt->cpu, pt->dma);
+	pci_unmap_sg(pci, pt->slist, pt->nents, PCI_DMA_FROMDEVICE);
 	pt->cpu = NULL;
 	kfree(pt->slist);
 	pt->slist = NULL;
diff -r a8b2a0738f4e linux/include/media/saa7146.h
--- a/linux/include/media/saa7146.h	Thu Apr 19 17:07:37 2007 -0300
+++ b/linux/include/media/saa7146.h	Sat Apr 28 18:06:47 2007 +0100
@@ -70,6 +70,7 @@ struct saa7146_pgtable {
 	unsigned long	offset;
 	/* used for custom pagetables (used for example by budget dvb cards) */
 	struct scatterlist *slist;
+	int             nents;
 };
 
 struct saa7146_pci_extension_data {

  reply	other threads:[~2007-04-28 20:15 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-27 11:10 More than 2Gb problem (dvb related) ? Gregoire Favre
2007-04-27 20:46 ` Markus Rechberger
2007-04-27 21:03   ` Gregoire Favre
2007-04-27 22:00   ` [linux-dvb] " Jon Burgess
2007-04-27 22:06     ` Lee Revell
2007-04-27 22:37       ` Jon Burgess
2007-04-28 17:17       ` [PATCH] " Jon Burgess
2007-04-28 20:14         ` Jon Burgess [this message]
2007-04-29 14:07           ` Gregoire Favre
2007-04-30  0:22           ` [linux-dvb] " Oliver Endriss
2007-04-30 16:52           ` Gregoire Favre
2007-04-30 18:05             ` Jon Burgess
2007-05-01  9:39               ` Gregoire Favre
2007-05-01  9:41               ` Gregoire Favre
2007-05-01 22:11                 ` Jon Burgess
2007-05-02  9:35                   ` Andi Kleen
2007-05-02 12:17                     ` Gregoire Favre
2007-05-05  7:36                     ` Gregoire Favre
2007-05-01 15:58         ` [linux-dvb] " Oliver Endriss
2007-05-01 20:03           ` Gregoire 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=1177791277.5170.11.camel@localhost.localdomain \
    --to=jburgess777@googlemail.com \
    --cc=Gregoire.Favre@gmail.com \
    --cc=linux-dvb@linuxtv.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mrechberger@gmail.com \
    --cc=rlrevell@joe-job.com \
    --cc=v4l-dvb-maintainer@linuxtv.org \
    /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