From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f171.google.com (mail-pg1-f171.google.com [209.85.215.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1AC7A156879 for ; Wed, 18 Dec 2024 14:09:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734530958; cv=none; b=sJdjMBHOYMGjwGNfRGohNLvfGaoT3In5YNjxbb4o4sb8N4d3m4gx2MlODzCh7aoU/LsVz947KF+zaHX25yqvs8mx5tFdO1PnmXvbSiFQhay/migWBnGjTjHOx6nyJ8iMsQeI8tFvqO7J5bQuV4wuCql17onP9UdEbRfUTk37WAs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734530958; c=relaxed/simple; bh=ab/BzWY6jox/poZbbozr+CLHkFTcOIWwb6vP6tJ3K78=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=a/HPv7p+6xxvZZ/AZ/7UUicKTUU0xdQZ+ofBxPZ1ltkxQco2qhcPmcwFtVSHiGtJJBXOLK3h8P76QnJ/hv77ZLjHreDXGZSmIRXGrFv2p1RFi/hkPR7Qvjh2tbAbPBTPoywLi+v8sY/BpE3CRt+Giz+f1S/ajFZe+Ry9vNWP4No= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=pHinmipk; arc=none smtp.client-ip=209.85.215.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="pHinmipk" Received: by mail-pg1-f171.google.com with SMTP id 41be03b00d2f7-7feffe7cdb7so3642772a12.1 for ; Wed, 18 Dec 2024 06:09:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734530956; x=1735135756; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=X/Mv6Gl1ZnKmi5pkQYAmxfhejMR6LdMzdSDhbu9FQsw=; b=pHinmipkL5SgPKohwvTbfU0SSvZ17ZSvEPmHI7AIObBcGxpmwVjkwyPkNMjqedeYmh N0COgfCdg8yPEP0Q0Rat2T7mSYYFBS8FZ84arM51M8QAqHAcWyM7AUi61FIY51U5YOHr jTvkuP+Gt9cGSLOw/JAF4UD3jWS3WXjPQGqoIlbGzMc3xsQTU/UqImr2bRixoM5qH6PS MvoW9spsYan9G8FPVN6HAvj9iUmqL7E2UuEIYITWlcq8bYjp0Bh8m6ehi5UiljSf/22T QT5kHXb7XrgpXPWjLqZ5GaWdsmegqsHrBPo4X1U65esUagT3sZ3lrIk0R2MFhfszkQ6f ozWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734530956; x=1735135756; h=in-reply-to:content-transfer-encoding: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=X/Mv6Gl1ZnKmi5pkQYAmxfhejMR6LdMzdSDhbu9FQsw=; b=bMFFmzZCsdEaQxHDuF+jHofcDD8JUN/CjzSyzjIYs9rdvpUe9xSnRrcO+gpbd/Q4/L 5zg59Kh3bLhJPzKA84P9XMzECEnG+hhXBEHmlILkoznZfxDuB5kFuLeZHJWFuL/PIoK4 Y1GUBx5BJUqKwXOii2+6Ymr551N2gRbAv5sLsIQiB53mSgkmg4+KBOPWGTr8ofP87r2a omV5VgSKtV+EUNapXZcNCSqfRr4Y0TOtcGCEY3KWzBa3Ann9jNSbT7ieC9rCmNV7qhtK fOhiqMmayq/vcgZjog9yQNbMeJFsFk2DYe0yhcVlujin4WO+Is6eiKg4zf7PUk7avQeX bEKg== X-Forwarded-Encrypted: i=1; AJvYcCUS+jC6lK+DHH5sRYUwljUW12x3P6fpLcL2azI1Big1JKj/T38CklEG+DsbDvObXLXsPFljyJiaBgmIzJI=@vger.kernel.org X-Gm-Message-State: AOJu0Yzk1qVspiik/zQR+vGOLPl+eqNmFvTeSWrtycXSpd73vEE+vmd+ AhtvrEAp+QL7u8+F0VBN/awTnejAJalY1cv0Vwva2s1DESdU0tAZZmVzC2iMQQ== X-Gm-Gg: ASbGnctz5S+odVa/MaUx7h/+PPtRn6bxsol7uxLD8QQBnPpUBnuY+XWfFGsi0/HLGoM 1cwlcLs/V/Bb2YL9tgG1WdW3NdaZeXZ0Yo/hltyftD4uS84MsIM7rG+XnRqQ6zVM9/UC3D2Kiy2 atGT7iwoHnnTrBtKyRRrINR1ea/3YrnIsknu0qnUcL3nZ+i4+xVw1YYgJ5BwMyIUWR829yMTCEe uA/7jgzGkkgNk3wEJ96QqHZ27Ar6EyFh9RTLYj9Ic4bHIJghyC5O1jDXh/aHK4Tb1QI X-Google-Smtp-Source: AGHT+IH5xzquXkfFb3lF+nm5lz7tueo/hHvx4LOhJ/KLOsglCvaRpW0x6iDimmd/UdbW7dAmaOMPGQ== X-Received: by 2002:a17:90b:3508:b0:2ea:2a8d:dd2a with SMTP id 98e67ed59e1d1-2f2e935559cmr4099678a91.27.1734530956490; Wed, 18 Dec 2024 06:09:16 -0800 (PST) Received: from thinkpad ([117.213.97.217]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f2eda27344sm1446032a91.34.2024.12.18.06.09.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Dec 2024 06:09:16 -0800 (PST) Date: Wed, 18 Dec 2024 19:39:10 +0530 From: Manivannan Sadhasivam To: Johan Hovold Cc: mhi@lists.linux.dev, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Loic Poulain Subject: Re: mhi resume failure on reboot with 6.13-rc2 Message-ID: <20241218140910.ysovysnvns26vbmd@thinkpad> References: <20241211145315.vaf7gbapieywcvau@thinkpad> <20241216074021.kwoid2747o7piquv@thinkpad> <20241216141303.2zr5klbgua55agkx@thinkpad> <20241218113830.efflnkxz7qu24xux@thinkpad> <20241218123019.py57s4r3takm2fs6@thinkpad> 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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Wed, Dec 18, 2024 at 02:55:02PM +0100, Johan Hovold wrote: > On Wed, Dec 18, 2024 at 06:00:19PM +0530, Manivannan Sadhasivam wrote: > > On Wed, Dec 18, 2024 at 01:02:39PM +0100, Johan Hovold wrote: > > > On Wed, Dec 18, 2024 at 05:08:30PM +0530, Manivannan Sadhasivam wrote: > > > > On Wed, Dec 18, 2024 at 09:40:45AM +0100, Johan Hovold wrote: > > > > > > > > I've tracked down the hang to a deadlock on the parent device lock. > > > > > > > > > > Driver core takes the parent device lock before calling shutdown(), and > > > > > then mhi_pci_shutdown() waits indefinitely for the recovery thread to > > > > > finish. > > > > > > > Thanks for tracking the deadlock. I think we should use pci_try_reset_function() > > > > instead of pci_reset_function() in mhi_pci_recovery_work(). > > > > > > > > If the pci_dev_lock() is already taken, it will return with -EAGAIN and we do > > > > not need to worry in that case since the host is going to be powered off anyway > > > > (and so the device). > > > > > > That may work. But note that I've now also seen this deadlock during > > > suspend (i.e. when the device is not going away). The > > > pci_try_reset_function() should avoid the deadlock here too, but we'll > > > end up in funny state. > > > > Hopefully, recovery_work() started by mhi_pci_runtime_resume() would be able to > > reset the device. > > But that's not going to happen as that reset is what is currently > causing the deadlock and which would simply be skipped if you switch to > pci_try_reset_function(). > mhi_pci_runtime_resume() will queue the recovery_work() and return. So I was hoping that by the time pci_try_reset_function() is called, the lock would be available. - Mani -- மணிவண்ணன் சதாசிவம்