From patchwork Thu Feb 19 08:33:50 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guennadi Liakhovetski X-Patchwork-Id: 7938 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n1J8Xqkr008890 for ; Thu, 19 Feb 2009 08:33:52 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752183AbZBSIdt (ORCPT ); Thu, 19 Feb 2009 03:33:49 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753207AbZBSIdt (ORCPT ); Thu, 19 Feb 2009 03:33:49 -0500 Received: from mail.gmx.net ([213.165.64.20]:34392 "HELO mail.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1752183AbZBSIds (ORCPT ); Thu, 19 Feb 2009 03:33:48 -0500 Received: (qmail invoked by alias); 19 Feb 2009 08:33:45 -0000 Received: from p57BD2B28.dip0.t-ipconnect.de (EHLO axis700.grange) [87.189.43.40] by mail.gmx.net (mp046) with SMTP; 19 Feb 2009 09:33:45 +0100 X-Authenticated: #20450766 X-Provags-ID: V01U2FsdGVkX18FGnRdHDsF+jNOOqXwBC1YH2v/mSk2KUAIrXgYLr 4bqtEOHeOXV/jv Received: from lyakh (helo=localhost) by axis700.grange with local-esmtp (Exim 4.63) (envelope-from ) id 1La4Lu-0001QB-KS; Thu, 19 Feb 2009 09:33:50 +0100 Date: Thu, 19 Feb 2009 09:33:50 +0100 (CET) From: Guennadi Liakhovetski To: morimoto.kuninori@renesas.com cc: Magnus Damm , Matthieu CASTET , Linux Media Mailing List Subject: Re: soc-camera : sh_mobile_ceu_camera race on free_buffer ? In-Reply-To: Message-ID: References: <497487F2.7070400@parrot.com> <497598ED.3050502@parrot.com> MIME-Version: 1.0 X-Y-GMX-Trusted: 0 X-FuHaFi: 0.46 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org On Thu, 19 Feb 2009, morimoto.kuninori@renesas.com wrote: > > 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 Hm, ok, maybe I can ask you about one more test, if you don't mind. The thing is, you only see the problem, if after the ->active buffer has been freed in free_buffer(), your DMA engine continues writing to the freed memory, but you only notice this, if some other driver manages to grab and use it in this time, then its data is going to be overwritten. To actually see, if the race occurs, please do Also, I think, even better than restarting capture-example completely would be to edit capture-example.c and put a loop around init_device(); start_capturing(); mainloop(); stop_capturing(); uninit_device(); or maybe even only start_capturing(); mainloop(); stop_capturing(); Best would be to first try all three loops without the patch from Magnus and see if any of them triggers. And use a larger frame (maximum that your sensor can deliver) to give the DMA engine more time per frame. 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 diff -u a/drivers/media/video/sh_mobile_ceu_camera.c b/drivers/media/video/sh_mobile_ceu_camera.c --- a/drivers/media/video/sh_mobile_ceu_camera.c +++ b/drivers/media/video/sh_mobile_ceu_camera.c @@ -326,6 +326,7 @@ spin_lock_irqsave(&pcdev->lock, flags); vb = pcdev->active; + WARN_ON(vb->state == VIDEOBUF_NEEDS_INIT); list_del_init(&vb->queue); if (!list_empty(&pcdev->capture))