From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 07F17C433FE for ; Tue, 11 Jan 2022 16:39:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Content-ID:In-Reply-To: References:Message-ID:Date:Subject:To:From:Reply-To:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=+vd8SZlqWpD7DrY4nPOwPKnYQjovKNhgQB6YmL1r/Cs=; b=3DSZ1eafeAOWvz 6gqmnM0T0guKeZXPkdgauIGLGWa4mL2+j2aChknZcIYdaba5CdVMkLO1pX9fbqqVFvQpxOXNEwrwW Pyqz/6SoZnjC6ayIJAw3/Nc5i7gQNeL1p96LkgPYnixURPx4tNz99Q7Wcve/0Rh2+/gyssnh9Kpn9 qKrTJkS6fVmA4/Eq5WDcGmDCx9wvyv33IR4vEjzsmncp/G4eSIT7YzAXsbplDEzJkP/maPjA9HyfJ ScJCcIK0eCk/62fnP+jlpMQc/gEHkhfUO2vj0h4G3iKD/WN+76Oomjak9FIB0KnqrEQaCZa/56mAh JyKYp9hvauOZuyn1JfcQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n7KAD-00Gvpj-45; Tue, 11 Jan 2022 16:38:25 +0000 Received: from esa.microchip.iphmx.com ([68.232.154.123]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n7KA9-00Gvp2-Mx for linux-arm-kernel@lists.infradead.org; Tue, 11 Jan 2022 16:38:23 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1641919101; x=1673455101; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-id:content-transfer-encoding: mime-version; bh=KwimgrXx+RKwS9lvpZ8cM3rSWXcTXgnH+Y8YrFkcKzs=; b=Y5nsOUhXJCyjQnYTnIvYlBcs3h3ptFJanVYpGNNzqMdAFIU6QparYuPF DOu8vfmXN10f1n7q9wQv7ud45Pt6nDFyDFnYNlPTdv0tPSvP7TrGN64zW sHekzi0C57QhLJX8OcQ3nO3vVrD7rf+UV9Apg9AyHzNgKGd3WZPE9akic HuILLMd/Po5qs16z92/UbLShua4q0oeaWpG5TI16iuDI7bUJydaOHybsh PYr4BFQIebY7zCyR7vQdcprMFMJgA0OZDKG6CK3OX70CERT/t1Mly4166 rEdOMcg5qY+ubOA6tD9Ew5p1xyX9w0LbNm3ZAl5ps67US0fk27IZ8JMLZ Q==; IronPort-SDR: RYHpD0fxFfeEDtFBRIFj4esv9ZY20gTIYmDG9gtLL2CnL3j2Pu0M00CbuyD3RFQGkmemTHr9ud EBvTxE1jX4sj26RJb1ffS1BwfqfDFrGs+PEE+2adCW1zTOphM32kMnhKWOs66ePy0PRvR1uqge QoBRFpBmEmdvy0MECpOrVusZxibW8x9LVHTa+ElpVNVKYpIa6qqbiyUcmf/zwD7jqV5qoYc6TY 3bfX5Tq/poEwPP4oGNT3sq8s1K5fQLzykjC+34rzftskAZHTai/MUzvmyr1bxmvp0uK5Gq1HwA r7v8EZ8mAZMbXjwFapKwY69B X-IronPort-AV: E=Sophos;i="5.88,279,1635231600"; d="scan'208";a="82143527" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa6.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 11 Jan 2022 09:38:20 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Tue, 11 Jan 2022 09:38:20 -0700 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.87.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17 via Frontend Transport; Tue, 11 Jan 2022 09:38:19 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EYnFDKQ/XE1t9tByd4upi9pXeCBOg+nyRSmLPz4JuxL+6Yk4fqPo0bLiUH4iF1XTImmCSBSry0fIvZv3R6b15XBfUhvsDkSqfH+11Bpz1R4knXHlHDM9042AqV38LblMO8h01ozQtBg+ANSUvUXQ7qPYS0hmfBmXGJCCwepAu7EBaNsgcpGpWRatKhz0KZa2x+tBKTsWenHwz2ojxcB6CiHkr4sQ7LDf4K4Dro9BClv98gBLtae/maHhysH3iXU+jmbBwdmklAQOHv7ta9avlrvb1Q79USBzgm1b5vuv1BY5lHG0K8c/rna8RoMoLtE6cFPBXiLlo0gUe6ZiAtXrPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=KwimgrXx+RKwS9lvpZ8cM3rSWXcTXgnH+Y8YrFkcKzs=; b=gFRiICw7FOGWfHIAPi4vTJlMqLra0xzDVXPZrH1udtdK5ongDRbprXEqZn7Lt6j7pZe+3nZGeabgcWlUlhNi4KOzl4RHV9k7of0eVuy3ixc84/A8GxRp7BwihXuLhGAoijGqbfj2as0bE7RVsrCs2RotgHDKnS45zUrFVGDEwPOk8igbYkDfAmENukyTubjY6PN7cURcn7KW2YADIHMN41B1huiyQj834PYop+O6J7R29keJ0fmJMKS4j1ARB3/RutzSSxToy2/Uw8NFyncs1LnVRjISdNFoWyf+4w0Amx58MretMeT3OeTnX4ACC2COieAXerP6pHehtI6gcyO4+g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microchip.com; dmarc=pass action=none header.from=microchip.com; dkim=pass header.d=microchip.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector2-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=KwimgrXx+RKwS9lvpZ8cM3rSWXcTXgnH+Y8YrFkcKzs=; b=F0cu5AN5MvX2xz13V6qimfLCIDHFrwd7UIKsCyG7zlRYe73i8G8GbAq7c+KP2lxhhHaf3ZoOCvsUMG68ApqJW+tzOY44n5kmM8CVO9umUt25ViKfEhm8mdvzkQdYeEd+yL5ofmUN9jszS5bSxhNhxWXugWf6uc7ht+atoCnTW1U= Received: from PH0PR11MB4920.namprd11.prod.outlook.com (2603:10b6:510:41::22) by MWHPR11MB1485.namprd11.prod.outlook.com (2603:10b6:301:d::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4867.11; Tue, 11 Jan 2022 16:38:17 +0000 Received: from PH0PR11MB4920.namprd11.prod.outlook.com ([fe80::d7c:834f:4591:3c0c]) by PH0PR11MB4920.namprd11.prod.outlook.com ([fe80::d7c:834f:4591:3c0c%8]) with mapi id 15.20.4888.009; Tue, 11 Jan 2022 16:38:17 +0000 From: To: , , Subject: Re: [PATCH v3 07/23] media: atmel: atmel-isc-base: use streaming status when queueing buffers Thread-Topic: [PATCH v3 07/23] media: atmel: atmel-isc-base: use streaming status when queueing buffers Thread-Index: AQHX8CiVdfXd9oS6LEuz0qJiSrlq1axeJnwAgAAMcQA= Date: Tue, 11 Jan 2022 16:38:16 +0000 Message-ID: <5e4f591b-9105-9de0-5067-2bd82dc04983@microchip.com> References: <20211213134940.324266-1-eugen.hristev@microchip.com> <20211213134940.324266-8-eugen.hristev@microchip.com> In-Reply-To: Accept-Language: en-US, ro-RO Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: user-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=microchip.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 4dcec08e-96ce-401a-706c-08d9d520c506 x-ms-traffictypediagnostic: MWHPR11MB1485:EE_ x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2958; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: tynuaR/NIHvTmSA2RDlAb6lKgbuDLeFzs0lSoVNn6QneVvPUp3qXBF+HVS9AzyNFnPPDL0I2BVEj1f3okhshLBNkcxV0BW9pWLtELqQkQhpPGPw8rPbtaXHQcQauvx5bJUnwJqYxwiDfPY/1x2JAzgtAxto9/zO96GViUUkiRb9jWIWgByAyqd67VTgMJX9iWVUT3s6p27HUzZDFx7QDUFJzZc69EFgn99nZOu58Gg8pVJy8AkErZwumbee0jN9b3/CRjdQqMw+9s9rcbTXk7DPNAz5KMCNJoiEVzRnFH3ZLwLL/2DE4e5L/XSK5kc4r7iThkJ+tM3D2Jmd7EaRsChoujOFaf5SMSxXfwhLDOCvRlEgIAS4XPj7djSZsFJ5CqYxiRLKcfA+IH4luialuk1In1Acn+pEadG2dxeIUBar+WnAEuy9B5pi0rEfIahExDolxpgqbaDfnWTgjr3zoTggF4aX+OyEPORiMknfEbgg6ZlswBhYhqQiVgCMrCAXskNlMQUypm72tow4mz3U/74u5XVvGzrtdkv/S3zRji8FcEO9id6ya9P/Jd3lbnQuocGMIZHzEZFVayIm0MjJgkXnL+iBjppfEFxCiC7Xw+lZPkuAyxJY+g02AI4rf5zNII4z3bX3SIzhci3MF441sraUCjw+YadiAB8el2UQpXN68vm2tvNiO39vdgaoSNwwgf/uSQlDrEjr/38ujrxzoqUFU75Mi9zds2gKEc0hG08Y//gVZQEZx0fS6rxhUDaPlwz38I4JeKcTbJCzC3HqJ2Q== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH0PR11MB4920.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(38100700002)(54906003)(66946007)(8676002)(508600001)(71200400001)(66556008)(38070700005)(2616005)(6486002)(53546011)(26005)(36756003)(186003)(91956017)(4326008)(76116006)(64756008)(5660300002)(6506007)(66446008)(31696002)(316002)(31686004)(6512007)(122000001)(83380400001)(86362001)(8936002)(2906002)(107886003)(110136005)(66476007)(45980500001)(43740500002); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?B?dGtwM0gzZlFxWTQ5VzFnZFViQUp0dmphdWxPOW96KzVYOVE4czVDcDl5SFNm?= =?utf-8?B?UG4zcmh1cWwySDg4WGcwTWtHMlIxUDFYdzVIOUR5UlJyMVR0a0FzTXNJZFZF?= =?utf-8?B?QkZuRzg4amxmcE1tcWRtTWRkb2pocjUzK2hqMGFPendsUnQ4YmdjSTA5TFhw?= =?utf-8?B?a0g0SGZnaWcrb3VvcVdPb3EwZzVVSUVJSHlXUHBhUkVUU3RPeVN5YnpYSlNk?= =?utf-8?B?L3lGbnI0eXhOdVAxWjhQYWZLU1p4aFVTakxsZ3F3ejJnaFhxTGNJUTNua3lo?= =?utf-8?B?MXJDdkVBaGZ5T1o5MUw0YVYzTGpXYnpTRDlYenMvK2pxS2RORkd5cXE4bFhi?=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bU9LRE5HSEpLQkdVYWFMSmNYTTZUWkU1cDdTM2pVa081Q0J1?= =?utf-8?B?SXFSUUhXSXh2U1l6SEY3RTRSemVEemNqQmtvbmxYSDFxdTJWQ3RrMFVLcmxq?= =?utf-8?B?ZmZTTlkxU2VCbXZyOGg3TlErZ2h3PT0=?= Content-ID: MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB4920.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4dcec08e-96ce-401a-706c-08d9d520c506 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Jan 2022 16:38:16.9433 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: Xb3uQgZqgX9pT3QodBtPMlpPJDHP325B9YmrlX7jfP6uPWQ1F0ave7xCRG2GAkv+q0PiJl8ouHW8VibdfAendCqhVVMZlL5fovpKW+x2LeA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR11MB1485 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220111_083821_869440_794342C0 X-CRM114-Status: GOOD ( 33.30 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, robh+dt@kernel.org, sakari.ailus@iki.fi, linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 1/11/22 5:53 PM, Hans Verkuil wrote: > On 13/12/2021 14:49, Eugen Hristev wrote: >> During experiments with libcamera, it looks like vb2_is_streaming returns >> true before our start streaming is called. >> Order of operations is streamon -> queue -> start_streaming >> ISC would have started the DMA immediately when a buffer is being added >> to the vbqueue if the queue is streaming. >> It is more safe to start the DMA after the start streaming of the driver is >> called. >> Thus, even if vb2queue is streaming, add the buffer to the dma queue of the >> driver instead of actually starting the DMA process, if the start streaming >> has not been called yet. >> >> Signed-off-by: Eugen Hristev >> --- >> drivers/media/platform/atmel/atmel-isc-base.c | 17 ++++++++++------- >> 1 file changed, 10 insertions(+), 7 deletions(-) >> >> diff --git a/drivers/media/platform/atmel/atmel-isc-base.c b/drivers/media/platform/atmel/atmel-isc-base.c >> index 26a6090f056c..e6c9071c04f0 100644 >> --- a/drivers/media/platform/atmel/atmel-isc-base.c >> +++ b/drivers/media/platform/atmel/atmel-isc-base.c >> @@ -441,12 +441,14 @@ static void isc_buffer_queue(struct vb2_buffer *vb) >> unsigned long flags; >> >> spin_lock_irqsave(&isc->dma_queue_lock, flags); >> - if (!isc->cur_frm && list_empty(&isc->dma_queue) && >> - vb2_is_streaming(vb->vb2_queue)) { >> + >> + if (!isc->cur_frm && list_empty(&isc->dma_queue) && !isc->stop) { >> isc->cur_frm = buf; >> isc_start_dma(isc); >> - } else >> + } else { >> list_add_tail(&buf->list, &isc->dma_queue); >> + } >> + >> spin_unlock_irqrestore(&isc->dma_queue_lock, flags); >> } > > Both the old and new code doesn't make a lot of sense. Hello Hans, I debated this a bit with Laurent when I initially wrote the patch. The problem with the current code, or the current way things are working, is the fact that vb2_is_streaming returns true from the moment of streamon. The DMA engine of the ISC is being started at the moment of start_streaming, and if buffers are being sent earlier/later, they are just added to the queue and DMA engine is restarted if it finished previously. However if frames are added beforehand, like, first streamon, then add some frames, and then later call the start_streaming, ISC will crash. (as I said, DMA engine is prepared at start_streaming). To avoid this, I changed the vb2_is_streaming calls to keeping an internal state of the streaming. Do you think I should try another different approach to solve this ? Perhaps do not prepare the ISC dma engine at start_streaming, but at another place ? Laurent do you remember the talk we had about this problem a while back ? > > buf_queue is only called by vb2 if start_streaming has already been called or is > about to be called. That's a huge difference for ISC driver as it is today. start_streaming being called afterwards, means the ISC DMA engine is not started (not started streaming), hence a crash. > > Typically all that the buf_queue op does is to call list_add_tail(&buf->list, &isc->dma_queue); > inside the spinlock. > >> >> @@ -1014,7 +1016,7 @@ static int isc_s_fmt_vid_cap(struct file *file, void *priv, >> { >> struct isc_device *isc = video_drvdata(file); >> >> - if (vb2_is_streaming(&isc->vb2_vidq)) >> + if (!isc->stop) > > This is weird as well. Normally this calls vb2_is_busy to check if the > queue is busy (that really means that buffers are already allocated, so > changing the format isn't allowed anymore). You think the query to the streaming status makes no sense here hence it should be removed completely ? I can do that with a prequel patch if it's the case. Thanks for reviewing, Eugen > >> return -EBUSY; >> >> return isc_set_fmt(isc, f); >> @@ -1536,7 +1538,7 @@ static int isc_s_awb_ctrl(struct v4l2_ctrl *ctrl) >> >> isc_update_awb_ctrls(isc); >> >> - if (vb2_is_streaming(&isc->vb2_vidq)) { >> + if (!isc->stop) { > > Ditto. > >> /* >> * If we are streaming, we can update profile to >> * have the new settings in place. >> @@ -1552,8 +1554,7 @@ static int isc_s_awb_ctrl(struct v4l2_ctrl *ctrl) >> } >> >> /* if we have autowhitebalance on, start histogram procedure */ >> - if (ctrls->awb == ISC_WB_AUTO && >> - vb2_is_streaming(&isc->vb2_vidq) && >> + if (ctrls->awb == ISC_WB_AUTO && !isc->stop && >> ISC_IS_FORMAT_RAW(isc->config.sd_format->mbus_code)) >> isc_set_histogram(isc, true); >> >> @@ -1829,6 +1830,8 @@ static int isc_async_complete(struct v4l2_async_notifier *notifier) >> struct vb2_queue *q = &isc->vb2_vidq; >> int ret = 0; >> >> + isc->stop = true; >> + > > I'm really not sure that you need the stop bool at all. > >> INIT_WORK(&isc->awb_work, isc_awb_work); >> >> ret = v4l2_device_register_subdev_nodes(&isc->v4l2_dev); > > Regards, > > Hans > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel