Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp6486328ybv; Wed, 12 Feb 2020 13:14:08 -0800 (PST) X-Google-Smtp-Source: APXvYqxR2WYi7RWCcPpC88QvooAgaHKbXVEu8m7GTUCqXE0DZapAQtIqBoGb3pjPxfYue8kKP6MF X-Received: by 2002:a05:6808:a8e:: with SMTP id q14mr682487oij.173.1581542048030; Wed, 12 Feb 2020 13:14:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581542048; cv=none; d=google.com; s=arc-20160816; b=h39iWLXjSuRCuJpuwfGQrAm2Qmb3u+TB5MfLCJbg3ocPNMxJ2elWQHxGtmQZhf2rkK uxXvUx0cxOm6QblGZiThRQ2zdIuCbMtbYCYaBdCtgTZ7wfff2/1ykzR53XMv1ux7v9UK jLhuULO2tpSN11XCgRVJsJ2KhUQxSbQfzgSVpk7n33SzQizHSOaB6rq0oohhQ0QZjPfh lbpb4XJhuCayvuEC4Xw/V1NDtZ9SpkODcrRzpHKKPcPNGPCe2GSFgX1HUx4TI8dgth+j zDjq/bzDtGIV5vPsExMnONyLn6rppyZcseaIqKjz58K6hFaATjS1IUB4jtab+Re5ThxP HzYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=vWuQOjmWWm9mVDQNozhK4CBtfnBP1vDxNbNvUPMK76k=; b=WUV3FdyU3Vkg8N0P19EGfQFVstDDGNAFI3CcGiaGhh7H9UUNmrPLYajv46nYxEM/UJ yB5SX/XzWt+aK8Uw8pkzN3KU0J8+u1/bw8wO5ueOxfzKYonfq5bZkpb0LX6ycoG+gYLL pFHHLcOcfGRy3gs2mHkblD5oyv7WSJWswroEkcyCSpgj84CwMPxTjom/OeJbVB9uDthW 7mdRGhONSGv5IwgY1GKRWK2IfYeD9bHs9zKeu/BTgd8fIUTdiBtr7Bjlm0qCRL9ssXDl CSsDQzNQSyR4DtUR4E96BbroLulG2kHWyCoiTjcX3dqKPCtvsXpwsxpOhl8YLQhMrGtc 25IQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e7si880146oti.301.2020.02.12.13.13.55; Wed, 12 Feb 2020 13:14:08 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729125AbgBLVNZ (ORCPT + 99 others); Wed, 12 Feb 2020 16:13:25 -0500 Received: from mga05.intel.com ([192.55.52.43]:60665 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727420AbgBLVNZ (ORCPT ); Wed, 12 Feb 2020 16:13:25 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Feb 2020 13:13:25 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,434,1574150400"; d="scan'208";a="432449589" Received: from wendeand-mobl.ger.corp.intel.com (HELO kekkonen.fi.intel.com) ([10.252.52.16]) by fmsmga005.fm.intel.com with ESMTP; 12 Feb 2020 13:13:20 -0800 Received: by kekkonen.fi.intel.com (Postfix, from userid 1000) id 0320921D13; Wed, 12 Feb 2020 23:13:17 +0200 (EET) Date: Wed, 12 Feb 2020 23:13:17 +0200 From: Sakari Ailus To: Dafna Hirschfeld Cc: Helen Koike , linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org, eddie.cai.linux@gmail.com, mchehab@kernel.org, heiko@sntech.de, jacob2.chen@rock-chips.com, jeffy.chen@rock-chips.com, zyc@rock-chips.com, linux-kernel@vger.kernel.org, tfiga@chromium.org, hans.verkuil@cisco.com, laurent.pinchart@ideasonboard.com, kernel@collabora.com, ezequiel@collabora.com, linux-media@vger.kernel.org, linux-arm-kernel@lists.infradead.org, zhengsq@rock-chips.com, Jacob Chen , Allon Huang , Dafna Hirschfeld Subject: Re: [PATCH v8 05/14] media: rkisp1: add Rockchip ISP1 subdev driver Message-ID: <20200212211317.GD3087@kekkonen.localdomain> References: <20190730184256.30338-1-helen.koike@collabora.com> <20190730184256.30338-6-helen.koike@collabora.com> <20190808091406.GQ21370@paasikivi.fi.intel.com> <20190815082422.GM6133@paasikivi.fi.intel.com> <20190815131748.GS6133@paasikivi.fi.intel.com> <78856358-1afd-31a7-86dd-22f7d6d7fb05@collabora.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <78856358-1afd-31a7-86dd-22f7d6d7fb05@collabora.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Dafna, Apologies for the late reply. I learned the mail had got lost due to mail server issues. On Fri, Jan 31, 2020 at 08:38:34PM +0100, Dafna Hirschfeld wrote: > Hi, > I (Dafna Hirschfeld) will work in following months with Helen Koike to fix the issues > in the TODO file of this driver: drivers/staging/media/rkisp1/TODO > > On 15.08.19 15:17, Sakari Ailus wrote: > > On Thu, Aug 15, 2019 at 11:24:22AM +0300, Sakari Ailus wrote: > > > Hi Helen, > > > > > > On Wed, Aug 14, 2019 at 09:58:05PM -0300, Helen Koike wrote: > > > > > > ... > > > > > > > > > +static int rkisp1_isp_sd_set_fmt(struct v4l2_subdev *sd, > > > > > > + struct v4l2_subdev_pad_config *cfg, > > > > > > + struct v4l2_subdev_format *fmt) > > > > > > +{ > > > > > > + struct rkisp1_device *isp_dev = sd_to_isp_dev(sd); > > > > > > + struct rkisp1_isp_subdev *isp_sd = &isp_dev->isp_sdev; > > > > > > + struct v4l2_mbus_framefmt *mf = &fmt->format; > > > > > > + > > > > > > > > > > Note that for sub-device nodes, the driver is itself responsible for > > > > > serialising the access to its data structures. > > > > > > > > But looking at subdev_do_ioctl_lock(), it seems that it serializes the > > > > ioctl calls for subdevs, no? Or I'm misunderstanding something (which is > > > > most probably) ? > > > > > > Good question. I had missed this change --- subdev_do_ioctl_lock() is > > > relatively new. But setting that lock is still not possible as the struct > > 'the struct' - do you mean the 'vdev' struct allocated in > 'v4l2_device_register_subdev_nodes' ? Yes. > > > > is allocated in the framework and the device is registered before the > > > > driver gets hold of it. It's a good idea to provide the same serialisation > > > for subdevs as well. > > > > > > I'll get back to this later. > > > > The main reason is actually that these ops are also called through the > > sub-device kAPI, not only through the uAPI, and the locks are only taken > > through the calls via uAPI. > > actually it seems that although 'subdev_do_ioctl_lock' exit, I wonder if > any subdevice uses that vdev->lock in subdev_do_ioctl_lock. > It is not initialized in v4l2_device_register_subdev_nodes where the vdev is allocated > and I wonder if any subdevice actually initialize it somewhere else. For example it is null in this > driver and in vimc. It needs to be set before the video device is registered, so indeed, it seems no driver can make use it. > > > > > So adding the locks to uAPI calls alone would not address the issue. > > What I can do is add a mutex to every struct of a subdevice and lock it > at the beginning of each subdevice operation. > Is this an acceptable solution? Please do. That's what other drivers do at the moment as well. -- Kind regards, Sakari Ailus