From: Johann Friedrichs <johann.friedrichs@web.de>
To: Mauro Carvalho Chehab <mchehab@redhat.com>
Cc: e9hack <e9hack@googlemail.com>,
linux-media@vger.kernel.org, hunold@linuxtv.org
Subject: Re: bug in changeset 13239:54535665f94b ?
Date: Sun, 08 Nov 2009 21:48:49 +0100 [thread overview]
Message-ID: <4AF72EB1.1040404@web.de> (raw)
In-Reply-To: <20091107104113.0df4593b@pedra.chehab.org>
Mauro Carvalho Chehab schrieb:
> Hi Hartmut,
>
> Em Sun, 01 Nov 2009 16:59:26 +0100
> e9hack <e9hack@googlemail.com> escreveu:
>
>> Hi,
>>
>> something is wrong in changeset 13239:54535665f94b. After applying it, I get page faults
>> in various applications:
>> ...
>>
>> If I remove the call to release_all_pagetables() in buffer_release(), I don't see this
>> page faults.
>
>
> Em Mon, 2 Nov 2009 21:27:44 +0100
> e9hack@googlemail.com escreveu:
>
>> the BUG is in vidioc_streamoff() for the saa7146. This function
>> releases all buffers first, and stops the capturing and dma tranfer of
>> the saa7146 as second. If the page table, which is currently used by
>> the saa7146, is modified by another thread, the saa7146 writes
>> anywhere to the physical RAM. IMHO vidioc_streamoff() must stop the
>> saa7146 first and may then release the buffers.
>
> I agree. We need first to stop DMA activity, and then release the page tables.
>
> Could you please test if the enclosed patch fixes the issue?
>
> Cheers,
> Mauro
>
> saa7146: stop DMA before de-allocating DMA scatter/gather page buffers
>
> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
>
> diff --git a/linux/drivers/media/common/saa7146_video.c b/linux/drivers/media/common/saa7146_video.c
> --- a/linux/drivers/media/common/saa7146_video.c
> +++ b/linux/drivers/media/common/saa7146_video.c
> @@ -1334,9 +1334,9 @@ static void buffer_release(struct videob
>
> DEB_CAP(("vbuf:%p\n",vb));
>
> + saa7146_dma_free(dev,q,buf);
> +
> release_all_pagetables(dev, buf);
> -
> - saa7146_dma_free(dev,q,buf);
> }
>
> static struct videobuf_queue_ops video_qops = {
>
Hi Mauro,
I cannot easily catch any memory overwriting done by
saa7146-capture-dma, but Hartmut is right that there is quite a chance.
I would prefer calling video_end() before videobuf_streamoff() in
vidioc_streamoff(), because this physically shuts down the capture
immediately at the hardware source. By the way, this is done in the same
sequence in video_close, where videobuf_stop (which calls
videobuf_streamoff) also gets called after video_end.
I have no negative impact with your patch and it might shutdown the dma
as well, but as said before, I don't see any immediate errors even with
the released version.
Cheers
Johann
next prev parent reply other threads:[~2009-11-08 20:48 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-01 15:59 bug in changeset 13239:54535665f94b ? e9hack
2009-11-02 20:27 ` e9hack
2009-11-07 12:41 ` Mauro Carvalho Chehab
2009-11-07 14:05 ` e9hack
2009-11-07 14:49 ` Mauro Carvalho Chehab
2009-11-07 16:00 ` e9hack
2009-11-07 18:35 ` e9hack
2009-11-08 20:48 ` Johann Friedrichs [this message]
2009-11-19 21:02 ` e9hack
2009-11-19 21:15 ` e9hack
2009-11-23 19:29 ` Mauro Carvalho Chehab
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=4AF72EB1.1040404@web.de \
--to=johann.friedrichs@web.de \
--cc=e9hack@googlemail.com \
--cc=hunold@linuxtv.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.