[{"id":26655,"web_url":"https://patchwork.libcamera.org/comment/26655/","msgid":"<4e38c59a-4c4d-a5c3-412e-bd6bdcc334de@ideasonboard.com>","date":"2023-03-14T09:20:10","subject":"Re: [libcamera-devel] [RFC PATCH] libcamera: base: Make the\n\tregistration of log categories atomic","submitter":{"id":86,"url":"https://patchwork.libcamera.org/api/people/86/","name":"Umang Jain","email":"umang.jain@ideasonboard.com"},"content":"Hi Nicolas\n\nOn 3/14/23 2:11 AM, Nicolas Dufresne via libcamera-devel wrote:\n> From: Nicolas Dufresne <nicolas.dufresne@collabora.com>\n>\n> Logger:::create() is not currently thread safe and causes crashes\n\nIndeed. Given the fact that gstlibcamerasrc should be ideally moving \naway from using libcamera_private dependency (as LogCategory::create()) \nis an internal API\n\nI can see that it's being called from other internal threads as well \n(like PostProcessorWorker from android HAL layer) so making it thread \nsafe makes sense.\n> noticeable on RaspberryPi 4. This adds a mutex around the creation\n> of categories.\n>\n> Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>\n> ---\n>\n>   src/libcamera/base/log.cpp | 3 +++\n>   1 file changed, 3 insertions(+)\n>\n> This is a quick fix. The crash I'm getting is very frequent, the backtrace\n> is the following. Pretty much 50% of the time on Raspberry Pi using:\n>\n>    gst-launch-1.0 libcamerasrc ! queue ! xvimagesink\n>\n> Thread 6 \"gst-launch-1.0\" received signal SIGSEGV, Segmentation fault.\n> [Switching to Thread 0x7ff48cc180 (LWP 88100)]\n> 0x0000007ff5f48a40 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::compare(char const*) const () from /lib/aarch64-linux-gnu/libstdc++.so.6\n> (gdb) bt\n> #0  0x0000007ff5f48a40 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::compare(char const*) const () at /lib/aarch64-linux-gnu/libstdc++.so.6\n> #1  0x0000007ff664efe0 in std::operator==<char, std::char_traits<char>, std::allocator<char> >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char const*)\n>      (__lhs=<error reading variable: Cannot access memory at address 0x705f317073696b7a>, __rhs=0x7ff61c4a28 \"Event\") at /usr/include/c++/10/bits/basic_string.h:6187\n> #2  0x0000007ff61b48d4 in operator()<libcamera::LogCategory*>(libcamera::LogCategory*) const (__closure=0x7ff48cb008, c=0x705f317073696b72) at ../src/libcamera/base/log.cpp:748\n> #3  0x0000007ff61b4910 in __gnu_cxx::__ops::_Iter_pred<libcamera::Logger::findCategory(char const*) const::<lambda(auto:2)> >::operator()<__gnu_cxx::__normal_iterator<libcamera::LogCategory* const*, std::vector<libcamera::LogCategory*> > >(__gnu_cxx::__normal_iterator<libcamera::LogCategory* const*, std::vector<libcamera::LogCategory*, std::allocator<libcamera::LogCategory*> > >)\n>      (this=0x7ff48cb008, __it=0x705f317073696b72) at /usr/include/c++/10/bits/predefined_ops.h:316\n> #4  0x0000007ff61b487c in std::__find_if<__gnu_cxx::__normal_iterator<libcamera::LogCategory* const*, std::vector<libcamera::LogCategory*> >, __gnu_cxx::__ops::_Iter_pred<libcamera::Logger::findCategory(char const*) const::<lambda(auto:2)> > >(__gnu_cxx::__normal_iterator<libcamera::LogCategory* const*, std::vector<libcamera::LogCategory*, std::allocator<libcamera::LogCategory*> > >, __gnu_cxx::__normal_iterator<libcamera::LogCategory* const*, std::vector<libcamera::LogCategory*, std::allocator<libcamera::LogCategory*> > >, __gnu_cxx::__ops::_Iter_pred<libcamera::Logger::findCategory(char const*) const::<lambda(auto:2)> >, std::random_access_iterator_tag) (__first=0x705f317073696b72, __last=0x303100736d617261, __pred=...) at /usr/include/c++/10/bits/stl_algobase.h:1959\n> #5  0x0000007ff61b46b4 in std::__find_if<__gnu_cxx::__normal_iterator<libcamera::LogCategory* const*, std::vector<libcamera::LogCategory*> >, __gnu_cxx::__ops::_Iter_pred<libcamera::Logger::findCategory(char const*) const::<lambda(auto:2)> > >(__gnu_cxx::__normal_iterator<libcamera::LogCategory* const*, std::vector<libcamera::LogCategory*, std::allocator<libcamera::LogCategory*> > >, __gnu_cxx::__normal_iterator<libcamera::LogCategory* const*, std::vector<libcamera::LogCategory*, std::allocator<libcamera::LogCategory*> > >, __gnu_cxx::__ops::_Iter_pred<libcamera::Logger::findCategory(char const*) const::<lambda(auto:2)> >)\n>      (__first=0x555582c130, __last=0x303100736d617261, __pred=...) at /usr/include/c++/10/bits/stl_algobase.h:1974\n> #6  0x0000007ff61b4648 in std::find_if<__gnu_cxx::__normal_iterator<libcamera::LogCategory* const*, std::vector<libcamera::LogCategory*> >, libcamera::Logger::findCategory(char const*) const::<lambda(auto:2)> >(__gnu_cxx::__normal_iterator<libcamera::LogCategory* const*, std::vector<libcamera::LogCategory*, std::allocator<libcamera::LogCategory*> > >, __gnu_cxx::__normal_iterator<libcamera::LogCategory* const*, std::vector<libcamera::LogCategory*, std::allocator<libcamera::LogCategory*> > >, struct {...}) (__first=0x555582c130, __last=0x303100736d617261, __pred=...) at /usr/include/c++/10/bits/stl_algo.h:3929\n> #7  0x0000007ff61b3f60 in libcamera::Logger::findCategory(char const*) const (this=0x7ff61ec968 <libcamera::Logger::instance()::instance>, name=0x7ff61c4a28 \"Event\") at ../src/libcamera/base/log.cpp:748\n> #8  0x0000007ff61b3fc4 in libcamera::LogCategory::create(char const*) (name=0x7ff61c4a28 \"Event\") at ../src/libcamera/base/log.cpp:791\n> #9  0x0000007ff61a9ffc in libcamera::logCategoryEvent() () at ../src/libcamera/base/event_dispatcher.cpp:17\n> #10 0x0000007ff61aac5c in libcamera::EventDispatcherPoll::poll(std::vector<pollfd, std::allocator<pollfd> >*) (this=0x7fe8006f90, pollfds=0x7ff48cb3e8) at ../src/libcamera/base/event_dispatcher_poll.cpp:216\n> #11 0x0000007ff61aa8fc in libcamera::EventDispatcherPoll::processEvents() (this=0x7fe8006f90) at ../src/libcamera/base/event_dispatcher_poll.cpp:160\n> #12 0x0000007ff61be0bc in libcamera::Thread::exec() (this=0x55555d0380) at ../src/libcamera/base/thread.cpp:341\n> #13 0x0000007ff6643e88 in libcamera::CameraManager::Private::run() (this=0x55555d0370) at ../src/libcamera/camera_manager.cpp:122\n> #14 0x0000007ff61be038 in libcamera::Thread::startThread() (this=0x55555d0380) at ../src/libcamera/base/thread.cpp:319\n> #15 0x0000007ff61c2070 in std::__invoke_impl<void, void (libcamera::Thread::*)(), libcamera::Thread*>(std::__invoke_memfun_deref, void (libcamera::Thread::*&&)(), libcamera::Thread*&&)\n>      (__f=@0x5555852ef0: (void (libcamera::Thread::*)(class libcamera::Thread * const)) 0x7ff61bdf38 <libcamera::Thread::startThread()>, __t=@0x5555852ee8: 0x55555d0380) at /usr/include/c++/10/bits/invoke.h:73\n> #16 0x0000007ff61c1f88 in std::__invoke<void (libcamera::Thread::*)(), libcamera::Thread*>(void (libcamera::Thread::*&&)(), libcamera::Thread*&&)\n>      (__fn=@0x5555852ef0: (void (libcamera::Thread::*)(class libcamera::Thread * const)) 0x7ff61bdf38 <libcamera::Thread::startThread()>) at /usr/include/c++/10/bits/invoke.h:95\n> #17 0x0000007ff61c1eec in std::thread::_Invoker<std::tuple<void (libcamera::Thread::*)(), libcamera::Thread*> >::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) (this=0x5555852ee8)\n>      at /usr/include/c++/10/thread:264\n> #18 0x0000007ff61c1ea4 in std::thread::_Invoker<std::tuple<void (libcamera::Thread::*)(), libcamera::Thread*> >::operator()() (this=0x5555852ee8) at /usr/include/c++/10/thread:271\n> #19 0x0000007ff61c1e84 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (libcamera::Thread::*)(), libcamera::Thread*> > >::_M_run() (this=0x5555852ee0) at /usr/include/c++/10/thread:215\n> #20 0x0000007ff5ee1cac in  () at /lib/aarch64-linux-gnu/libstdc++.so.6\n> #21 0x0000007ff7c78648 in start_thread (arg=0x7ff48cba80) at pthread_create.c:477\n> #22 0x0000007ff7bcec1c in thread_start () at ../sysdeps/unix/sysv/linux/aarch64/clone.S:78\n>\n>\n> diff --git a/src/libcamera/base/log.cpp b/src/libcamera/base/log.cpp\n> index 55fbd7b0..c8045ef7 100644\n> --- a/src/libcamera/base/log.cpp\n> +++ b/src/libcamera/base/log.cpp\n> @@ -21,6 +21,7 @@\n>   #include <libcamera/logging.h>\n>   \n>   #include <libcamera/base/backtrace.h>\n> +#include <libcamera/base/mutex.h>\n>   #include <libcamera/base/thread.h>\n>   #include <libcamera/base/utils.h>\n>   \n> @@ -788,6 +789,8 @@ LogCategory *Logger::findCategory(const char *name) const\n>    */\n>   LogCategory *LogCategory::create(const char *name)\n>   {\n> +\tstatic Mutex mutex_;\n> +\tMutexLocker locker(mutex_);\n>   \tLogCategory *category = Logger::instance()->findCategory(name);\n>   \n>   \tif (!category) {","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 F1B0BBD80A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 14 Mar 2023 09:20:17 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3455A62705;\n\tTue, 14 Mar 2023 10:20:17 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6AEB1626D2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 14 Mar 2023 10:20:15 +0100 (CET)","from [IPV6:2401:4900:1c80:8a27:83cd:b9c3:2b12:2deb] (unknown\n\t[IPv6:2401:4900:1c80:8a27:83cd:b9c3:2b12:2deb])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 68CD5814;\n\tTue, 14 Mar 2023 10:20:14 +0100 (CET)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1678785617;\n\tbh=u3P2/271YxNsV6JqQkxzPoKKSL6FkKV5xcMw3bEfmK0=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=2M5Hzc1ytnhHBXpR/kk0PLH2bjhKSCMRbJBiE9zr8usMOI4hDsxlDLQrIj6nYtlB7\n\t3B4jlRfKGMTwYuUGQJU7DjYfGB0i8OTC7Xx1BDesSBA97wkF3lQVlzr5GkUci+clPX\n\t8b2rnzyOdfPBsl6kOvuViPGnzV1PpEKt24FCEtHulztngZMuDz5SRwDGg+fOceTmpp\n\tU68ZFP00e2atE/xZZpprPHu9gr3phWnVvnHe0lgNkRMxkyYRWdAcrlZpSgGZlF8Rmu\n\tdWH47wgy3osDVLYNSNs9QM3V506fI0O5Fz7TpS7qg3xGMbOpLN1qQ9iL70+71zMmsl\n\tVQM85ae+RwLgw==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1678785615;\n\tbh=u3P2/271YxNsV6JqQkxzPoKKSL6FkKV5xcMw3bEfmK0=;\n\th=Date:Subject:To:Cc:References:From:In-Reply-To:From;\n\tb=EUVDkXq1NTgCpqVbeB5hAUKwC2ncJ2HM/fxfWGVYgcXg5TRbHr2ovsGF85A0nQyBm\n\t8B9yF1KkcHa7M9qYuvRnH6JMlFS5ZY99A4vEAZA9mvOU6uKTslS/r1HOlehUbzsp6V\n\tRGOZG0i6/aKu7K5DOdCYGhe9HZA27T3h3Oebv5/o="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"EUVDkXq1\"; dkim-atps=neutral","Message-ID":"<4e38c59a-4c4d-a5c3-412e-bd6bdcc334de@ideasonboard.com>","Date":"Tue, 14 Mar 2023 14:50:10 +0530","MIME-Version":"1.0","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101\n\tThunderbird/102.7.1","Content-Language":"en-US","To":"Nicolas Dufresne <nicolas@ndufresne.ca>,\n\tlibcamera-devel@lists.libcamera.org","References":"<20230313204134.2769860-1-nicolas@ndufresne.ca>","In-Reply-To":"<20230313204134.2769860-1-nicolas@ndufresne.ca>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","Subject":"Re: [libcamera-devel] [RFC PATCH] libcamera: base: Make the\n\tregistration of log categories atomic","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>","From":"Umang Jain via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Umang Jain <umang.jain@ideasonboard.com>","Cc":"Nicolas Dufresne <nicolas.dufresne@collabora.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":26657,"web_url":"https://patchwork.libcamera.org/comment/26657/","msgid":"<79c1e3e06c8d83f6dfab0140e3e0cd53ef6852bd.camel@ndufresne.ca>","date":"2023-03-14T13:00:46","subject":"Re: [libcamera-devel] [RFC PATCH] libcamera: base: Make the\n\tregistration of log categories atomic","submitter":{"id":30,"url":"https://patchwork.libcamera.org/api/people/30/","name":"Nicolas Dufresne","email":"nicolas@ndufresne.ca"},"content":"Le mardi 14 mars 2023 à 14:50 +0530, Umang Jain a écrit :\n> Hi Nicolas\n> \n> On 3/14/23 2:11 AM, Nicolas Dufresne via libcamera-devel wrote:\n> > From: Nicolas Dufresne <nicolas.dufresne@collabora.com>\n> > \n> > Logger:::create() is not currently thread safe and causes crashes\n\nSpotting some of my own typos now, should have two :: here.\n\n> \n> Indeed. Given the fact that gstlibcamerasrc should be ideally moving \n> away from using libcamera_private dependency (as LogCategory::create()) \n> is an internal API\n\ngstlibcamerasrc is using GStreamer logger only. Perhaps I'm missing something ?\nYou'll see in the backtrace that libgstcamerasrc is not involved.\n\n> \n> I can see that it's being called from other internal threads as well \n> (like PostProcessorWorker from android HAL layer) so making it thread \n> safe makes sense.\n\nIndeed, adding some sort of safety, but resorting to a global lock might not be\nthe best solution, that's why I started with an RFC. \n\n>\n> > noticeable on RaspberryPi 4. This adds a mutex around the creation\n> > of categories.\n> > \n> > Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>\n> > ---\n> > \n> >   src/libcamera/base/log.cpp | 3 +++\n> >   1 file changed, 3 insertions(+)\n> > \n> > This is a quick fix. The crash I'm getting is very frequent, the backtrace\n> > is the following. Pretty much 50% of the time on Raspberry Pi using:\n> > \n> >    gst-launch-1.0 libcamerasrc ! queue ! xvimagesink\n> > \n> > Thread 6 \"gst-launch-1.0\" received signal SIGSEGV, Segmentation fault.\n> > [Switching to Thread 0x7ff48cc180 (LWP 88100)]\n> > 0x0000007ff5f48a40 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::compare(char const*) const () from /lib/aarch64-linux-gnu/libstdc++.so.6\n> > (gdb) bt\n> > #0  0x0000007ff5f48a40 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::compare(char const*) const () at /lib/aarch64-linux-gnu/libstdc++.so.6\n> > #1  0x0000007ff664efe0 in std::operator==<char, std::char_traits<char>, std::allocator<char> >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char const*)\n> >      (__lhs=<error reading variable: Cannot access memory at address 0x705f317073696b7a>, __rhs=0x7ff61c4a28 \"Event\") at /usr/include/c++/10/bits/basic_string.h:6187\n> > #2  0x0000007ff61b48d4 in operator()<libcamera::LogCategory*>(libcamera::LogCategory*) const (__closure=0x7ff48cb008, c=0x705f317073696b72) at ../src/libcamera/base/log.cpp:748\n> > #3  0x0000007ff61b4910 in __gnu_cxx::__ops::_Iter_pred<libcamera::Logger::findCategory(char const*) const::<lambda(auto:2)> >::operator()<__gnu_cxx::__normal_iterator<libcamera::LogCategory* const*, std::vector<libcamera::LogCategory*> > >(__gnu_cxx::__normal_iterator<libcamera::LogCategory* const*, std::vector<libcamera::LogCategory*, std::allocator<libcamera::LogCategory*> > >)\n> >      (this=0x7ff48cb008, __it=0x705f317073696b72) at /usr/include/c++/10/bits/predefined_ops.h:316\n> > #4  0x0000007ff61b487c in std::__find_if<__gnu_cxx::__normal_iterator<libcamera::LogCategory* const*, std::vector<libcamera::LogCategory*> >, __gnu_cxx::__ops::_Iter_pred<libcamera::Logger::findCategory(char const*) const::<lambda(auto:2)> > >(__gnu_cxx::__normal_iterator<libcamera::LogCategory* const*, std::vector<libcamera::LogCategory*, std::allocator<libcamera::LogCategory*> > >, __gnu_cxx::__normal_iterator<libcamera::LogCategory* const*, std::vector<libcamera::LogCategory*, std::allocator<libcamera::LogCategory*> > >, __gnu_cxx::__ops::_Iter_pred<libcamera::Logger::findCategory(char const*) const::<lambda(auto:2)> >, std::random_access_iterator_tag) (__first=0x705f317073696b72, __last=0x303100736d617261, __pred=...) at /usr/include/c++/10/bits/stl_algobase.h:1959\n> > #5  0x0000007ff61b46b4 in std::__find_if<__gnu_cxx::__normal_iterator<libcamera::LogCategory* const*, std::vector<libcamera::LogCategory*> >, __gnu_cxx::__ops::_Iter_pred<libcamera::Logger::findCategory(char const*) const::<lambda(auto:2)> > >(__gnu_cxx::__normal_iterator<libcamera::LogCategory* const*, std::vector<libcamera::LogCategory*, std::allocator<libcamera::LogCategory*> > >, __gnu_cxx::__normal_iterator<libcamera::LogCategory* const*, std::vector<libcamera::LogCategory*, std::allocator<libcamera::LogCategory*> > >, __gnu_cxx::__ops::_Iter_pred<libcamera::Logger::findCategory(char const*) const::<lambda(auto:2)> >)\n> >      (__first=0x555582c130, __last=0x303100736d617261, __pred=...) at /usr/include/c++/10/bits/stl_algobase.h:1974\n> > #6  0x0000007ff61b4648 in std::find_if<__gnu_cxx::__normal_iterator<libcamera::LogCategory* const*, std::vector<libcamera::LogCategory*> >, libcamera::Logger::findCategory(char const*) const::<lambda(auto:2)> >(__gnu_cxx::__normal_iterator<libcamera::LogCategory* const*, std::vector<libcamera::LogCategory*, std::allocator<libcamera::LogCategory*> > >, __gnu_cxx::__normal_iterator<libcamera::LogCategory* const*, std::vector<libcamera::LogCategory*, std::allocator<libcamera::LogCategory*> > >, struct {...}) (__first=0x555582c130, __last=0x303100736d617261, __pred=...) at /usr/include/c++/10/bits/stl_algo.h:3929\n> > #7  0x0000007ff61b3f60 in libcamera::Logger::findCategory(char const*) const (this=0x7ff61ec968 <libcamera::Logger::instance()::instance>, name=0x7ff61c4a28 \"Event\") at ../src/libcamera/base/log.cpp:748\n> > #8  0x0000007ff61b3fc4 in libcamera::LogCategory::create(char const*) (name=0x7ff61c4a28 \"Event\") at ../src/libcamera/base/log.cpp:791\n> > #9  0x0000007ff61a9ffc in libcamera::logCategoryEvent() () at ../src/libcamera/base/event_dispatcher.cpp:17\n> > #10 0x0000007ff61aac5c in libcamera::EventDispatcherPoll::poll(std::vector<pollfd, std::allocator<pollfd> >*) (this=0x7fe8006f90, pollfds=0x7ff48cb3e8) at ../src/libcamera/base/event_dispatcher_poll.cpp:216\n> > #11 0x0000007ff61aa8fc in libcamera::EventDispatcherPoll::processEvents() (this=0x7fe8006f90) at ../src/libcamera/base/event_dispatcher_poll.cpp:160\n> > #12 0x0000007ff61be0bc in libcamera::Thread::exec() (this=0x55555d0380) at ../src/libcamera/base/thread.cpp:341\n> > #13 0x0000007ff6643e88 in libcamera::CameraManager::Private::run() (this=0x55555d0370) at ../src/libcamera/camera_manager.cpp:122\n> > #14 0x0000007ff61be038 in libcamera::Thread::startThread() (this=0x55555d0380) at ../src/libcamera/base/thread.cpp:319\n> > #15 0x0000007ff61c2070 in std::__invoke_impl<void, void (libcamera::Thread::*)(), libcamera::Thread*>(std::__invoke_memfun_deref, void (libcamera::Thread::*&&)(), libcamera::Thread*&&)\n> >      (__f=@0x5555852ef0: (void (libcamera::Thread::*)(class libcamera::Thread * const)) 0x7ff61bdf38 <libcamera::Thread::startThread()>, __t=@0x5555852ee8: 0x55555d0380) at /usr/include/c++/10/bits/invoke.h:73\n> > #16 0x0000007ff61c1f88 in std::__invoke<void (libcamera::Thread::*)(), libcamera::Thread*>(void (libcamera::Thread::*&&)(), libcamera::Thread*&&)\n> >      (__fn=@0x5555852ef0: (void (libcamera::Thread::*)(class libcamera::Thread * const)) 0x7ff61bdf38 <libcamera::Thread::startThread()>) at /usr/include/c++/10/bits/invoke.h:95\n> > #17 0x0000007ff61c1eec in std::thread::_Invoker<std::tuple<void (libcamera::Thread::*)(), libcamera::Thread*> >::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) (this=0x5555852ee8)\n> >      at /usr/include/c++/10/thread:264\n> > #18 0x0000007ff61c1ea4 in std::thread::_Invoker<std::tuple<void (libcamera::Thread::*)(), libcamera::Thread*> >::operator()() (this=0x5555852ee8) at /usr/include/c++/10/thread:271\n> > #19 0x0000007ff61c1e84 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (libcamera::Thread::*)(), libcamera::Thread*> > >::_M_run() (this=0x5555852ee0) at /usr/include/c++/10/thread:215\n> > #20 0x0000007ff5ee1cac in  () at /lib/aarch64-linux-gnu/libstdc++.so.6\n> > #21 0x0000007ff7c78648 in start_thread (arg=0x7ff48cba80) at pthread_create.c:477\n> > #22 0x0000007ff7bcec1c in thread_start () at ../sysdeps/unix/sysv/linux/aarch64/clone.S:78\n> > \n> > \n> > diff --git a/src/libcamera/base/log.cpp b/src/libcamera/base/log.cpp\n> > index 55fbd7b0..c8045ef7 100644\n> > --- a/src/libcamera/base/log.cpp\n> > +++ b/src/libcamera/base/log.cpp\n> > @@ -21,6 +21,7 @@\n> >   #include <libcamera/logging.h>\n> >   \n> >   #include <libcamera/base/backtrace.h>\n> > +#include <libcamera/base/mutex.h>\n> >   #include <libcamera/base/thread.h>\n> >   #include <libcamera/base/utils.h>\n> >   \n> > @@ -788,6 +789,8 @@ LogCategory *Logger::findCategory(const char *name) const\n> >    */\n> >   LogCategory *LogCategory::create(const char *name)\n> >   {\n> > +\tstatic Mutex mutex_;\n> > +\tMutexLocker locker(mutex_);\n> >   \tLogCategory *category = Logger::instance()->findCategory(name);\n> >   \n> >   \tif (!category) {\n>","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 43CD3BE080\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 14 Mar 2023 13:00:51 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id AB236626D8;\n\tTue, 14 Mar 2023 14:00:50 +0100 (CET)","from mail-qv1-xf34.google.com (mail-qv1-xf34.google.com\n\t[IPv6:2607:f8b0:4864:20::f34])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D3B22626D6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 14 Mar 2023 14:00:48 +0100 (CET)","by mail-qv1-xf34.google.com with SMTP id ks17so10654450qvb.6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 14 Mar 2023 06:00:48 -0700 (PDT)","from nicolas-tpx395.localdomain (192-222-136-102.qc.cable.ebox.net.\n\t[192.222.136.102]) by smtp.gmail.com with ESMTPSA id\n\t207-20020a3704d8000000b0074575572030sm1754522qke.1.2023.03.14.06.00.46\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 14 Mar 2023 06:00:46 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1678798850;\n\tbh=dubDKsWKqLSk7dZ1Z5fdJBTYWccWRtF9Ql1rIl/U76g=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=p5DBfGiCA+YNWC9sYXSdJGk/5mLK7aGnYta9cS8x5bzEc6nnT4NdynKisqA7QWi0x\n\tw13Lw2nzbPNwl4zH1ZY5T0mTkF2IthWipfemMl0FGJ7aqPvs0RMSKqrru3pJSob9B8\n\txk0ZvpMj3IU4h7KkBwMVNa9dq+olju2T2gqhyoO2s+kOcYLI0miY4j4IqaCfHhdAsQ\n\t35mNJq2zVvaltVNtGqKHOxFBoJATkrrvJqq+8+HvHAwOza7KleTBxuehBm1Z08ERyx\n\tsHWu3szKq+kEKWj6Op+I8kaJ1RuSzbgJdic/xQrcfI6z+4/l6zyynU2o7FkxZz+Y28\n\t6yqNXSdh9mVvw==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ndufresne-ca.20210112.gappssmtp.com; s=20210112; t=1678798847;\n\th=mime-version:user-agent:content-transfer-encoding:references\n\t:in-reply-to:date:to:from:subject:message-id:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=wAtse+j/Wn1yGp6t59DhE9dwtLhIe9fimu7gWXhNj40=;\n\tb=Rfv2W2opGH3u+EyW0d0Pi2kWzrZaIFDhabKYsb8u182xpkrsHs4Ud/gzZaeJ6DTncA\n\tQ1g1IADW6B8Ul36ZiAqQUIDH4VQmLs812Mebi12yOQlt/HUFD0A9gTkZ8Di8UXIfZbNE\n\tGR2SKPwNPZ03523D3+iDacuc+VUKp6m0377bu3bR5cmq7NJ6BfcLAa1U9gfhJ/LNdaMk\n\tki3jUgnb9VsdpK08zVwpjevywvmTaUqo9zF8kOx+jUuNwmgrNMKMMSbaBxsQz5jDfXPF\n\tj4Dx3QFPvlMm0Pg2Q65z9yfNS7dMsVFY1XelfJbbYLf6FzLeIO8L9BBGdD5UxLvrUsQf\n\tKN9w=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected)\n\theader.d=ndufresne-ca.20210112.gappssmtp.com\n\theader.i=@ndufresne-ca.20210112.gappssmtp.com header.b=\"Rfv2W2op\"; \n\tdkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112; t=1678798847;\n\th=mime-version:user-agent:content-transfer-encoding:references\n\t:in-reply-to:date:to:from:subject:message-id:x-gm-message-state:from\n\t:to:cc:subject:date:message-id:reply-to;\n\tbh=wAtse+j/Wn1yGp6t59DhE9dwtLhIe9fimu7gWXhNj40=;\n\tb=X6+pF6mVBlj3xQkeDVO2kPFy6d2tI4rcCkrA7n/g5uR9Su+7IM3fPx2/yWgngi5JMc\n\tJiDFTm48lnD4tNjKbNMBSNB8dSdUHwEDcg3gW54UgyRGBsutRvPhhSysh/4aNENv2+DO\n\tdTZn3B7U91Nms4sKi5JcjdlkAUgwTAhrGR+aITh3pz+/1EAsXQFrxfKv5s/f7FOOO+zX\n\tRtpFwrrhoOOV6FpeyiBH30bWTpgYpipy2opVfw6OeEMA8bbQplyq/53zL3zRI7SHYfga\n\tdCy5IJvcdLAt8JqaSjoq4CM+HN2y5xBT8vPvMsihvNspSZK6l9EmkBc2uaLp3l0BGpfM\n\tuauQ==","X-Gm-Message-State":"AO0yUKUSBLqPLB+8BJbUIuNUzF5e7QSIb+efLRW/3cl9yt3uHrEHr1Cm\n\tCvqxq6IN60+ZluG6+bxdLM/EAg==","X-Google-Smtp-Source":"AK7set98Fr5TTLmN49m61Hdp//tXgZ4JRWPUTeqHETKarEfmEMYpHQyBPGYtEmM1mCBBHAr0sjMgMQ==","X-Received":"by 2002:a05:6214:1d23:b0:5a2:2a1d:bfb1 with SMTP id\n\tf3-20020a0562141d2300b005a22a1dbfb1mr19243971qvd.28.1678798847350; \n\tTue, 14 Mar 2023 06:00:47 -0700 (PDT)","Message-ID":"<79c1e3e06c8d83f6dfab0140e3e0cd53ef6852bd.camel@ndufresne.ca>","To":"Umang Jain <umang.jain@ideasonboard.com>, \n\tlibcamera-devel@lists.libcamera.org","Date":"Tue, 14 Mar 2023 09:00:46 -0400","In-Reply-To":"<4e38c59a-4c4d-a5c3-412e-bd6bdcc334de@ideasonboard.com>","References":"<20230313204134.2769860-1-nicolas@ndufresne.ca>\n\t<4e38c59a-4c4d-a5c3-412e-bd6bdcc334de@ideasonboard.com>","Content-Type":"text/plain; charset=\"UTF-8\"","Content-Transfer-Encoding":"quoted-printable","User-Agent":"Evolution 3.46.3 (3.46.3-1.fc37) ","MIME-Version":"1.0","Subject":"Re: [libcamera-devel] [RFC PATCH] libcamera: base: Make the\n\tregistration of log categories atomic","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>","From":"Nicolas Dufresne via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Nicolas Dufresne <nicolas@ndufresne.ca>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":26703,"web_url":"https://patchwork.libcamera.org/comment/26703/","msgid":"<167942067894.765114.11950367375347752265@Monstersaurus>","date":"2023-03-21T17:44:38","subject":"Re: [libcamera-devel] [RFC PATCH] libcamera: base: Make the\n\tregistration of log categories atomic","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Nicolas Dufresne via libcamera-devel (2023-03-14 13:00:46)\n> Le mardi 14 mars 2023 à 14:50 +0530, Umang Jain a écrit :\n> > Hi Nicolas\n> > \n> > On 3/14/23 2:11 AM, Nicolas Dufresne via libcamera-devel wrote:\n> > > From: Nicolas Dufresne <nicolas.dufresne@collabora.com>\n> > > \n> > > Logger:::create() is not currently thread safe and causes crashes\n> \n> Spotting some of my own typos now, should have two :: here.\n> \n> > \n> > Indeed. Given the fact that gstlibcamerasrc should be ideally moving \n> > away from using libcamera_private dependency (as LogCategory::create()) \n> > is an internal API\n> \n> gstlibcamerasrc is using GStreamer logger only. Perhaps I'm missing something ?\n> You'll see in the backtrace that libgstcamerasrc is not involved.\n> \n> > \n> > I can see that it's being called from other internal threads as well \n> > (like PostProcessorWorker from android HAL layer) so making it thread \n> > safe makes sense.\n> \n> Indeed, adding some sort of safety, but resorting to a global lock might not be\n> the best solution, that's why I started with an RFC. \n\nA cursory look through, I don't think this is a problem. This is likely\nas fine-grained as you can get.\n\nI expect the s/:::/::/ can be fixed when applying.\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> \n> >\n> > > noticeable on RaspberryPi 4. This adds a mutex around the creation\n> > > of categories.\n> > > \n> > > Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>\n> > > ---\n> > > \n> > >   src/libcamera/base/log.cpp | 3 +++\n> > >   1 file changed, 3 insertions(+)\n> > > \n> > > This is a quick fix. The crash I'm getting is very frequent, the backtrace\n> > > is the following. Pretty much 50% of the time on Raspberry Pi using:\n> > > \n> > >    gst-launch-1.0 libcamerasrc ! queue ! xvimagesink\n> > > \n> > > Thread 6 \"gst-launch-1.0\" received signal SIGSEGV, Segmentation fault.\n> > > [Switching to Thread 0x7ff48cc180 (LWP 88100)]\n> > > 0x0000007ff5f48a40 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::compare(char const*) const () from /lib/aarch64-linux-gnu/libstdc++.so.6\n> > > (gdb) bt\n> > > #0  0x0000007ff5f48a40 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::compare(char const*) const () at /lib/aarch64-linux-gnu/libstdc++.so.6\n> > > #1  0x0000007ff664efe0 in std::operator==<char, std::char_traits<char>, std::allocator<char> >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char const*)\n> > >      (__lhs=<error reading variable: Cannot access memory at address 0x705f317073696b7a>, __rhs=0x7ff61c4a28 \"Event\") at /usr/include/c++/10/bits/basic_string.h:6187\n> > > #2  0x0000007ff61b48d4 in operator()<libcamera::LogCategory*>(libcamera::LogCategory*) const (__closure=0x7ff48cb008, c=0x705f317073696b72) at ../src/libcamera/base/log.cpp:748\n> > > #3  0x0000007ff61b4910 in __gnu_cxx::__ops::_Iter_pred<libcamera::Logger::findCategory(char const*) const::<lambda(auto:2)> >::operator()<__gnu_cxx::__normal_iterator<libcamera::LogCategory* const*, std::vector<libcamera::LogCategory*> > >(__gnu_cxx::__normal_iterator<libcamera::LogCategory* const*, std::vector<libcamera::LogCategory*, std::allocator<libcamera::LogCategory*> > >)\n> > >      (this=0x7ff48cb008, __it=0x705f317073696b72) at /usr/include/c++/10/bits/predefined_ops.h:316\n> > > #4  0x0000007ff61b487c in std::__find_if<__gnu_cxx::__normal_iterator<libcamera::LogCategory* const*, std::vector<libcamera::LogCategory*> >, __gnu_cxx::__ops::_Iter_pred<libcamera::Logger::findCategory(char const*) const::<lambda(auto:2)> > >(__gnu_cxx::__normal_iterator<libcamera::LogCategory* const*, std::vector<libcamera::LogCategory*, std::allocator<libcamera::LogCategory*> > >, __gnu_cxx::__normal_iterator<libcamera::LogCategory* const*, std::vector<libcamera::LogCategory*, std::allocator<libcamera::LogCategory*> > >, __gnu_cxx::__ops::_Iter_pred<libcamera::Logger::findCategory(char const*) const::<lambda(auto:2)> >, std::random_access_iterator_tag) (__first=0x705f317073696b72, __last=0x303100736d617261, __pred=...) at /usr/include/c++/10/bits/stl_algobase.h:1959\n> > > #5  0x0000007ff61b46b4 in std::__find_if<__gnu_cxx::__normal_iterator<libcamera::LogCategory* const*, std::vector<libcamera::LogCategory*> >, __gnu_cxx::__ops::_Iter_pred<libcamera::Logger::findCategory(char const*) const::<lambda(auto:2)> > >(__gnu_cxx::__normal_iterator<libcamera::LogCategory* const*, std::vector<libcamera::LogCategory*, std::allocator<libcamera::LogCategory*> > >, __gnu_cxx::__normal_iterator<libcamera::LogCategory* const*, std::vector<libcamera::LogCategory*, std::allocator<libcamera::LogCategory*> > >, __gnu_cxx::__ops::_Iter_pred<libcamera::Logger::findCategory(char const*) const::<lambda(auto:2)> >)\n> > >      (__first=0x555582c130, __last=0x303100736d617261, __pred=...) at /usr/include/c++/10/bits/stl_algobase.h:1974\n> > > #6  0x0000007ff61b4648 in std::find_if<__gnu_cxx::__normal_iterator<libcamera::LogCategory* const*, std::vector<libcamera::LogCategory*> >, libcamera::Logger::findCategory(char const*) const::<lambda(auto:2)> >(__gnu_cxx::__normal_iterator<libcamera::LogCategory* const*, std::vector<libcamera::LogCategory*, std::allocator<libcamera::LogCategory*> > >, __gnu_cxx::__normal_iterator<libcamera::LogCategory* const*, std::vector<libcamera::LogCategory*, std::allocator<libcamera::LogCategory*> > >, struct {...}) (__first=0x555582c130, __last=0x303100736d617261, __pred=...) at /usr/include/c++/10/bits/stl_algo.h:3929\n> > > #7  0x0000007ff61b3f60 in libcamera::Logger::findCategory(char const*) const (this=0x7ff61ec968 <libcamera::Logger::instance()::instance>, name=0x7ff61c4a28 \"Event\") at ../src/libcamera/base/log.cpp:748\n> > > #8  0x0000007ff61b3fc4 in libcamera::LogCategory::create(char const*) (name=0x7ff61c4a28 \"Event\") at ../src/libcamera/base/log.cpp:791\n> > > #9  0x0000007ff61a9ffc in libcamera::logCategoryEvent() () at ../src/libcamera/base/event_dispatcher.cpp:17\n> > > #10 0x0000007ff61aac5c in libcamera::EventDispatcherPoll::poll(std::vector<pollfd, std::allocator<pollfd> >*) (this=0x7fe8006f90, pollfds=0x7ff48cb3e8) at ../src/libcamera/base/event_dispatcher_poll.cpp:216\n> > > #11 0x0000007ff61aa8fc in libcamera::EventDispatcherPoll::processEvents() (this=0x7fe8006f90) at ../src/libcamera/base/event_dispatcher_poll.cpp:160\n> > > #12 0x0000007ff61be0bc in libcamera::Thread::exec() (this=0x55555d0380) at ../src/libcamera/base/thread.cpp:341\n> > > #13 0x0000007ff6643e88 in libcamera::CameraManager::Private::run() (this=0x55555d0370) at ../src/libcamera/camera_manager.cpp:122\n> > > #14 0x0000007ff61be038 in libcamera::Thread::startThread() (this=0x55555d0380) at ../src/libcamera/base/thread.cpp:319\n> > > #15 0x0000007ff61c2070 in std::__invoke_impl<void, void (libcamera::Thread::*)(), libcamera::Thread*>(std::__invoke_memfun_deref, void (libcamera::Thread::*&&)(), libcamera::Thread*&&)\n> > >      (__f=@0x5555852ef0: (void (libcamera::Thread::*)(class libcamera::Thread * const)) 0x7ff61bdf38 <libcamera::Thread::startThread()>, __t=@0x5555852ee8: 0x55555d0380) at /usr/include/c++/10/bits/invoke.h:73\n> > > #16 0x0000007ff61c1f88 in std::__invoke<void (libcamera::Thread::*)(), libcamera::Thread*>(void (libcamera::Thread::*&&)(), libcamera::Thread*&&)\n> > >      (__fn=@0x5555852ef0: (void (libcamera::Thread::*)(class libcamera::Thread * const)) 0x7ff61bdf38 <libcamera::Thread::startThread()>) at /usr/include/c++/10/bits/invoke.h:95\n> > > #17 0x0000007ff61c1eec in std::thread::_Invoker<std::tuple<void (libcamera::Thread::*)(), libcamera::Thread*> >::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) (this=0x5555852ee8)\n> > >      at /usr/include/c++/10/thread:264\n> > > #18 0x0000007ff61c1ea4 in std::thread::_Invoker<std::tuple<void (libcamera::Thread::*)(), libcamera::Thread*> >::operator()() (this=0x5555852ee8) at /usr/include/c++/10/thread:271\n> > > #19 0x0000007ff61c1e84 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (libcamera::Thread::*)(), libcamera::Thread*> > >::_M_run() (this=0x5555852ee0) at /usr/include/c++/10/thread:215\n> > > #20 0x0000007ff5ee1cac in  () at /lib/aarch64-linux-gnu/libstdc++.so.6\n> > > #21 0x0000007ff7c78648 in start_thread (arg=0x7ff48cba80) at pthread_create.c:477\n> > > #22 0x0000007ff7bcec1c in thread_start () at ../sysdeps/unix/sysv/linux/aarch64/clone.S:78\n> > > \n> > > \n> > > diff --git a/src/libcamera/base/log.cpp b/src/libcamera/base/log.cpp\n> > > index 55fbd7b0..c8045ef7 100644\n> > > --- a/src/libcamera/base/log.cpp\n> > > +++ b/src/libcamera/base/log.cpp\n> > > @@ -21,6 +21,7 @@\n> > >   #include <libcamera/logging.h>\n> > >   \n> > >   #include <libcamera/base/backtrace.h>\n> > > +#include <libcamera/base/mutex.h>\n> > >   #include <libcamera/base/thread.h>\n> > >   #include <libcamera/base/utils.h>\n> > >   \n> > > @@ -788,6 +789,8 @@ LogCategory *Logger::findCategory(const char *name) const\n> > >    */\n> > >   LogCategory *LogCategory::create(const char *name)\n> > >   {\n> > > +   static Mutex mutex_;\n> > > +   MutexLocker locker(mutex_);\n> > >     LogCategory *category = Logger::instance()->findCategory(name);\n> > >   \n> > >     if (!category) {\n> > \n>","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 8158DC0F2A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 21 Mar 2023 17:44:44 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id DA46661ED1;\n\tTue, 21 Mar 2023 18:44:43 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9738761ED1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 21 Mar 2023 18:44:41 +0100 (CET)","from pendragon.ideasonboard.com\n\t(aztw-30-b2-v4wan-166917-cust845.vm26.cable.virginm.net\n\t[82.37.23.78])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 17B4210B;\n\tTue, 21 Mar 2023 18:44:41 +0100 (CET)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1679420683;\n\tbh=CCtgGfoxWusU6G2tY11c1fPQzWpkpGsZxZLSYc3qO5w=;\n\th=In-Reply-To:References:To:Date:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=d2NHfd+hgsZfQk4lmPEhDIGUZx2sv52n6FiMdrtReuVlxNToHlx+serjPyfeHKPUt\n\tDmp6PH5DcvNzt4Y1MNQvQcmK8xrjjH5FWoFRdikmce5kNhwXdwLi3ucRANWLGmAYxh\n\tT5qDGJ6XmFxVuhCXuhqFIWtpIr96JeXPuT42Xb4f+o/xZsaTbdebCsCfCR2oO+u1Ua\n\tjwNQpq9Ph0Jf2Pobek/pqWLG6UUVZsIM5aYqMfB63FYUl/V9CRE7zqjbGwo+acJj8L\n\tL0EBmoQYrLVZZk/CJ1K2jtZAAsOe106xK5oKpoD0V4aijpScLx62Xu27TjARbp7Eg7\n\tAtfXAz9xwRjgQ==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1679420681;\n\tbh=CCtgGfoxWusU6G2tY11c1fPQzWpkpGsZxZLSYc3qO5w=;\n\th=In-Reply-To:References:Subject:From:To:Date:From;\n\tb=AycJgOsvQ2nfHlbBSLgUyxtvthB40/WFFoLShcUTt4yIPdIRJyKmn0DKQwLvjllzn\n\tVxv4Yv7aIHezgqHc6d0UtBX4tAeb6Sk4s0LjypAhPI9g+zw/OWa+ZgEwGEPdElXKDC\n\tVPU+wLi+3DP3R5lt2I1Oy+9Un4GLxUq6c4KennxE="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"AycJgOsv\"; dkim-atps=neutral","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<79c1e3e06c8d83f6dfab0140e3e0cd53ef6852bd.camel@ndufresne.ca>","References":"<20230313204134.2769860-1-nicolas@ndufresne.ca>\n\t<4e38c59a-4c4d-a5c3-412e-bd6bdcc334de@ideasonboard.com>\n\t<79c1e3e06c8d83f6dfab0140e3e0cd53ef6852bd.camel@ndufresne.ca>","To":"Nicolas Dufresne <nicolas@ndufresne.ca>,\n\tUmang Jain <umang.jain@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Tue, 21 Mar 2023 17:44:38 +0000","Message-ID":"<167942067894.765114.11950367375347752265@Monstersaurus>","User-Agent":"alot/0.10","Subject":"Re: [libcamera-devel] [RFC PATCH] libcamera: base: Make the\n\tregistration of log categories atomic","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>","From":"Kieran Bingham via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":26704,"web_url":"https://patchwork.libcamera.org/comment/26704/","msgid":"<20230321175040.GA27203@pendragon.ideasonboard.com>","date":"2023-03-21T17:50:40","subject":"Re: [libcamera-devel] [RFC PATCH] libcamera: base: Make the\n\tregistration of log categories atomic","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Tue, Mar 21, 2023 at 05:44:38PM +0000, Kieran Bingham via libcamera-devel wrote:\n> Quoting Nicolas Dufresne via libcamera-devel (2023-03-14 13:00:46)\n> > Le mardi 14 mars 2023 à 14:50 +0530, Umang Jain a écrit :\n> > > Hi Nicolas\n> > > \n> > > On 3/14/23 2:11 AM, Nicolas Dufresne via libcamera-devel wrote:\n> > > > From: Nicolas Dufresne <nicolas.dufresne@collabora.com>\n> > > > \n> > > > Logger:::create() is not currently thread safe and causes crashes\n> > \n> > Spotting some of my own typos now, should have two :: here.\n> > \n> > > \n> > > Indeed. Given the fact that gstlibcamerasrc should be ideally moving \n> > > away from using libcamera_private dependency (as LogCategory::create()) \n> > > is an internal API\n> > \n> > gstlibcamerasrc is using GStreamer logger only. Perhaps I'm missing something ?\n> > You'll see in the backtrace that libgstcamerasrc is not involved.\n> > \n> > > \n> > > I can see that it's being called from other internal threads as well \n> > > (like PostProcessorWorker from android HAL layer) so making it thread \n> > > safe makes sense.\n> > \n> > Indeed, adding some sort of safety, but resorting to a global lock might not be\n> > the best solution, that's why I started with an RFC. \n> \n> A cursory look through, I don't think this is a problem. This is likely\n> as fine-grained as you can get.\n> \n> I expect the s/:::/::/ can be fixed when applying.\n> \n> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\nThe create() function is only called when log categories are created,\nwhich is on first use. The lock contention shouldn't be a big deal, it's\ngood enough for now.\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> > > > noticeable on RaspberryPi 4. This adds a mutex around the creation\n> > > > of categories.\n> > > > \n> > > > Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>\n> > > > ---\n> > > > \n> > > >   src/libcamera/base/log.cpp | 3 +++\n> > > >   1 file changed, 3 insertions(+)\n> > > > \n> > > > This is a quick fix. The crash I'm getting is very frequent, the backtrace\n> > > > is the following. Pretty much 50% of the time on Raspberry Pi using:\n> > > > \n> > > >    gst-launch-1.0 libcamerasrc ! queue ! xvimagesink\n> > > > \n> > > > Thread 6 \"gst-launch-1.0\" received signal SIGSEGV, Segmentation fault.\n> > > > [Switching to Thread 0x7ff48cc180 (LWP 88100)]\n> > > > 0x0000007ff5f48a40 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::compare(char const*) const () from /lib/aarch64-linux-gnu/libstdc++.so.6\n> > > > (gdb) bt\n> > > > #0  0x0000007ff5f48a40 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::compare(char const*) const () at /lib/aarch64-linux-gnu/libstdc++.so.6\n> > > > #1  0x0000007ff664efe0 in std::operator==<char, std::char_traits<char>, std::allocator<char> >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char const*)\n> > > >      (__lhs=<error reading variable: Cannot access memory at address 0x705f317073696b7a>, __rhs=0x7ff61c4a28 \"Event\") at /usr/include/c++/10/bits/basic_string.h:6187\n> > > > #2  0x0000007ff61b48d4 in operator()<libcamera::LogCategory*>(libcamera::LogCategory*) const (__closure=0x7ff48cb008, c=0x705f317073696b72) at ../src/libcamera/base/log.cpp:748\n> > > > #3  0x0000007ff61b4910 in __gnu_cxx::__ops::_Iter_pred<libcamera::Logger::findCategory(char const*) const::<lambda(auto:2)> >::operator()<__gnu_cxx::__normal_iterator<libcamera::LogCategory* const*, std::vector<libcamera::LogCategory*> > >(__gnu_cxx::__normal_iterator<libcamera::LogCategory* const*, std::vector<libcamera::LogCategory*, std::allocator<libcamera::LogCategory*> > >)\n> > > >      (this=0x7ff48cb008, __it=0x705f317073696b72) at /usr/include/c++/10/bits/predefined_ops.h:316\n> > > > #4  0x0000007ff61b487c in std::__find_if<__gnu_cxx::__normal_iterator<libcamera::LogCategory* const*, std::vector<libcamera::LogCategory*> >, __gnu_cxx::__ops::_Iter_pred<libcamera::Logger::findCategory(char const*) const::<lambda(auto:2)> > >(__gnu_cxx::__normal_iterator<libcamera::LogCategory* const*, std::vector<libcamera::LogCategory*, std::allocator<libcamera::LogCategory*> > >, __gnu_cxx::__normal_iterator<libcamera::LogCategory* const*, std::vector<libcamera::LogCategory*, std::allocator<libcamera::LogCategory*> > >, __gnu_cxx::__ops::_Iter_pred<libcamera::Logger::findCategory(char const*) const::<lambda(auto:2)> >, std::random_access_iterator_tag) (__first=0x705f317073696b72, __last=0x303100736d617261, __pred=...) at /usr/include/c++/10/bits/stl_algobase.h:1959\n> > > > #5  0x0000007ff61b46b4 in std::__find_if<__gnu_cxx::__normal_iterator<libcamera::LogCategory* const*, std::vector<libcamera::LogCategory*> >, __gnu_cxx::__ops::_Iter_pred<libcamera::Logger::findCategory(char const*) const::<lambda(auto:2)> > >(__gnu_cxx::__normal_iterator<libcamera::LogCategory* const*, std::vector<libcamera::LogCategory*, std::allocator<libcamera::LogCategory*> > >, __gnu_cxx::__normal_iterator<libcamera::LogCategory* const*, std::vector<libcamera::LogCategory*, std::allocator<libcamera::LogCategory*> > >, __gnu_cxx::__ops::_Iter_pred<libcamera::Logger::findCategory(char const*) const::<lambda(auto:2)> >)\n> > > >      (__first=0x555582c130, __last=0x303100736d617261, __pred=...) at /usr/include/c++/10/bits/stl_algobase.h:1974\n> > > > #6  0x0000007ff61b4648 in std::find_if<__gnu_cxx::__normal_iterator<libcamera::LogCategory* const*, std::vector<libcamera::LogCategory*> >, libcamera::Logger::findCategory(char const*) const::<lambda(auto:2)> >(__gnu_cxx::__normal_iterator<libcamera::LogCategory* const*, std::vector<libcamera::LogCategory*, std::allocator<libcamera::LogCategory*> > >, __gnu_cxx::__normal_iterator<libcamera::LogCategory* const*, std::vector<libcamera::LogCategory*, std::allocator<libcamera::LogCategory*> > >, struct {...}) (__first=0x555582c130, __last=0x303100736d617261, __pred=...) at /usr/include/c++/10/bits/stl_algo.h:3929\n> > > > #7  0x0000007ff61b3f60 in libcamera::Logger::findCategory(char const*) const (this=0x7ff61ec968 <libcamera::Logger::instance()::instance>, name=0x7ff61c4a28 \"Event\") at ../src/libcamera/base/log.cpp:748\n> > > > #8  0x0000007ff61b3fc4 in libcamera::LogCategory::create(char const*) (name=0x7ff61c4a28 \"Event\") at ../src/libcamera/base/log.cpp:791\n> > > > #9  0x0000007ff61a9ffc in libcamera::logCategoryEvent() () at ../src/libcamera/base/event_dispatcher.cpp:17\n> > > > #10 0x0000007ff61aac5c in libcamera::EventDispatcherPoll::poll(std::vector<pollfd, std::allocator<pollfd> >*) (this=0x7fe8006f90, pollfds=0x7ff48cb3e8) at ../src/libcamera/base/event_dispatcher_poll.cpp:216\n> > > > #11 0x0000007ff61aa8fc in libcamera::EventDispatcherPoll::processEvents() (this=0x7fe8006f90) at ../src/libcamera/base/event_dispatcher_poll.cpp:160\n> > > > #12 0x0000007ff61be0bc in libcamera::Thread::exec() (this=0x55555d0380) at ../src/libcamera/base/thread.cpp:341\n> > > > #13 0x0000007ff6643e88 in libcamera::CameraManager::Private::run() (this=0x55555d0370) at ../src/libcamera/camera_manager.cpp:122\n> > > > #14 0x0000007ff61be038 in libcamera::Thread::startThread() (this=0x55555d0380) at ../src/libcamera/base/thread.cpp:319\n> > > > #15 0x0000007ff61c2070 in std::__invoke_impl<void, void (libcamera::Thread::*)(), libcamera::Thread*>(std::__invoke_memfun_deref, void (libcamera::Thread::*&&)(), libcamera::Thread*&&)\n> > > >      (__f=@0x5555852ef0: (void (libcamera::Thread::*)(class libcamera::Thread * const)) 0x7ff61bdf38 <libcamera::Thread::startThread()>, __t=@0x5555852ee8: 0x55555d0380) at /usr/include/c++/10/bits/invoke.h:73\n> > > > #16 0x0000007ff61c1f88 in std::__invoke<void (libcamera::Thread::*)(), libcamera::Thread*>(void (libcamera::Thread::*&&)(), libcamera::Thread*&&)\n> > > >      (__fn=@0x5555852ef0: (void (libcamera::Thread::*)(class libcamera::Thread * const)) 0x7ff61bdf38 <libcamera::Thread::startThread()>) at /usr/include/c++/10/bits/invoke.h:95\n> > > > #17 0x0000007ff61c1eec in std::thread::_Invoker<std::tuple<void (libcamera::Thread::*)(), libcamera::Thread*> >::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) (this=0x5555852ee8)\n> > > >      at /usr/include/c++/10/thread:264\n> > > > #18 0x0000007ff61c1ea4 in std::thread::_Invoker<std::tuple<void (libcamera::Thread::*)(), libcamera::Thread*> >::operator()() (this=0x5555852ee8) at /usr/include/c++/10/thread:271\n> > > > #19 0x0000007ff61c1e84 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (libcamera::Thread::*)(), libcamera::Thread*> > >::_M_run() (this=0x5555852ee0) at /usr/include/c++/10/thread:215\n> > > > #20 0x0000007ff5ee1cac in  () at /lib/aarch64-linux-gnu/libstdc++.so.6\n> > > > #21 0x0000007ff7c78648 in start_thread (arg=0x7ff48cba80) at pthread_create.c:477\n> > > > #22 0x0000007ff7bcec1c in thread_start () at ../sysdeps/unix/sysv/linux/aarch64/clone.S:78\n> > > > \n> > > > \n> > > > diff --git a/src/libcamera/base/log.cpp b/src/libcamera/base/log.cpp\n> > > > index 55fbd7b0..c8045ef7 100644\n> > > > --- a/src/libcamera/base/log.cpp\n> > > > +++ b/src/libcamera/base/log.cpp\n> > > > @@ -21,6 +21,7 @@\n> > > >   #include <libcamera/logging.h>\n> > > >   \n> > > >   #include <libcamera/base/backtrace.h>\n> > > > +#include <libcamera/base/mutex.h>\n> > > >   #include <libcamera/base/thread.h>\n> > > >   #include <libcamera/base/utils.h>\n> > > >   \n> > > > @@ -788,6 +789,8 @@ LogCategory *Logger::findCategory(const char *name) const\n> > > >    */\n> > > >   LogCategory *LogCategory::create(const char *name)\n> > > >   {\n> > > > +   static Mutex mutex_;\n> > > > +   MutexLocker locker(mutex_);\n> > > >     LogCategory *category = Logger::instance()->findCategory(name);\n> > > >   \n> > > >     if (!category) {\n> > > \n> >","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 63B80C0F1B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 21 Mar 2023 17:50:36 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id BC0DB61ED3;\n\tTue, 21 Mar 2023 18:50:35 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A033B61ED1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 21 Mar 2023 18:50:34 +0100 (CET)","from pendragon.ideasonboard.com (213-243-189-158.bb.dnainternet.fi\n\t[213.243.189.158])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id F1E3510B;\n\tTue, 21 Mar 2023 18:50:33 +0100 (CET)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1679421035;\n\tbh=LASPprvGrePsRPAcD65jOGh4QrFF1xvdb1XWINVqDHk=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=g9lJMudaZ3kGHe7eiYTzFA3IZQ97bJAHiwBZEQb5+JCJcDQj2It1aftbiikZrk6rT\n\thY817wfheBnepd7fWWpokROz+I1JciTaCv3ONz8PHwD4opDBXea9SV8vvdA+b3CE6Z\n\tKggmKX9NohB2DTv2vNivYplsUa1vJO4YMd7BWTp5DC6g+WqZnKrDjsMuOjdX9XiToB\n\t+SCz/82Gb7srcL0dB+uRBwSOO5qOFvSmNzI7x2+99NKYm89GsZoMe5YEdwwSAxmYBC\n\tQajohpdOsPeXbsNUBCjjjNtNTtnHd8AS8vmACoD7C+sJ8IfgJysyg1rinjlhXJLMm8\n\tVnLQQA0jeJ84w==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1679421034;\n\tbh=LASPprvGrePsRPAcD65jOGh4QrFF1xvdb1XWINVqDHk=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=YbfO479DhuFyIeUsC4/Z3SOBE8Xqf/pg+wU6FOXnntlvycxe+PFtdpU7oGuIESMti\n\tNkZJe0+gCY768HctgY6w2IBJgFP2YIB2QTHlrrmKjEw6AkMiXVuF6UqdGev8ZH8dc7\n\tYSwV/sCBK0FZi6AaSrqqAA61bMAMf52HDMttakPI="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"YbfO479D\"; dkim-atps=neutral","Date":"Tue, 21 Mar 2023 19:50:40 +0200","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Message-ID":"<20230321175040.GA27203@pendragon.ideasonboard.com>","References":"<20230313204134.2769860-1-nicolas@ndufresne.ca>\n\t<4e38c59a-4c4d-a5c3-412e-bd6bdcc334de@ideasonboard.com>\n\t<79c1e3e06c8d83f6dfab0140e3e0cd53ef6852bd.camel@ndufresne.ca>\n\t<167942067894.765114.11950367375347752265@Monstersaurus>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<167942067894.765114.11950367375347752265@Monstersaurus>","Subject":"Re: [libcamera-devel] [RFC PATCH] libcamera: base: Make the\n\tregistration of log categories atomic","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>","From":"Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":26714,"web_url":"https://patchwork.libcamera.org/comment/26714/","msgid":"<6284e4a2766f345500371b55936c242616989ed8.camel@ndufresne.ca>","date":"2023-03-22T15:43:17","subject":"Re: [libcamera-devel] [RFC PATCH] libcamera: base: Make the\n\tregistration of log categories atomic","submitter":{"id":30,"url":"https://patchwork.libcamera.org/api/people/30/","name":"Nicolas Dufresne","email":"nicolas@ndufresne.ca"},"content":"Le mardi 21 mars 2023 à 19:50 +0200, Laurent Pinchart a écrit :\n> On Tue, Mar 21, 2023 at 05:44:38PM +0000, Kieran Bingham via libcamera-devel wrote:\n> > Quoting Nicolas Dufresne via libcamera-devel (2023-03-14 13:00:46)\n> > > Le mardi 14 mars 2023 à 14:50 +0530, Umang Jain a écrit :\n> > > > Hi Nicolas\n> > > > \n> > > > On 3/14/23 2:11 AM, Nicolas Dufresne via libcamera-devel wrote:\n> > > > > From: Nicolas Dufresne <nicolas.dufresne@collabora.com>\n> > > > > \n> > > > > Logger:::create() is not currently thread safe and causes crashes\n> > > \n> > > Spotting some of my own typos now, should have two :: here.\n> > > \n> > > > \n> > > > Indeed. Given the fact that gstlibcamerasrc should be ideally moving \n> > > > away from using libcamera_private dependency (as LogCategory::create()) \n> > > > is an internal API\n> > > \n> > > gstlibcamerasrc is using GStreamer logger only. Perhaps I'm missing something ?\n> > > You'll see in the backtrace that libgstcamerasrc is not involved.\n> > > \n> > > > \n> > > > I can see that it's being called from other internal threads as well \n> > > > (like PostProcessorWorker from android HAL layer) so making it thread \n> > > > safe makes sense.\n> > > \n> > > Indeed, adding some sort of safety, but resorting to a global lock might not be\n> > > the best solution, that's why I started with an RFC. \n> > \n> > A cursory look through, I don't think this is a problem. This is likely\n> > as fine-grained as you can get.\n> > \n> > I expect the s/:::/::/ can be fixed when applying.\n> > \n> > Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> \n> The create() function is only called when log categories are created,\n> which is on first use. The lock contention shouldn't be a big deal, it's\n> good enough for now.\n> \n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nThanks for the reviews, so feel free to fix my tripped : typo and drop the RFC. \n\nregards,\nNicolas\n\n> \n> > > > > noticeable on RaspberryPi 4. This adds a mutex around the creation\n> > > > > of categories.\n> > > > > \n> > > > > Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>\n> > > > > ---\n> > > > > \n> > > > >   src/libcamera/base/log.cpp | 3 +++\n> > > > >   1 file changed, 3 insertions(+)\n> > > > > \n> > > > > This is a quick fix. The crash I'm getting is very frequent, the backtrace\n> > > > > is the following. Pretty much 50% of the time on Raspberry Pi using:\n> > > > > \n> > > > >    gst-launch-1.0 libcamerasrc ! queue ! xvimagesink\n> > > > > \n> > > > > Thread 6 \"gst-launch-1.0\" received signal SIGSEGV, Segmentation fault.\n> > > > > [Switching to Thread 0x7ff48cc180 (LWP 88100)]\n> > > > > 0x0000007ff5f48a40 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::compare(char const*) const () from /lib/aarch64-linux-gnu/libstdc++.so.6\n> > > > > (gdb) bt\n> > > > > #0  0x0000007ff5f48a40 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::compare(char const*) const () at /lib/aarch64-linux-gnu/libstdc++.so.6\n> > > > > #1  0x0000007ff664efe0 in std::operator==<char, std::char_traits<char>, std::allocator<char> >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char const*)\n> > > > >      (__lhs=<error reading variable: Cannot access memory at address 0x705f317073696b7a>, __rhs=0x7ff61c4a28 \"Event\") at /usr/include/c++/10/bits/basic_string.h:6187\n> > > > > #2  0x0000007ff61b48d4 in operator()<libcamera::LogCategory*>(libcamera::LogCategory*) const (__closure=0x7ff48cb008, c=0x705f317073696b72) at ../src/libcamera/base/log.cpp:748\n> > > > > #3  0x0000007ff61b4910 in __gnu_cxx::__ops::_Iter_pred<libcamera::Logger::findCategory(char const*) const::<lambda(auto:2)> >::operator()<__gnu_cxx::__normal_iterator<libcamera::LogCategory* const*, std::vector<libcamera::LogCategory*> > >(__gnu_cxx::__normal_iterator<libcamera::LogCategory* const*, std::vector<libcamera::LogCategory*, std::allocator<libcamera::LogCategory*> > >)\n> > > > >      (this=0x7ff48cb008, __it=0x705f317073696b72) at /usr/include/c++/10/bits/predefined_ops.h:316\n> > > > > #4  0x0000007ff61b487c in std::__find_if<__gnu_cxx::__normal_iterator<libcamera::LogCategory* const*, std::vector<libcamera::LogCategory*> >, __gnu_cxx::__ops::_Iter_pred<libcamera::Logger::findCategory(char const*) const::<lambda(auto:2)> > >(__gnu_cxx::__normal_iterator<libcamera::LogCategory* const*, std::vector<libcamera::LogCategory*, std::allocator<libcamera::LogCategory*> > >, __gnu_cxx::__normal_iterator<libcamera::LogCategory* const*, std::vector<libcamera::LogCategory*, std::allocator<libcamera::LogCategory*> > >, __gnu_cxx::__ops::_Iter_pred<libcamera::Logger::findCategory(char const*) const::<lambda(auto:2)> >, std::random_access_iterator_tag) (__first=0x705f317073696b72, __last=0x303100736d617261, __pred=...) at /usr/include/c++/10/bits/stl_algobase.h:1959\n> > > > > #5  0x0000007ff61b46b4 in std::__find_if<__gnu_cxx::__normal_iterator<libcamera::LogCategory* const*, std::vector<libcamera::LogCategory*> >, __gnu_cxx::__ops::_Iter_pred<libcamera::Logger::findCategory(char const*) const::<lambda(auto:2)> > >(__gnu_cxx::__normal_iterator<libcamera::LogCategory* const*, std::vector<libcamera::LogCategory*, std::allocator<libcamera::LogCategory*> > >, __gnu_cxx::__normal_iterator<libcamera::LogCategory* const*, std::vector<libcamera::LogCategory*, std::allocator<libcamera::LogCategory*> > >, __gnu_cxx::__ops::_Iter_pred<libcamera::Logger::findCategory(char const*) const::<lambda(auto:2)> >)\n> > > > >      (__first=0x555582c130, __last=0x303100736d617261, __pred=...) at /usr/include/c++/10/bits/stl_algobase.h:1974\n> > > > > #6  0x0000007ff61b4648 in std::find_if<__gnu_cxx::__normal_iterator<libcamera::LogCategory* const*, std::vector<libcamera::LogCategory*> >, libcamera::Logger::findCategory(char const*) const::<lambda(auto:2)> >(__gnu_cxx::__normal_iterator<libcamera::LogCategory* const*, std::vector<libcamera::LogCategory*, std::allocator<libcamera::LogCategory*> > >, __gnu_cxx::__normal_iterator<libcamera::LogCategory* const*, std::vector<libcamera::LogCategory*, std::allocator<libcamera::LogCategory*> > >, struct {...}) (__first=0x555582c130, __last=0x303100736d617261, __pred=...) at /usr/include/c++/10/bits/stl_algo.h:3929\n> > > > > #7  0x0000007ff61b3f60 in libcamera::Logger::findCategory(char const*) const (this=0x7ff61ec968 <libcamera::Logger::instance()::instance>, name=0x7ff61c4a28 \"Event\") at ../src/libcamera/base/log.cpp:748\n> > > > > #8  0x0000007ff61b3fc4 in libcamera::LogCategory::create(char const*) (name=0x7ff61c4a28 \"Event\") at ../src/libcamera/base/log.cpp:791\n> > > > > #9  0x0000007ff61a9ffc in libcamera::logCategoryEvent() () at ../src/libcamera/base/event_dispatcher.cpp:17\n> > > > > #10 0x0000007ff61aac5c in libcamera::EventDispatcherPoll::poll(std::vector<pollfd, std::allocator<pollfd> >*) (this=0x7fe8006f90, pollfds=0x7ff48cb3e8) at ../src/libcamera/base/event_dispatcher_poll.cpp:216\n> > > > > #11 0x0000007ff61aa8fc in libcamera::EventDispatcherPoll::processEvents() (this=0x7fe8006f90) at ../src/libcamera/base/event_dispatcher_poll.cpp:160\n> > > > > #12 0x0000007ff61be0bc in libcamera::Thread::exec() (this=0x55555d0380) at ../src/libcamera/base/thread.cpp:341\n> > > > > #13 0x0000007ff6643e88 in libcamera::CameraManager::Private::run() (this=0x55555d0370) at ../src/libcamera/camera_manager.cpp:122\n> > > > > #14 0x0000007ff61be038 in libcamera::Thread::startThread() (this=0x55555d0380) at ../src/libcamera/base/thread.cpp:319\n> > > > > #15 0x0000007ff61c2070 in std::__invoke_impl<void, void (libcamera::Thread::*)(), libcamera::Thread*>(std::__invoke_memfun_deref, void (libcamera::Thread::*&&)(), libcamera::Thread*&&)\n> > > > >      (__f=@0x5555852ef0: (void (libcamera::Thread::*)(class libcamera::Thread * const)) 0x7ff61bdf38 <libcamera::Thread::startThread()>, __t=@0x5555852ee8: 0x55555d0380) at /usr/include/c++/10/bits/invoke.h:73\n> > > > > #16 0x0000007ff61c1f88 in std::__invoke<void (libcamera::Thread::*)(), libcamera::Thread*>(void (libcamera::Thread::*&&)(), libcamera::Thread*&&)\n> > > > >      (__fn=@0x5555852ef0: (void (libcamera::Thread::*)(class libcamera::Thread * const)) 0x7ff61bdf38 <libcamera::Thread::startThread()>) at /usr/include/c++/10/bits/invoke.h:95\n> > > > > #17 0x0000007ff61c1eec in std::thread::_Invoker<std::tuple<void (libcamera::Thread::*)(), libcamera::Thread*> >::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) (this=0x5555852ee8)\n> > > > >      at /usr/include/c++/10/thread:264\n> > > > > #18 0x0000007ff61c1ea4 in std::thread::_Invoker<std::tuple<void (libcamera::Thread::*)(), libcamera::Thread*> >::operator()() (this=0x5555852ee8) at /usr/include/c++/10/thread:271\n> > > > > #19 0x0000007ff61c1e84 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (libcamera::Thread::*)(), libcamera::Thread*> > >::_M_run() (this=0x5555852ee0) at /usr/include/c++/10/thread:215\n> > > > > #20 0x0000007ff5ee1cac in  () at /lib/aarch64-linux-gnu/libstdc++.so.6\n> > > > > #21 0x0000007ff7c78648 in start_thread (arg=0x7ff48cba80) at pthread_create.c:477\n> > > > > #22 0x0000007ff7bcec1c in thread_start () at ../sysdeps/unix/sysv/linux/aarch64/clone.S:78\n> > > > > \n> > > > > \n> > > > > diff --git a/src/libcamera/base/log.cpp b/src/libcamera/base/log.cpp\n> > > > > index 55fbd7b0..c8045ef7 100644\n> > > > > --- a/src/libcamera/base/log.cpp\n> > > > > +++ b/src/libcamera/base/log.cpp\n> > > > > @@ -21,6 +21,7 @@\n> > > > >   #include <libcamera/logging.h>\n> > > > >   \n> > > > >   #include <libcamera/base/backtrace.h>\n> > > > > +#include <libcamera/base/mutex.h>\n> > > > >   #include <libcamera/base/thread.h>\n> > > > >   #include <libcamera/base/utils.h>\n> > > > >   \n> > > > > @@ -788,6 +789,8 @@ LogCategory *Logger::findCategory(const char *name) const\n> > > > >    */\n> > > > >   LogCategory *LogCategory::create(const char *name)\n> > > > >   {\n> > > > > +   static Mutex mutex_;\n> > > > > +   MutexLocker locker(mutex_);\n> > > > >     LogCategory *category = Logger::instance()->findCategory(name);\n> > > > >   \n> > > > >     if (!category) {\n> > > > \n> > > \n>","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 426F8C0F1B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 22 Mar 2023 15:43:22 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 46A99626E5;\n\tWed, 22 Mar 2023 16:43:21 +0100 (CET)","from mail-qv1-xf31.google.com (mail-qv1-xf31.google.com\n\t[IPv6:2607:f8b0:4864:20::f31])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id AC80661ECE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 22 Mar 2023 16:43:19 +0100 (CET)","by mail-qv1-xf31.google.com with SMTP id m6so12438202qvq.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 22 Mar 2023 08:43:19 -0700 (PDT)","from nicolas-tpx395.localdomain (192-222-136-102.qc.cable.ebox.net.\n\t[192.222.136.102]) by smtp.gmail.com with ESMTPSA id\n\tt10-20020a37aa0a000000b0074683c45f6csm6693853qke.1.2023.03.22.08.43.17\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 22 Mar 2023 08:43:18 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1679499801;\n\tbh=F3Oqq8QMbvINgQZEs5TVQdBMUTdhTUQowIjsYm2uOy0=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=rVL+hWZR8TWFYKoDrbYSVrCp0v2gGGG4Yzmm+f9/FMv4z34EWVc4OpsGT1cZwifON\n\tSFKdI+fqxIt45140mjXFLqE2Q5IZQtScJpWRrgidzPuUMsRNNeFBvbic0lSzUwwf3N\n\tLgnJKhyA1C2P7b5A4O3Jlqcxs9VxUpOvP8433TOzU4W18OJ9WgkymFzATCJChAYvWm\n\t2r6Ckg6OnpXVCFStLukyYMqlEuC70Lb34mL+Zq7tMfhXoBGVgPzXccBzD6GC8NLM9H\n\trE130BwLdSL1BNUMotHW+n5tdtrAAwcVc8Cc2zG3R4EHQw6RvQwrqg7pWa2SuLY7cj\n\t+MJCJMXIiXooA==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ndufresne-ca.20210112.gappssmtp.com; s=20210112; t=1679499798;\n\th=mime-version:user-agent:content-transfer-encoding:references\n\t:in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject\n\t:date:message-id:reply-to;\n\tbh=o+i/Y5+YoUJl28IOOAT4qA90Nk2wWrqO7LfYZfw+kLA=;\n\tb=BwNZJu2V+h6I5tc6HkjL+bk8xXyRuopnu+XtxSdr5vZ/u9duFBCLQ03ZsVXRqavbhi\n\tms68/AXYugeKNVt7s4dpFGYFexjYW/1uyv28iD5s/XWuDG8ScSfh/Z1mJggHYxEClTZg\n\tX86yGW8vvVOVn6mEQNX4IV68xsdUmLC6YG/x1ydGdWWFLmqlsFQ9wNTtA9gEjIvQsDWy\n\tMXWRMMYuUoj7NqknYMEBCsq5iwiv0olWsx6ihm2EklpTnXc3lWnwLhk1f3ZiLkppLeHs\n\t5GnqFb1Xg+AQixlh6kxlmYMO0O6jLShVkQRUesU4K1P/6U1H+mxciLJPuuLOxk4aZJ2x\n\tJwjg=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected)\n\theader.d=ndufresne-ca.20210112.gappssmtp.com\n\theader.i=@ndufresne-ca.20210112.gappssmtp.com header.b=\"BwNZJu2V\"; \n\tdkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112; t=1679499798;\n\th=mime-version:user-agent:content-transfer-encoding:references\n\t:in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state\n\t:from:to:cc:subject:date:message-id:reply-to;\n\tbh=o+i/Y5+YoUJl28IOOAT4qA90Nk2wWrqO7LfYZfw+kLA=;\n\tb=Xq4qDzbMGRnvVyuHKVALzmKaPWhcC0rqwr9gtKs4QN5yQ/Ruf9s40VuE+8W3V1jfb9\n\tI87TD6HlcztbaMB8Gds97sNAJLBduAcF7y/Sl952/F/cdWMDF810i8ySnHQI3g3zAedS\n\t5d4vZP37loxi4pP0/cl6CDw/8lSe/dq3M68v5rat2HRSUjz2wsOtnqo1Uw/e5lLDn8Ra\n\t/WoETRjZ9rVKLhDlzlVz2+dduQvs45jpaV1iin9/WM8vsuHJPTaVgPgd6Z/hD9xsqR1V\n\ti+UBMSQ6PoUa98UyN0NFJa1rZ/Pg8nPJ71nu+oPZdE/ghWd7lOgkdSBoBfd80MfUtH+P\n\tUXJA==","X-Gm-Message-State":"AO0yUKUSzsZVojyZ+Z2POs9isruLdxJE8Xb5cGKYZDwynA0TU2x+DM90\n\tJoHsZnOSy7nTMtQwcTScqlVwpKj+rR2PbEO8MY4=","X-Google-Smtp-Source":"AK7set8hofp3BeZpHzoixMrSNQl59LUt1W693dQDZWshe/hek73aMuAXWr+v9lx6uWb3pOky6pDXvA==","X-Received":"by 2002:a05:6214:62e:b0:56e:fe99:b296 with SMTP id\n\ta14-20020a056214062e00b0056efe99b296mr5494071qvx.42.1679499798425; \n\tWed, 22 Mar 2023 08:43:18 -0700 (PDT)","Message-ID":"<6284e4a2766f345500371b55936c242616989ed8.camel@ndufresne.ca>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>, Kieran Bingham\n\t<kieran.bingham@ideasonboard.com>","Date":"Wed, 22 Mar 2023 11:43:17 -0400","In-Reply-To":"<20230321175040.GA27203@pendragon.ideasonboard.com>","References":"<20230313204134.2769860-1-nicolas@ndufresne.ca>\n\t<4e38c59a-4c4d-a5c3-412e-bd6bdcc334de@ideasonboard.com>\n\t<79c1e3e06c8d83f6dfab0140e3e0cd53ef6852bd.camel@ndufresne.ca>\n\t<167942067894.765114.11950367375347752265@Monstersaurus>\n\t<20230321175040.GA27203@pendragon.ideasonboard.com>","Content-Type":"text/plain; charset=\"UTF-8\"","Content-Transfer-Encoding":"quoted-printable","User-Agent":"Evolution 3.46.4 (3.46.4-1.fc37) ","MIME-Version":"1.0","Subject":"Re: [libcamera-devel] [RFC PATCH] libcamera: base: Make the\n\tregistration of log categories atomic","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>","From":"Nicolas Dufresne via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Nicolas Dufresne <nicolas@ndufresne.ca>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":26715,"web_url":"https://patchwork.libcamera.org/comment/26715/","msgid":"<167950111918.2462170.18029213641159333809@Monstersaurus>","date":"2023-03-22T16:05:19","subject":"Re: [libcamera-devel] [RFC PATCH] libcamera: base: Make the\n\tregistration of log categories atomic","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Hi Nicolas,\n\nQuoting Nicolas Dufresne (2023-03-22 15:43:17)\n> Le mardi 21 mars 2023 à 19:50 +0200, Laurent Pinchart a écrit :\n> > On Tue, Mar 21, 2023 at 05:44:38PM +0000, Kieran Bingham via libcamera-devel wrote:\n> > > Quoting Nicolas Dufresne via libcamera-devel (2023-03-14 13:00:46)\n> > > \n> > > I expect the s/:::/::/ can be fixed when applying.\n> > > Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> \n> Thanks for the reviews, so feel free to fix my tripped : typo and drop the RFC. \n\nNo worries. This was merged last night:\n - https://git.libcamera.org/libcamera/libcamera.git/commit/?id=2ccca099d3cbdfa32f0a8bfd2168873b7b803159\n\n--\nKieran","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 6F910C0F2A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 22 Mar 2023 16:05:25 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B8A94626DA;\n\tWed, 22 Mar 2023 17:05:24 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D872F61ECE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 22 Mar 2023 17:05:22 +0100 (CET)","from pendragon.ideasonboard.com\n\t(aztw-30-b2-v4wan-166917-cust845.vm26.cable.virginm.net\n\t[82.37.23.78])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 4D462118E;\n\tWed, 22 Mar 2023 17:05:22 +0100 (CET)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1679501124;\n\tbh=DjnnrrIku+mAbVR/hykVGdNz2afZzdqfPwKLPEJgviI=;\n\th=In-Reply-To:References:To:Date:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=vilOVK82H2qx4v1nlxYsBmfRM9Pc3bfF/pIQI+q3cD0GzhE9fYkLEMr2jAU1jOof6\n\tzvSucl0bMzkxfehRY4UxHICKOG5/ZDlGtVHfKLn6oo1rc0hXx1UN26izfLqR+XDgCG\n\twJ1cfcGzI5qKckHnniD91spXTi9W+0DhJgS6b28xhwV/25gE/RMzVVbR5yBWC27Jhm\n\t5Cec8T0YD6z6o/MvxBFbvE7Xw5TJlxtL4LEaBjgTVNVj2H471ajAi6i4LsPelPsfNI\n\tk6LAS/pI5KYFc2QumB8y+tHEFBlkmTtXWAt6vkZTQM+k9ftGrFqi0AqCUTwD+X4GBT\n\tXegH8408/mmzg==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1679501122;\n\tbh=DjnnrrIku+mAbVR/hykVGdNz2afZzdqfPwKLPEJgviI=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=btQx6RSUsKZ0PZXazmj+9DZ49eSL9JmGXzXPe6n157XxYPBJhkGZYpQjH7fxqQ7dg\n\tVgZCQme35B8FXp7LLZpvLk5/agtm9tRTSqQNvSpGvKZ4V3L18RL4YEThP1eDMfJjz6\n\tPCKHTi0L40QXfOCF4kI/N9ryCXi0daJK9Pv6YAXQ="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"btQx6RSU\"; dkim-atps=neutral","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<6284e4a2766f345500371b55936c242616989ed8.camel@ndufresne.ca>","References":"<20230313204134.2769860-1-nicolas@ndufresne.ca>\n\t<4e38c59a-4c4d-a5c3-412e-bd6bdcc334de@ideasonboard.com>\n\t<79c1e3e06c8d83f6dfab0140e3e0cd53ef6852bd.camel@ndufresne.ca>\n\t<167942067894.765114.11950367375347752265@Monstersaurus>\n\t<20230321175040.GA27203@pendragon.ideasonboard.com>\n\t<6284e4a2766f345500371b55936c242616989ed8.camel@ndufresne.ca>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tNicolas Dufresne <nicolas@ndufresne.ca>","Date":"Wed, 22 Mar 2023 16:05:19 +0000","Message-ID":"<167950111918.2462170.18029213641159333809@Monstersaurus>","User-Agent":"alot/0.10","Subject":"Re: [libcamera-devel] [RFC PATCH] libcamera: base: Make the\n\tregistration of log categories atomic","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>","From":"Kieran Bingham via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]