Message ID | aec7e5c30902130214k6a0fc8ck74b412f41fa63385@mail.gmail.com (mailing list archive) |
---|---|
State | Superseded, archived |
Headers |
Return-path: <linux-media-owner@vger.kernel.org> Envelope-to: mchehab@infradead.org Delivery-date: Fri, 13 Feb 2009 10:14:41 +0000 Received: from vger.kernel.org ([209.132.176.167]) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1LXv4C-0001te-Rp for mchehab@infradead.org; Fri, 13 Feb 2009 10:14:41 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750913AbZBMKOj (ORCPT <rfc822;mchehab@infradead.org>); Fri, 13 Feb 2009 05:14:39 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751231AbZBMKOi (ORCPT <rfc822;linux-media-outgoing>); Fri, 13 Feb 2009 05:14:38 -0500 Received: from rv-out-0506.google.com ([209.85.198.238]:50621 "EHLO rv-out-0506.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750913AbZBMKOh (ORCPT <rfc822;linux-media@vger.kernel.org>); Fri, 13 Feb 2009 05:14:37 -0500 Received: by rv-out-0506.google.com with SMTP id g37so637546rvb.1 for <linux-media@vger.kernel.org>; Fri, 13 Feb 2009 02:14:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=lqTr0DiCy316gRNC38kjhWmyDNALM8u+kBlkvy43ih0=; b=Wk6lgYH9gawFCDM94k9DwPR6NqNjDPlrm7RzNKAJD19xFaia5rdA1kSRrOjFuumATd yLr1ZRbG9sW4wi7l2MqokoXoDYqUZIhDvIqvBvaYi0E4KqXdOKj38l1iN05W7mvkb4uP eDFRlX6/cJPd8IZsY/o0zsPCPgjbMw5WUZBhU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=tOKwdg5mOnCzy/jC2VVzQtrNIu2/+Sk++yfFEy68dpnJbfGOzQNhreXHK5+WOYLITk FbuDWClg6oQrkaR/VUyk/xVWL0Lr2GTZGHpT0lKgL7t8H+Cw73b8Cx3JHbNRv1XntRyF vfsSbOjDEU6GfVf51C88UFwBN5ZLinsRPc6K4= MIME-Version: 1.0 Received: by 10.141.20.6 with SMTP id x6mr1074845rvi.159.1234520076505; Fri, 13 Feb 2009 02:14:36 -0800 (PST) In-Reply-To: <497598ED.3050502@parrot.com> References: <497487F2.7070400@parrot.com> <aec7e5c30901192046j1a595day51da698181d034e5@mail.gmail.com> <497598ED.3050502@parrot.com> Date: Fri, 13 Feb 2009 19:14:36 +0900 Message-ID: <aec7e5c30902130214k6a0fc8ck74b412f41fa63385@mail.gmail.com> Subject: Re: soc-camera : sh_mobile_ceu_camera race on free_buffer ? From: Magnus Damm <magnus.damm@gmail.com> To: Matthieu CASTET <matthieu.castet@parrot.com> Cc: linux-media@vger.kernel.org, Guennadi Liakhovetski <g.liakhovetski@gmx.de>, Kuninori Morimoto <morimoto.kuninori@renesas.com> Content-Type: multipart/mixed; boundary=000e0cd1af8ca0d0ef0462ca1a5c Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: <linux-media.vger.kernel.org> X-Mailing-List: linux-media@vger.kernel.org |
Commit Message
Magnus Damm
Feb. 13, 2009, 10:14 a.m. UTC
Hi Matthieu, [CC Morimoto-san] [Changed list to linux-media] On Tue, Jan 20, 2009 at 6:27 PM, Matthieu CASTET <matthieu.castet@parrot.com> wrote: > Magnus Damm a écrit : >> On Mon, Jan 19, 2009 at 11:02 PM, Matthieu CASTET >>> But we didn't do stop_capture, so as far I understand the controller is >>> still writing data in memory. What prevent us to free the buffer we are >>> writing. >> >> I have not looked into this in great detail, but isn't this handled by >> the videobuf state? The videobuf has state VIDEOBUF_ACTIVE while it is >> in use. I don't think such a buffer is freed. > Well from my understanding form videobuf_queue_cancel [1], we call > buf_release on all buffer. Yeah, you are correct. I guess waiting for the buffer before freeing is the correct way to do this. I guess vivi doesn't have to do this since it's not using DMA. Morimoto-san, can you check the attached patch? I've tested it on my Migo-R board together with mplayer and it seems to work well here. I don't think using mplayer triggers this error case though, so maybe we should try some other application. Cheers, / magnus
Comments
Hi Magnus > Morimoto-san, can you check the attached patch? I've tested it on my > Migo-R board together with mplayer and it seems to work well here. I > don't think using mplayer triggers this error case though, so maybe we > should try some other application. I checked this patch with following case. Migo-R + ov772x + mplayer Migo-R + tw9910 + mplayer AP325 + ov772x + mplayer It works well on all cases. And I can agree with your opinion "so maybe we should try some other application." Best regards -- Kuninori Morimoto -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Morimoto-san On Mon, 16 Feb 2009, morimoto.kuninori@renesas.com wrote: > > Hi Magnus > > > Morimoto-san, can you check the attached patch? I've tested it on my > > Migo-R board together with mplayer and it seems to work well here. I > > don't think using mplayer triggers this error case though, so maybe we > > should try some other application. > > I checked this patch with following case. > > Migo-R + ov772x + mplayer > Migo-R + tw9910 + mplayer > AP325 + ov772x + mplayer > > It works well on all cases. So I can add your "Tested-by:"? > And I can agree with your opinion > "so maybe we should try some other application." You can try to trigger the race with the capture.c example. Reduce the "count" variable in mainloop() and run capture.c in a loop for a while... Try without this patch and then with this patch. But I think this is a correct fix, so, unless you say, it crashes without it and with it, I'll apply it. Thanks Guennadi > > Best regards > -- > Kuninori Morimoto > -- > To unsubscribe from this list: send the line "unsubscribe linux-media" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > --- Guennadi Liakhovetski, Ph.D. Freelance Open-Source Software Developer -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Fri, 13 Feb 2009, Magnus Damm wrote: > Hi Matthieu, > > [CC Morimoto-san] > [Changed list to linux-media] > > On Tue, Jan 20, 2009 at 6:27 PM, Matthieu CASTET > <matthieu.castet@parrot.com> wrote: > > Magnus Damm a écrit : > >> On Mon, Jan 19, 2009 at 11:02 PM, Matthieu CASTET > >>> But we didn't do stop_capture, so as far I understand the controller is > >>> still writing data in memory. What prevent us to free the buffer we are > >>> writing. > >> > >> I have not looked into this in great detail, but isn't this handled by > >> the videobuf state? The videobuf has state VIDEOBUF_ACTIVE while it is > >> in use. I don't think such a buffer is freed. > > Well from my understanding form videobuf_queue_cancel [1], we call > > buf_release on all buffer. > > Yeah, you are correct. I guess waiting for the buffer before freeing > is the correct way to do this. I guess vivi doesn't have to do this > since it's not using DMA. > > Morimoto-san, can you check the attached patch? I've tested it on my > Migo-R board together with mplayer and it seems to work well here. I > don't think using mplayer triggers this error case though, so maybe we > should try some other application. Magnus, can you, please, submit it with an Sob, after Morimoto-san has tested it with capture.c? Thanks Guennadi --- Guennadi Liakhovetski, Ph.D. Freelance Open-Source Software Developer -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Dear Guennadi > > It works well on all cases. > So I can add your "Tested-by:"? Yes please. > You can try to trigger the race with the capture.c example. Reduce the > "count" variable in mainloop() and run capture.c in a loop for a while... > Try without this patch and then with this patch. But I think this is a > correct fix, so, unless you say, it crashes without it and with it, I'll > apply it. I tried with following command option # capture_example -d /dev/videoX -f -c 1000 I used -f option, I think you already know the reason =). I think -c 1000 is enough. # Because tw9910 can not use YUYV, # I fixed capture_example to use VUYU for tw9910. sh_mobile_ceu_camera didn't crashe with and without Magnus patch. MigoR + ov772x + capture_example MigoR + tw9910 + capture_example (VUYU fix) AP325 + ov772x + capture_example Best regards -- Kuninori Morimoto -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Thu, 19 Feb 2009, morimoto.kuninori@renesas.com wrote: > Dear Guennadi > > > > It works well on all cases. > > So I can add your "Tested-by:"? > > Yes please. > > > You can try to trigger the race with the capture.c example. Reduce the > > "count" variable in mainloop() and run capture.c in a loop for a while... > > Try without this patch and then with this patch. But I think this is a > > correct fix, so, unless you say, it crashes without it and with it, I'll > > apply it. > > I tried with following command option > > # capture_example -d /dev/videoX -f -c 1000 > > I used -f option, I think you already know the reason =). Yes, and I'm working on that. > I think -c 1000 is enough. No, sorry, this is not the test I meant. "-c" doesn't really stress the path we need. You really have to execute capture_example multiple times completely. The race we're trying to catch happens on STREAMOFF, and for that you have to run the example completely through. So, I would suggest something like for (( i=0; i<100; i++ )); do capture_example -d /dev/videoX -f -c 4; done Thanks Guennadi --- Guennadi Liakhovetski, Ph.D. Freelance Open-Source Software Developer -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Dear Guennadi > No, sorry, this is not the test I meant. "-c" doesn't really stress the > path we need. You really have to execute capture_example multiple times > completely. The race we're trying to catch happens on STREAMOFF, and for > that you have to run the example completely through. So, I would suggest > something like > > for (( i=0; i<100; i++ )); do capture_example -d /dev/videoX -f -c 4; done wow !! sorry miss understanding. OK. I re-tried test with your script (300 times). sh_mobile_ceu_camera didn't crashe with and without Magnus patch. MigoR + ov772x + capture_example MigoR + tw9910 + capture_example (VUYU fix) AP325 + ov772x + capture_example Best regards -- Kuninori Morimoto -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
--- 0001/drivers/media/video/sh_mobile_ceu_camera.c +++ work/drivers/media/video/sh_mobile_ceu_camera.c 2009-02-13 18:55:55.000000000 +0900 @@ -150,6 +150,7 @@ static void free_buffer(struct videobuf_ if (in_interrupt()) BUG(); + videobuf_waiton(&buf->vb, 0, 0); videobuf_dma_contig_free(vq, &buf->vb); dev_dbg(&icd->dev, "%s freed\n", __func__); buf->vb.state = VIDEOBUF_NEEDS_INIT;