[{"id":15022,"web_url":"https://patchwork.libcamera.org/comment/15022/","msgid":"<20210205072132.hur5gff3dugefkpj@basti-TUXEDO-Book-XA1510>","date":"2021-02-05T07:21:32","subject":"Re: [libcamera-devel] [PATCH v4 0/3] cam: Fix races in event loop\n\tand long request processing times","submitter":{"id":78,"url":"https://patchwork.libcamera.org/api/people/78/","name":"Sebastian Fricke","email":"sebastian.fricke@posteo.net"},"content":"Hello Niklas,\n\nI have tested your patch series by making by capturing 75 frames with\ntwo different cameras before and after the patch series. Before I\napplied the series my OV13850 received frames until frame 115 and the it\nwent into the endless loop. The OV4689 received the last frame at frame\n88, before going into the endless loop.\nAfter I applied your patch series, the OV13850 received its last frame\nat frame number 190 and immediatly stopped the capture. And the OV4689\nreceived its last frame at frame number 115 before stopping the capture.\n\nThe output format for the OV13850 was 1920x1920-YUYV8_1_5X8.\nAnd the output format for the OV4689 was 1920x1520-YUYV8_1_5X8.\n\nIf you need more information then I can also send you the whole log as a\npaste bin.\n\nGreetings,\nSebastian\n\nOn 02.02.2021 23:10, Niklas Söderlund wrote:\n>Hello,\n>\n>Using cam to writing requests to (slow) media sometimes lock cam in an\n\ns/to writing/to write/\ns/sometimes lock cam/sometimes locks cam/\n\n>unbreakable loop. At the heart of the problem is that when request\n>processing was moved from the camera to the main thread subtle races in\n>the cam event loop implementation where exposed.\n\ns/where/were/\n\n>\n>The races are easily trigged by having callbacks injected into the even\n>loop that takes a long time to process. The only callbacks cam currently\n\ns/takes/take\n\n>injects to the event loop are processing of completed requests. So by\n\ns/The only callbacks cam currently injects to the event loop are\nprocessing of completed requests./\nThe only callback, that cam currently injects into the event loop, is\nprocessing completed requests./\nbetter?\n\n>increasing there processing time by writing them to disk the races where\n\ns/there/their/\ns/races where/races were/\n\n>trigged.\n>\n>This series aims to solve this by integrating the cam event loop closer\n>with libevent. As a bonus cam can be made more strict about how it\n>operates under the --capture=N mode.\n>\n>Niklas Söderlund (3):\n>  cam: event_loop: Rename event_ to base_\n>  cam: event_loop: Execute events in the libevent loop\n>  cam: Only queue the exact number of requests asked for\n>\n> src/cam/capture.cpp    | 16 +++++++++++---\n> src/cam/capture.h      |  2 ++\n> src/cam/event_loop.cpp | 49 ++++++++++++++++++++----------------------\n> src/cam/event_loop.h   |  8 ++-----\n> 4 files changed, 40 insertions(+), 35 deletions(-)\n>\n>-- \n>2.30.0\n>\n>_______________________________________________\n>libcamera-devel mailing list\n>libcamera-devel@lists.libcamera.org\n>https://lists.libcamera.org/listinfo/libcamera-devel","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 6ED2BBD160\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  5 Feb 2021 07:21:36 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id CE59E614AE;\n\tFri,  5 Feb 2021 08:21:35 +0100 (CET)","from mout01.posteo.de (mout01.posteo.de [185.67.36.65])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C20826149C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  5 Feb 2021 08:21:34 +0100 (CET)","from submission (posteo.de [89.146.220.130]) \n\tby mout01.posteo.de (Postfix) with ESMTPS id 165F2160060\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  5 Feb 2021 08:21:34 +0100 (CET)","from customer (localhost [127.0.0.1])\n\tby submission (posteo.de) with ESMTPSA id 4DX6Kn3WCtz6tmD;\n\tFri,  5 Feb 2021 08:21:33 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=posteo.net header.i=@posteo.net\n\theader.b=\"doW6l1V1\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;\n\tt=1612509694; bh=Pa+mCY3WjPwkultldc3So4OY71YVzY3FHHhouYzKC6U=;\n\th=Date:From:To:Cc:Subject:From;\n\tb=doW6l1V1086P4dK+ifirKMgz/ZFvp35y0qlracGfBj7K/tngVnZjOxXCxD4aFSvzR\n\tIax5xR3bYXGr00XLmUtyM3LVfIqAgQgr1pFiwMakcWGOSuEUPAVzr9MiHIqWPCEdwP\n\t5Ar0/G2ZyGmOmRBxcB1t2lRio0FeaKC6vdn3zD3nFHxmZ/dykbYj0vyw1/mcpT/i9h\n\tIv0XsCFnPSe7UY7BOs7kFfGQH5ixvzSudHaQyrz11vWx9ok0nxlBkpTRnAIB0ygoUK\n\tgmhj8klniB5LMPOQPP9Iicy+dbTFPqbOyps8Tx87lFZmW/+TJkPmvqNsPzenJJx19c\n\thxiY3zrNhwn9w==","Date":"Fri, 5 Feb 2021 08:21:32 +0100","From":"Sebastian Fricke <sebastian.fricke@posteo.net>","To":"Niklas =?utf-8?q?S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>","Message-ID":"<20210205072132.hur5gff3dugefkpj@basti-TUXEDO-Book-XA1510>","References":"<20210202221051.1740237-1-niklas.soderlund@ragnatech.se>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20210202221051.1740237-1-niklas.soderlund@ragnatech.se>","Subject":"Re: [libcamera-devel] [PATCH v4 0/3] cam: Fix races in event loop\n\tand long request processing times","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Cc":"libcamera-devel@lists.libcamera.org","Content-Transfer-Encoding":"base64","Content-Type":"text/plain; charset=\"utf-8\"; Format=\"flowed\"","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]