Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1888324ybz; Thu, 30 Apr 2020 07:15:21 -0700 (PDT) X-Google-Smtp-Source: APiQypJFDe7zxcWPfPLstDnhcGADltVs0yoALNho5aSRrhqgWF2dD5shrcGIwP+xnyhLp7LAat8U X-Received: by 2002:a17:906:f90d:: with SMTP id lc13mr2704605ejb.367.1588256121420; Thu, 30 Apr 2020 07:15:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588256121; cv=none; d=google.com; s=arc-20160816; b=rxsGl9eoft+Cw5iHDeReq49h1lZDNPNYpA4hrbcHFo9Xuh+hgfMNxgB3hjJm58merg j2SKFJztDF3o05ZkHVJXKIfIQHMHn1HdyUVrCU0i9UWNj0jpRsoYWFE8jrB1OVtPC672 AcdivOJBySyQGwd4FuU9coihhYsUJ8C3G2nbaz5Ax/dUgGFynTNhtKvxb32i8K4Dp56k gPr0RVX/Ur3OXL1bqso3RPTQea+GoDKGA1DM6AIU1h0H30j6Ggc00BAb1aiwzvLqUWC1 NRTPsuLXPJQbOm+95bBA2M8jmnpLDj5uxQY8/StunalYdy2B9401WeeToW1yeFUsWBg2 2tFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:references:cc:to:from:subject:dkim-signature; bh=OnNu0d4kBuNgtMDcTSpGxIZJGwHHHkKLCR/X38FoToI=; b=Vw6RHF0hV55FdKFkKQ76NFTj2lwQhzAfbPieU+Swe5zSNHw21NtN0XnuTWCRfesU+s +vy8V0ACuQON4GDM7yBBxFhlZ6pyXlz6d/71MIpp1BfMGLAkzruwqsPkrqFsATO8hU7k vvh3m+FEeUojzvUOawGjrXv1bKM2N2w0KKKMXYSNGnJXURGBGrs6UEbVG5SpsQminRab Y4EwrTSs0nxTmAvf9r/rzAY2ybGv56whO2MnYnxaIs3qD3gMWcCPmxqIjwMg0h3xoUrn 1p0nZHxNZzbJgqu2IwSdV9xZIYAVy9cGZ7/+PuitoyaeAEFPUhAvpMiScrkZy5hfbsAf yLCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=E47cdC2L; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v25si6000381ejx.386.2020.04.30.07.14.58; Thu, 30 Apr 2020 07:15:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=E47cdC2L; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726866AbgD3ONm (ORCPT + 99 others); Thu, 30 Apr 2020 10:13:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726481AbgD3ONl (ORCPT ); Thu, 30 Apr 2020 10:13:41 -0400 Received: from mail-lf1-x141.google.com (mail-lf1-x141.google.com [IPv6:2a00:1450:4864:20::141]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2F81C035494; Thu, 30 Apr 2020 07:13:40 -0700 (PDT) Received: by mail-lf1-x141.google.com with SMTP id t11so1344693lfe.4; Thu, 30 Apr 2020 07:13:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:from:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=OnNu0d4kBuNgtMDcTSpGxIZJGwHHHkKLCR/X38FoToI=; b=E47cdC2LjQCfk4jercI9wU26vj6Ul3VxmudH5l5SAv6doIVinVVxuJeQBKaerKo/mS zM2+xfjOVb6S3A6nWai/F/Yb5JRJUZzCqWuD1F+oqKHVGIOJG4dr7UCE+NKygEug54wY Z6+kf82RB/TtCjzaounEBhPWA689NeR6/g6rKvWxGbF8w/q/PjnaGHjf1tuVQZS3L/si 5b6tntpaSKhoW0GYVkfNtJ6YN344tOm2WXpRq43XeaQ4XfJJhJTE7VlWYzYMX7LpohwM RPsBwCHcBXXy7tVqT51Xj6B4a0QZ68JFYfTb/9PrkO8ChU5bSBED3pcMAsU3heEF+fHV kj7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=OnNu0d4kBuNgtMDcTSpGxIZJGwHHHkKLCR/X38FoToI=; b=roi0B06KIK+PmGkECF0c4R0EoEYVlal9EYwSF+fyK+p4EKSvwXsxsov9WnrkNe7kuc odYhVUCuegJIInHc/+8aPLi6YEaD3dWXRVKhSp22TF214vRgIvhpAWzuYe+G9OeMUhkQ 0SJVwSHBHh476fRhTm3xjzQeHSLfrOKBN0PB5wv14Ots8wdvFWh9Q1BbdpNxYK+9UuX7 klXEX98WGKho2VeyJkrJjTbZAfOA77gBrp2+i/j0O+b/qu+NISyrQwecL8miNqOlNcL4 B+8UNySu0w8lRgdeSilneT2Q0pSJK+UYTVVxseYhldCCI2zXvK5lUyTmWRy3wdGVObBF Bjcw== X-Gm-Message-State: AGi0PuZrKiIarkFqpyD/9aM744O6ZI1t/4Ka+s4zH9xkmYT3Az2B23CL 6fJZ5J9jbPy0j6boY6lkyYbcRpn2 X-Received: by 2002:ac2:530e:: with SMTP id c14mr2387989lfh.154.1588256019126; Thu, 30 Apr 2020 07:13:39 -0700 (PDT) Received: from [192.168.2.145] (ppp91-78-208-152.pppoe.mtu-net.ru. [91.78.208.152]) by smtp.googlemail.com with ESMTPSA id q16sm4296014ljj.23.2020.04.30.07.13.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 30 Apr 2020 07:13:38 -0700 (PDT) Subject: Re: [RFC PATCH v11 6/9] media: tegra: Add Tegra210 Video input driver From: Dmitry Osipenko To: Sowjanya Komatineni , thierry.reding@gmail.com, jonathanh@nvidia.com, frankc@nvidia.com, hverkuil@xs4all.nl, sakari.ailus@iki.fi, helen.koike@collabora.com Cc: sboyd@kernel.org, linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-clk@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org References: <1588197606-32124-1-git-send-email-skomatineni@nvidia.com> <1588197606-32124-7-git-send-email-skomatineni@nvidia.com> <4da289e6-036f-853b-beb4-379d6462adb0@gmail.com> Message-ID: Date: Thu, 30 Apr 2020 17:13:37 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <4da289e6-036f-853b-beb4-379d6462adb0@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 30.04.2020 17:02, Dmitry Osipenko пишет: > 30.04.2020 16:56, Dmitry Osipenko пишет: >> 30.04.2020 01:00, Sowjanya Komatineni пишет: >>> +static int chan_capture_kthread_finish(void *data) >>> +{ >>> + struct tegra_vi_channel *chan = data; >>> + struct tegra_channel_buffer *buf; >>> + >>> + set_freezable(); >>> + >>> + while (1) { >>> + try_to_freeze(); >> >> I guess it won't be great to freeze in the middle of a capture process, so: >> if (list_empty(&chan->done)) >> try_to_freeze(); > > And here should be some locking protection in order not race with the > chan_capture_kthread_start because kthread_finish could freeze before > kthread_start. Or maybe both start / finish threads should simply be allowed to freeze only when both capture and done lists are empty. if (list_empty(&chan->capture) && list_empty(&chan->done)) try_to_freeze();