From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.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 F0573184E for ; Wed, 29 Jan 2025 15:47:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738165629; cv=none; b=CTGj4Q4rnFt3rM6iGI9Ryxc+6pTPCsLeMSj/JL8feMYrBTUNL2BrA3mAgoMI3F8Bnk7f5o+DIPC1WNkYzc5kaS1Sytkui00zBGG/uC8t/SDd4nfSr4Eesg4MhVN5ROzzcM4so3gz46xYHJgKvK4hnf47xKFmD2biHk2rKOcqCZQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738165629; c=relaxed/simple; bh=gjUlpvtRx4TKO8+ZgCxRL0KfwofILm4mQrQD+cRdeww=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=pfsgz1vFomHQvpiTSKZY8fFECe7DJVfCz9Er/pNFYDx2SvhaHWiZ9GZidUZiNnOh2QMFF9mfObve+mzMCZcCvXIH8vmU1xs4I36l/RbkHWQR3D0//SNidqlFuv+OnC1hWiun0MWrXvcdReIPG3EiU+lrnkotpFi5UCc01gt1a70= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=dq2utdw0; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="dq2utdw0" Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 50TFabgg028297 for ; Wed, 29 Jan 2025 15:47:07 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to; s=qcppdkim1; bh=fQOn6UPmJPqadoJzIHUJBVDZ sbVE1Q7XtWBXcqczS9Y=; b=dq2utdw0t7AGr7qvQJ8oMqsxLayecNK2K+ZzkirI Tgl6cUgZqpOIe5hJZ1+NhRptbWZhuAIsVRbgt1H3zWd3zCJDo8BDHaXUJrA+p15N E5/NIouYGVIXX4ilLQK0FaMERpM4I8OhIX9n2wEu0gYpm+zgU4RFt/tFy8yZt+42 QOMdFtm+AXfE41krJlgBw0EgF9o8k4zKii/wBaL7ttE85k9QgWebLQhvZGUa3vW2 15t1zFXkXsAWOwlXxr4IMrrMRT1Rrduduh26JeBKKv8gmmMVHdYBahFp4Gl2qtt2 L4klprxHGLnSN47wYYSI6cIoubZgfXahSN3WtkKNUfBkYA== Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 44fq4gg137-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Wed, 29 Jan 2025 15:47:07 +0000 (GMT) Received: by mail-pl1-f197.google.com with SMTP id d9443c01a7336-216430a88b0so135979935ad.0 for ; Wed, 29 Jan 2025 07:47:06 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738165626; x=1738770426; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=fQOn6UPmJPqadoJzIHUJBVDZsbVE1Q7XtWBXcqczS9Y=; b=MTgUK21MVknYi7DEC04tJSWWUATLvdrGw0i/xjtvNvo4jmJsh40lbimQrr/GfTi229 64mx+BdkSu4aca54P7iJoQl/Bict7XUwum0m8JMVeTe3kM6Oacu+NcUt37uTazAQkfKy eWHMooz0n7j03OBL9A9e65g0L3N9TOQWcvG2BPZuf6QsuPEpMGxcW5LgvLn5eD7c+kfd YqoyExO8S0/P4ohwztaEozwpADZXMlYOF1YvQEiIiZyyLnve4w/czAOARpjte4InhPRQ nYkGp0Atp9JEiotiqsgYczIAT+Z6/2a2Qp1x0UE6xVlhICQ798fR5qxK+2Wvw6BOicag RHSQ== X-Forwarded-Encrypted: i=1; AJvYcCUZ1XFvX7Jo054J78q9E9OtHA9LTk7ajmfOBqTpDTg6o7veahQa8W181mUJZdtLtnpAdsFBcwvlrAke9Zc=@vger.kernel.org X-Gm-Message-State: AOJu0YzZWjZatyv3L+CkUAfH1xxKOl0zf3jyMs0dsmSXY2PrfU/qzI2X sJuUYSIoiftVdf439lUkt60BZjnb+g2SfaYLzbqt1waS86+wImiQbDgJZFR20f3791Ey2UROCY4 25M4Rpv/CB5AnFNSF9v56d5m/HYCoKgHYRAMAXOz+1X4aFd6XmTDdjQAEHKGHSvA= X-Gm-Gg: ASbGncv1AYziL33Ig8Cr9gaBzOA2HlHczHWbOCJ3SxVBXNJb7v6rchNV7DN2909JUs3 J0iCVwQekWy9Hu4ZJ461DNFjKyyJ0tfkP5yvFzytiJ2ai8i2s6XMt3ZnBtvFCxVBW1f7ohM+Uub ATHDRs63JxLUOrLUyFN4oirz1ckHlE9dcmEhCvBTNN+uonviBlhgiklW2MD2KvqC3C89TCWmJWm ObRqzQFRrCZkkl7722sK8LLnD/KhNjHndWHRsQ827yhur5jpG2pS+xzZeEp6xX7EBrknmvnGZ7M bCJEKW6fWJrvHdC2zoo5NMpOcICqZ9CR X-Received: by 2002:a05:6a21:7894:b0:1e1:a716:316a with SMTP id adf61e73a8af0-1ed7a4c0ad4mr4889278637.10.1738165626083; Wed, 29 Jan 2025 07:47:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IHTCfu5425uR24Gf5ZcLkQl8PeXzpr4m471UfUq8uzBmAzeN1wptRFcvgdmGJO4HBfoOh81nQ== X-Received: by 2002:a05:6a21:7894:b0:1e1:a716:316a with SMTP id adf61e73a8af0-1ed7a4c0ad4mr4889247637.10.1738165625674; Wed, 29 Jan 2025 07:47:05 -0800 (PST) Received: from hu-mojha-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72f8a78e351sm11500332b3a.180.2025.01.29.07.47.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jan 2025 07:47:05 -0800 (PST) Date: Wed, 29 Jan 2025 21:17:01 +0530 From: Mukesh Ojha To: Dmitry Baryshkov Cc: andersson@kernel.org, konradybcio@kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Saranya R Subject: Re: [PATCH] soc: qcom: pdr: Fix the potential deadlock Message-ID: References: <20250128080751.3718762-1-mukesh.ojha@oss.qualcomm.com> <3upgcew4ulzxtjjnawqiu4jomm3mm5nf2kxworgeod23nurfrv@5ato4wq54mpm> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3upgcew4ulzxtjjnawqiu4jomm3mm5nf2kxworgeod23nurfrv@5ato4wq54mpm> X-Proofpoint-ORIG-GUID: gQ1JDsJkjT_iIukj0knM7qtZAHwOkitw X-Proofpoint-GUID: gQ1JDsJkjT_iIukj0knM7qtZAHwOkitw X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-01-29_02,2025-01-29_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 priorityscore=1501 mlxscore=0 adultscore=0 lowpriorityscore=0 clxscore=1015 bulkscore=0 impostorscore=0 suspectscore=0 spamscore=0 malwarescore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2501290126 On Tue, Jan 28, 2025 at 06:10:24PM +0200, Dmitry Baryshkov wrote: > On Tue, Jan 28, 2025 at 01:37:51PM +0530, Mukesh Ojha wrote: > > When some client process A call pdr_add_lookup() to add the look up for > > the service and does schedule locator work, later a process B got a new > > server packet indicating locator is up and call pdr_locator_new_server() > > which eventually sets pdr->locator_init_complete to true which process A > > sees and takes list lock and queries domain list but it will timeout due > > to deadlock as the response will queued to the same qmi->wq and it is > > ordered workqueue and process B is not able to complete new server > > request work due to deadlock on list lock. > > > > Process A Process B > > > > process_scheduled_works() > > pdr_add_lookup() qmi_data_ready_work() > > process_scheduled_works() pdr_locator_new_server() > > pdr->locator_init_complete=true; > > pdr_locator_work() > > mutex_lock(&pdr->list_lock); > > > > pdr_locate_service() mutex_lock(&pdr->list_lock); > > > > pdr_get_domain_list() > > pr_err("PDR: %s get domain list > > txn wait failed: %d\n", > > req->service_name, > > ret); > > > > Fix it by removing the unnecessary list iteration as the list iteration > > is already being done inside locator work, so avoid it here and just > > call schedule_work() here. > > > > Signed-off-by: Saranya R > > Signed-off-by: Mukesh Ojha > > Missing Fixes tag. Sure, will add. -Mukesh > > > --- > > drivers/soc/qcom/pdr_interface.c | 8 +------- > > 1 file changed, 1 insertion(+), 7 deletions(-) > > > > -- > With best wishes > Dmitry