Received: by 2002:a89:2c3:0:b0:1ed:23cc:44d1 with SMTP id d3csp955912lqs; Wed, 6 Mar 2024 01:43:53 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCU0aGF5h4EHdKDr8NySWpJSJ2O6zukG0rotH9KTjzUD3R8SP0yJnX38YXevXwWjQ/0PgfUrXLiSmZFWyIhv+i4Cav4z/Q1mnZP7xtfy1A== X-Google-Smtp-Source: AGHT+IEwbkprDksf18rHIWLOzY0lwRvoMNXagw9WJABGBDQXWfmQ7J+YvI6vgmtgM/fhceSFarnV X-Received: by 2002:a05:6a20:1447:b0:1a1:1bb5:5c36 with SMTP id a7-20020a056a20144700b001a11bb55c36mr4703811pzi.30.1709718232855; Wed, 06 Mar 2024 01:43:52 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709718232; cv=pass; d=google.com; s=arc-20160816; b=YRYdU1WicRZKpoI3wVvifBVzgXjK7ySKkN/clRwo6CocS01yy6eVx9o+nfa6Hn11mj s6v05l2Po8+CxUfTSrz6s3pY8qSUXtYSeI4RNcdA1neNxkPF8T4K8kiZRD8uSGJuydt1 J2xHhQ4rI/lVv/2ui+koKB4cczsViPuo+GBj41wh6cUF8qwU89w9zBAbzs9BH0GBF4eP APLQk76q5dXD3eCldQOETlvtKnWRmFvDxAqD9P8eyl0kPYBKqtg3XJx7AgwoGLh9fWos a+bVQ/YFdJJCMKGkAHHmbu+JDGagCmGOWvn3kGC7/CowG+1bLv8DGERPXSijzEB2w2iS 0B4A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-id:precedence:message-id:date :subject:cc:to:from:dkim-signature; bh=gQv1BqfTdUsfnWnODQhK96rxVTBRcHtoOh+02sf4lcI=; fh=quEMvg+HNf0jhF80s5rP9DS0GnVnFqwoHRnhYUIiErY=; b=nR6QldMMpVD/r3ZkVGskI52trI24BCUmQlLCVh19CwB1rtIumpG+Ak52YAjiuCk5gE a+zyTOb7yNpn4XoSGsrmD5zsexFzi0xz1TmsXLPE4ZswRqj1GZnXv3EXp13StmWalTKG W1kVn937M6tLQgknGklzsWfxp9weaYxR6Ik7W2NI8fcEGqKun/8UiYRupTS9UUO55bIq XSxfIr0tFRa5c3+cll96Ktf+iYVKh7SQPJ2infv358YNK251DWWuXCyBTA32NFiDinNK +wDFut98lvzOr7srNA/IshVJhVAYg/lUzYk6wPTqNf9ZhjKElsx6DRhyIKIKz6XmmoQR yMUQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=g3hibTTt; arc=pass (i=1 spf=pass spfdomain=qualcomm.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-93608-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-93608-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id z189-20020a6333c6000000b005dcbbacc92esi11676630pgz.872.2024.03.06.01.43.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Mar 2024 01:43:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-93608-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=g3hibTTt; arc=pass (i=1 spf=pass spfdomain=qualcomm.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-93608-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-93608-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.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 6EC49B2DF26 for ; Wed, 6 Mar 2024 09:17:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1AE5B5EE65; Wed, 6 Mar 2024 09:17:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="g3hibTTt" Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (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 630A25D8F9; Wed, 6 Mar 2024 09:17:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709716623; cv=none; b=GHuAdFC+1BGME1AllYEOfkeUzOFKvgM/a20YL+oM+tXpbLWmcsVFVf3VxyOBjlhv7ot4zdgAhklu2JDovwzfrjQ0hZd+nCP+4l1KzyCmzjYATbLkP7ZWiG7E0r8z798gzCW56eZEH7b08hIQk9ton2S3QygG49c/jNAQiohexNI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709716623; c=relaxed/simple; bh=6VrZRSURzUXrSBObI2POcRjZjknLbdF/Dl4bUKgbr9M=; h=From:To:Cc:Subject:Date:Message-Id; b=Qxf22Af3s5iqoE0rzbrdFP32BKdHpnKV365lAxHZKceNH+/CzrD4DeQZlBPHdO2BPwg4twIJTBmly8j9uEHUQ9HeQsQx9HAz3Emv0sx0Vuw3VbxPyK3s6BnafLjwcgx2n5s3f5eLea4qW+NOqgwzHCOdZdjdyyjDNLDQXU3RTxU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=qualcomm.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=g3hibTTt; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=qualcomm.com Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 4265q93M026583; Wed, 6 Mar 2024 09:16:49 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= from:to:cc:subject:date:message-id; s=qcppdkim1; bh=gQv1BqfTdUsf nWnODQhK96rxVTBRcHtoOh+02sf4lcI=; b=g3hibTTtKpbYCOwJlBXWXOYb4Sbv I1IXYHKCkppebLWb+v0gLOGg6Fyf2sH0QgXgwlUkNqqItJyM6SJYSBRJ4fxtegZv gwbslXAn3GCsZSGzypFpwSAD1GfvMkOfDp0QPYf+I+l8pZJzDS3dAKoej4pRk3fZ DXCmwKILt92uFuGgzAXKuxmFw2coW2vIq+BmK7KDHPDlKYWy18vi51EzqUo0Tt4d W+F2nb3KpEuRYoOffdCXkxqpAMCgUqRagjwVS2h3P7aRScpvNGiYLm9TyLom3VOC gBJedd6fO42gAz10/BZ+B03DDGD+ccGXc4Dg9UVMIjgW4gLLDTD7pD0k1Q== Received: from apblrppmta02.qualcomm.com (blr-bdr-fw-01_GlobalNAT_AllZones-Outside.qualcomm.com [103.229.18.19]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3wpjqf0dae-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 06 Mar 2024 09:16:49 +0000 (GMT) Received: from pps.filterd (APBLRPPMTA02.qualcomm.com [127.0.0.1]) by APBLRPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTP id 4269GktO022533; Wed, 6 Mar 2024 09:16:46 GMT Received: from pps.reinject (localhost [127.0.0.1]) by APBLRPPMTA02.qualcomm.com (PPS) with ESMTP id 3wkw6kt155-1; Wed, 06 Mar 2024 09:16:46 +0000 Received: from APBLRPPMTA02.qualcomm.com (APBLRPPMTA02.qualcomm.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 4269GkNT022528; Wed, 6 Mar 2024 09:16:46 GMT Received: from hu-maiyas-hyd.qualcomm.com (hu-vdadhani-hyd.qualcomm.com [10.213.106.28]) by APBLRPPMTA02.qualcomm.com (PPS) with ESMTP id 4269Gk91022527; Wed, 06 Mar 2024 09:16:46 +0000 Received: by hu-maiyas-hyd.qualcomm.com (Postfix, from userid 4047106) id C772A5001D9; Wed, 6 Mar 2024 14:46:44 +0530 (+0530) From: Viken Dadhaniya To: andersson@kernel.org, konrad.dybcio@linaro.org, srinivas.kandagatla@linaro.org, linux-arm-msm@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Cc: quic_msavaliy@quicinc.com, quic_vtanuku@quicinc.com, quic_anupkulk@quicinc.com, quic_cchiluve@quicinc.com, Viken Dadhaniya , stable@vger.kernel.org Subject: [PATCH v2] slimbus: qcom-ngd-ctrl: Add timeout for wait operation Date: Wed, 6 Mar 2024 14:46:42 +0530 Message-Id: <20240306091642.9123-1-quic_vdadhani@quicinc.com> X-Mailer: git-send-email 2.17.1 X-QCInternal: smtphost X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: jDFJ5S_vQCEQaiGFzoqot2HSa80kYa4k X-Proofpoint-ORIG-GUID: jDFJ5S_vQCEQaiGFzoqot2HSa80kYa4k X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-06_04,2024-03-05_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 mlxscore=0 clxscore=1011 phishscore=0 malwarescore=0 bulkscore=0 impostorscore=0 mlxlogscore=999 priorityscore=1501 lowpriorityscore=0 adultscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2402120000 definitions=main-2403060072 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: In current driver qcom_slim_ngd_up_worker() indefinitely waiting for ctrl->qmi_up completion object. This is resulting in workqueue lockup on Kthread. Added wait_for_completion_interruptible_timeout to allow the thread to wait for specific timeout period and bail out instead waiting infinitely. Fixes: a899d324863a ("slimbus: qcom-ngd-ctrl: add Sub System Restart support") Cc: stable@vger.kernel.org Reviewed-by: Konrad Dybcio Signed-off-by: Viken Dadhaniya --- v1 -> v2: - Remove macro and add value inline. - add fix, cc and review tag. --- --- drivers/slimbus/qcom-ngd-ctrl.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/slimbus/qcom-ngd-ctrl.c b/drivers/slimbus/qcom-ngd-ctrl.c index efeba8275a66..a09a26bf4988 100644 --- a/drivers/slimbus/qcom-ngd-ctrl.c +++ b/drivers/slimbus/qcom-ngd-ctrl.c @@ -1451,7 +1451,11 @@ static void qcom_slim_ngd_up_worker(struct work_struct *work) ctrl = container_of(work, struct qcom_slim_ngd_ctrl, ngd_up_work); /* Make sure qmi service is up before continuing */ - wait_for_completion_interruptible(&ctrl->qmi_up); + if (!wait_for_completion_interruptible_timeout(&ctrl->qmi_up, + msecs_to_jiffies(MSEC_PER_SEC))) { + dev_err(ctrl->dev, "QMI wait timeout\n"); + return; + } mutex_lock(&ctrl->ssr_lock); qcom_slim_ngd_enable(ctrl, true); -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation