Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1522095lqa; Mon, 29 Apr 2024 10:45:27 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW/xM85O/+HOtJxpXp14n1AS0clHgkqcxD4DNXoFBUumqVKekoJGt2c4yvfJ6JDkvdI/zinT3YLJ44/F1eQjbRUuljX9Y1RWpE2B4qGSw== X-Google-Smtp-Source: AGHT+IFrMp/6oxIsNNqWNG8XMUGYOP9VLU+Wj4sOA1MNMFNOvg78YIRjRpICssJRG6kJP2jM8tko X-Received: by 2002:a05:6358:441f:b0:186:e49:2f21 with SMTP id z31-20020a056358441f00b001860e492f21mr8430041rwc.20.1714412726900; Mon, 29 Apr 2024 10:45:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714412726; cv=pass; d=google.com; s=arc-20160816; b=khy3Ugqq5CUefQYD0KoBE/xvFfbOFyGLyFHzMsSKwoHS+7YtulI4T5kUgpjfbkX+E3 2rPRT3StiBzi+n0yjmdfifVDpL2vCjN3NQRo5EQ0Wls4gdqoITKIfhA8osKvWRUaJEck dDVBAZuDM1nCkrNJIdDMFp7BWKUG5zSe5ZL6azK4+9lk99SXQLAfN+EASPTWnTHZnipX 9ham50j6ufXjyrK5iToD+wzGdbElaUGSrjWTM3hg9xm3SuKoYUwS22J0KrRVMJhNQtDZ 4DMIFsIQ6UigisWkx+vDzwxl3MPd/Zti6N8OYC0PvnsCSIelXU4KuND2YTteTf1NlCSX nEJA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=tdL+L0Iwwa6dw31Fbr9zatWqYOZp7jArBGEWfn0vdmI=; fh=1smA/0wpemJPuIFHFh0Yd5VM2+KjdUa5afV4ak7PwAs=; b=vec/V19apHlg8Nu4fNwZjk+RsEUdp2lNsYOm8wPQa3oW0Giczrb7YzF1aQtd9PuWke 2HU2O962vhasMd49/SW+XZUaITY42lYukA42FYaXKeErUvlprEIHJ1WPZpbo/Z1v/EJu 0ucxdkwbkv/n5j1nD3QexIthDxNPOL1ZPOWos02hX/4SO/0smYmg2ger7QI0CvYfQChZ /yEIoMB4SC6fntjwHmk+hIr4zasyOQvSeTJ7rJTQHOG9sp/zzLDfT5XmscYMHs9Y+j91 5Yn1l3qVgp3pDj8RhtjoykbFqdy9ZtTnfJuTOHjoNAMG2ly+fTGAZvpEssMJsXx8OJ2O fNaQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=Q+TQ62Oy; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-162774-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162774-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id y65-20020a638a44000000b00608f6a6984esi8635386pgd.189.2024.04.29.10.45.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 10:45:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-162774-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=Q+TQ62Oy; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-162774-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162774-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id BC5A7B20BE6 for ; Mon, 29 Apr 2024 17:45:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 59296127E17; Mon, 29 Apr 2024 17:45:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="Q+TQ62Oy" Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 087F01272CA; Mon, 29 Apr 2024 17:45:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.227.194 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714412705; cv=none; b=pHChRT+W3krkTbqJ5hu0ZL4buEc2AROK3Em2U1/mjE3OrGW6yF41J+2bonI0EhULDbywpUaht3VpDkPd9Ue0I30oQtdYlujhYmjVtHE0w33sh31oBr+zoC+X4eLh++nr7Jyj1S3bdYg+V27rbtjO2c6yBN1d3MVxPBmAa0XC4fs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714412705; c=relaxed/simple; bh=1eUVYVp+Xjc4OAJFJGhCu1jSoyHLPRmAVQDaix2FU1g=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=fxTMMV+Tk8PjsyWeForAo4r4srbx71y8KH6jlkB6K+hW92PkZB6oe4xM8SfLl6xO6V6fucsV4DbFyJOV8qSJIRR6yJB0nWWH3+X5rBc09qzAx/YJVixYAp27qO6EJJLcqYJHvcAAzWE5cADoLqi7ayvByDuCkx/BC5lKfNQkQeg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=Q+TQ62Oy; arc=none smtp.client-ip=46.235.227.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1714412702; bh=1eUVYVp+Xjc4OAJFJGhCu1jSoyHLPRmAVQDaix2FU1g=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=Q+TQ62OyNKLmCbA/w4rO9bbrxYPz4cep6d9dHLQAtOwTRrbuv4Ias4EavOK/ywMIN gLmVE/xm3EJbuHB9jotUbQnRml/fJFV1bQc3dZZwWh7k9rvJkIql2l2/dG5vi8QXyp j/IzOVv0WiDK8A1CVYcS+BU7KFFFL+M/4yNZDXKObdq1xlA2CqZdOvJ3GkZSDMRxnh qF3jmtoG4k+XTnWZEHHBg01wyNnqNxiiZ7YmTRTNCPxYJf5xMONyjv0I2IZTr68jr8 iJc3f1DK9mkluAuo1y9l+pzUpLhin6nAtNafUCeGfKfY5U9SQyof96L2z2WpojK0DG Nk8rFdn22m4uA== Received: from [100.95.196.182] (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: andrzej.p) by madrid.collaboradmins.com (Postfix) with ESMTPSA id A0D6837809CE; Mon, 29 Apr 2024 17:45:00 +0000 (UTC) Message-ID: <8c39b3c3-8146-4418-8835-6dbfe38a85ec@collabora.com> Date: Mon, 29 Apr 2024 19:44:59 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 3/3] media: amphion: Remove lock in s_ctrl callback To: Ming Qian , mchehab@kernel.org, hverkuil-cisco@xs4all.nl Cc: shawnguo@kernel.org, robh+dt@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, xiahong.bao@nxp.com, eagle.zhou@nxp.com, tao.jiang_2@nxp.com, ming.qian@oss.nxp.com, imx@lists.linux.dev, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org References: <20240425065011.105915-1-ming.qian@nxp.com> <20240425065011.105915-3-ming.qian@nxp.com> Content-Language: en-US From: Andrzej Pietrasiewicz In-Reply-To: <20240425065011.105915-3-ming.qian@nxp.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Hi Ming Qian, W dniu 25.04.2024 o 08:50, Ming Qian pisze: > There is no need to add lock in s_ctrl callback, it has been > synchronized by the ctrl_handler's lock, otherwise it may led to > deadlock if driver call v4l2_ctrl_s_ctrl(). > > Signed-off-by: Ming Qian > --- > drivers/media/platform/amphion/vdec.c | 2 -- > drivers/media/platform/amphion/venc.c | 2 -- > 2 files changed, 4 deletions(-) > > diff --git a/drivers/media/platform/amphion/vdec.c b/drivers/media/platform/amphion/vdec.c > index a57f9f4f3b87..6a38a0fa0e2d 100644 > --- a/drivers/media/platform/amphion/vdec.c > +++ b/drivers/media/platform/amphion/vdec.c > @@ -195,7 +195,6 @@ static int vdec_op_s_ctrl(struct v4l2_ctrl *ctrl) > struct vdec_t *vdec = inst->priv; > int ret = 0; > > - vpu_inst_lock(inst); I assume that PATCH v2 2/3 might cause the said deadlock to happen? If so, maybe it would make more sense to make the current patch preceed PATCH v2 2/3? Otherwise the kernel at PATCH v2 2/3 introduces a potential deadlock. Regards, Andrzej > switch (ctrl->id) { > case V4L2_CID_MPEG_VIDEO_DEC_DISPLAY_DELAY_ENABLE: > vdec->params.display_delay_enable = ctrl->val; > @@ -207,7 +206,6 @@ static int vdec_op_s_ctrl(struct v4l2_ctrl *ctrl) > ret = -EINVAL; > break; > } > - vpu_inst_unlock(inst); > > return ret; > } > diff --git a/drivers/media/platform/amphion/venc.c b/drivers/media/platform/amphion/venc.c > index cdfaba9d107b..351b4edc8742 100644 > --- a/drivers/media/platform/amphion/venc.c > +++ b/drivers/media/platform/amphion/venc.c > @@ -518,7 +518,6 @@ static int venc_op_s_ctrl(struct v4l2_ctrl *ctrl) > struct venc_t *venc = inst->priv; > int ret = 0; > > - vpu_inst_lock(inst); > switch (ctrl->id) { > case V4L2_CID_MPEG_VIDEO_H264_PROFILE: > venc->params.profile = ctrl->val; > @@ -579,7 +578,6 @@ static int venc_op_s_ctrl(struct v4l2_ctrl *ctrl) > ret = -EINVAL; > break; > } > - vpu_inst_unlock(inst); > > return ret; > }