From patchwork Fri Jun 26 08:51:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dafna Hirschfeld X-Patchwork-Id: 11627209 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 30287912 for ; Fri, 26 Jun 2020 11:19:39 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 08E3420C09 for ; Fri, 26 Jun 2020 11:19:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Kq6DZhGe" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 08E3420C09 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=collabora.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Owner; bh=jgI5HsTJRvyccJ4Ugg+6XO9pLWnrn5kXdFDq57IPo/w=; b=Kq6DZhGep2Hb+vCgIkvYKDob+z MIrt9Hfth88j0ZP79TI0quf4smyxh59ryhdzVUBFOwsUkkTWowLPZxHVcv1GVzH2Ryq+qqwti/HQL IlJbmXWJzpsjrrQJ8YmQY7N+/vZc9GuxBeFCcxc4knnOGkaTFsDmMsfp+y0E+kQN/luP/NMvbRcs4 nHLMWFqRHXNbUwIR47SB8oyQFI1VCnhagYg89SQEDpt3aPCTH4JkogW+LA0CLM7FMADzKBa+xdHug 80UN9OyBpr5ZDqXFk0GJIGjM1wj6EZp6xlfXeNz0qvBwOyA6hEu7eIsf4L4CtB+3XunWNSEY1S9az CRQdWszw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jomOO-000873-9O; Fri, 26 Jun 2020 11:19:36 +0000 Received: from bhuna.collabora.co.uk ([46.235.227.227]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jomOF-00082s-99 for linux-rockchip@lists.infradead.org; Fri, 26 Jun 2020 11:19:34 +0000 Received: from localhost.localdomain (p200300cb8737cf00e1b48557745ca459.dip0.t-ipconnect.de [IPv6:2003:cb:8737:cf00:e1b4:8557:745c:a459]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: dafna) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id 2B0012A5988; Fri, 26 Jun 2020 09:51:49 +0100 (BST) From: Dafna Hirschfeld To: linux-media@vger.kernel.org, laurent.pinchart@ideasonboard.com Subject: [PATCH v2 0/4] media: staging: rkisp1: move stats reading to irq handler Date: Fri, 26 Jun 2020 10:51:37 +0200 Message-Id: <20200626085141.7646-1-dafna.hirschfeld@collabora.com> X-Mailer: git-send-email 2.17.1 X-Spam-Note: CRM114 invocation failed X-Spam-Score: -0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [46.235.227.227 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mchehab@kernel.org, dafna.hirschfeld@collabora.com, dafna3@gmail.com, tfiga@chromium.org, hverkuil@xs4all.nl, linux-rockchip@lists.infradead.org, helen.koike@collabora.com, sakari.ailus@linux.intel.com, kernel@collabora.com, ezequiel@collabora.com MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org Currently reading the stats is done with workqueue. We decided to move the reading of the stats to the hard irq handler since it seems and also tested to be fast enough. The patchset was tested on a Scarlet device with chromeos and also with the 'cam' command from libcamera in rockpi4 board. This fixes the TODO item: 'Use threaded interrupt for rkisp1_stats_isr(), remove work queue.' Patchset Summary: 1. Replace a long bitwise-or of the statistics flags with a macro to improve readability 2. In the 'stop_streaming' callback, replace the usage of 'spin_lock_irqsave' with 'spin_lock_irq' 3. Replace two locks in the rkisp1_stats object with one lock that protects the 'is_streaming' variable and the 'stat' list of buffers. 4. Move the reading of the stats to the hard irq handler. Changes since v1: - patch 1 from v1 "return IRQ_NONE in isr when irq isn't for ISP" is not needed anymore for this version, it can be sent as a separate patch. - patch 3 from v1 "stats: use spin_lock_irqsave for irq_lock" is not needed, since it is enough to use 'spin_lock' in a isr. Instead, patch 2 in this version is added that replaces 'spin_lock_irqsave' with 'spin_lock_irq' in user context callback. - the last patch in this version moves the stats reading to the hard irq while in v1 it was move to threaded irq. - removing the item 'Use threaded interrupt for rkisp1_stats_isr(), remove work queue.' from the TODO file. Dafna Hirschfeld (4): media: staging: rkisp1: use a macro for the statistics flags mask media: staging: rkisp1: stats: replace spin_lock_irqsave with spin_lock_irq media: staging: rkisp1: stats: replace locks wq_lock, irq_lock with one lock media: staging: rkisp1: stats: read the stats in the isr drivers/staging/media/rkisp1/TODO | 1 - drivers/staging/media/rkisp1/rkisp1-common.h | 12 +- drivers/staging/media/rkisp1/rkisp1-isp.c | 5 +- drivers/staging/media/rkisp1/rkisp1-stats.c | 117 +++---------------- 4 files changed, 23 insertions(+), 112 deletions(-)