{"id":21747,"url":"https://patchwork.libcamera.org/api/covers/21747/?format=json","web_url":"https://patchwork.libcamera.org/cover/21747/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20241024081520.2912819-1-chenghaoyang@chromium.org>","date":"2024-10-24T08:13:52","name":"[v6,0/1] Add thread affinity","submitter":{"id":117,"url":"https://patchwork.libcamera.org/api/people/117/?format=json","name":"Cheng-Hao Yang","email":"chenghaoyang@chromium.org"},"mbox":"https://patchwork.libcamera.org/cover/21747/mbox/","series":[{"id":4740,"url":"https://patchwork.libcamera.org/api/series/4740/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4740","date":"2024-10-24T08:13:52","name":"Add thread affinity","version":6,"mbox":"https://patchwork.libcamera.org/series/4740/mbox/"}],"comments":"https://patchwork.libcamera.org/api/covers/21747/comments/","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 A3265C3213\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 24 Oct 2024 08:15:32 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B38D465393;\n\tThu, 24 Oct 2024 10:15:31 +0200 (CEST)","from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com\n\t[IPv6:2607:f8b0:4864:20::42e])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6D0C4603ED\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 24 Oct 2024 10:15:30 +0200 (CEST)","by mail-pf1-x42e.google.com with SMTP id\n\td2e1a72fcca58-71e49ad46b1so416834b3a.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 24 Oct 2024 01:15:30 -0700 (PDT)","from chenghaoyang-low.c.googlers.com.com\n\t(199.211.81.34.bc.googleusercontent.com. [34.81.211.199])\n\tby smtp.gmail.com with ESMTPSA id\n\t41be03b00d2f7-7eaeab1e5cdsm8068360a12.21.2024.10.24.01.15.24\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 24 Oct 2024 01:15:26 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"nUBGO80k\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=chromium.org; s=google; t=1729757728; x=1730362528;\n\tdarn=lists.libcamera.org; \n\th=content-transfer-encoding:mime-version:message-id:date:subject:cc\n\t:to:from:from:to:cc:subject:date:message-id:reply-to;\n\tbh=0Vdh0H1AgUVZ9RTj9IjLiZnF7khRl/nxpjpy8wpj/4c=;\n\tb=nUBGO80kXssJck2KcX2Vsf9JOs42BK9+T+HLmYKBmFttI88X43EcnI40i4d0Sg8XPJ\n\tHRPL1jPFucQXw7AVDEEHtB6kGBi2fRVHY/nbmtDoIu+FulIvzGqRXF2RR5nfi06wseuc\n\tCyXNiHui9f8KdYE0cwblXJN8F5YIaMxKQEs38=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1729757728; x=1730362528;\n\th=content-transfer-encoding:mime-version:message-id:date:subject:cc\n\t:to:from:x-gm-message-state:from:to:cc:subject:date:message-id\n\t:reply-to;\n\tbh=0Vdh0H1AgUVZ9RTj9IjLiZnF7khRl/nxpjpy8wpj/4c=;\n\tb=VkTa4iH6DGQIPlszkAW3RNMFj1Kzw0C7kn42qg+LjPG69wD4s/kz4GeLxdC4Vm5Yxk\n\tP0zRmzX0B99dxMrq8Y86wDu29y6gNJ3T9z6Op2P/SsrbzayXVUyjyGSiEBOj2BkwHpvM\n\t+Sonu+QLpKc0bzbKv4tOBzkx6EWTVwAFuOiV5+SGRHi/lDiPNC6FMLvLilrcQcO4lNtY\n\tgzT67JP71J5PdjuufoLpYFJPj6ybhhSjNMaf78vLXAapE0OSE91YNzG8EgaP3spwagYX\n\tCZoRX/+6iCVLJhfxrNlzriG+Y+dLZZ6Rao2ARsedXSXAzdPLS5GJUf1B1wfCmHmqkPin\n\tssKw==","X-Gm-Message-State":"AOJu0YzmNBZaWvoUJc44xQRqVV8wx88rFwId+Us4BpSdP3XvKuoNjDJQ\n\t31CZelI77w7zWBDDraxuVf52zAWf2koS7NwJMgs0GrOkFp+YGDedxqbY5LfECRx6EC547Dvr7DQ\n\t=","X-Google-Smtp-Source":"AGHT+IFZBOYAvQ8XYlUd8Otkg/4qv2G66Ew5917DlOTlujOl5TjeKEq8QAIyXgkhG4RwGhoKsGsZig==","X-Received":"by 2002:a05:6a00:1a93:b0:71e:7745:85b8 with SMTP id\n\td2e1a72fcca58-72045e257b6mr1228653b3a.1.1729757728233; \n\tThu, 24 Oct 2024 01:15:28 -0700 (PDT)","From":"Harvey Yang <chenghaoyang@chromium.org>","To":"libcamera-devel@lists.libcamera.org","Cc":"Harvey Yang <chenghaoyang@chromium.org>","Subject":"[PATCH v6 0/1] Add thread affinity","Date":"Thu, 24 Oct 2024 08:13:52 +0000","Message-ID":"<20241024081520.2912819-1-chenghaoyang@chromium.org>","X-Mailer":"git-send-email 2.47.0.163.g1226f6d8fa-goog","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Hi folks,\n\nThis patch adds a method to set thread affinity, which is needed to\nensure performance in mtkisp7 pipeline handler and IPA.\n\nThis passes gitlab pipeline:\nhttps://gitlab.freedesktop.org/chenghaoyang/libcamera/-/pipelines/1296466\n\nv6:\n- Set thread affinity before run(), if it was not started yet.\n\nv5:\n- Return failure if any index is invalid.\n- Drop the check of max size.\n\nv4:\n- Use `sizeof(data_->cpuset_.value())`.\n\nv3:\n- Keep the cpu indices in ThreadData.\n\nv2:\n- Check cpu indices within [0, `std::thread::hardware_concurrency()`).\n- Limit max size of cpus to be CPU_SETSIZE.\n\nBR,\nHarvey\n\nHan-Lin Chen (1):\n  libcamera: add method to set thread affinity\n\n include/libcamera/base/thread.h |  5 ++++\n src/libcamera/base/thread.cpp   | 47 +++++++++++++++++++++++++++++++++\n 2 files changed, 52 insertions(+)"}