Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp1566353rwn; Thu, 15 Sep 2022 18:57:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7iN4/Z9KAfWBs2P5lAK3qT/7UgFnRhHqnVL/yOoJ93BN/LHgl4Qu7bRJixxaKcK3n8vtH1 X-Received: by 2002:a05:6a00:198e:b0:541:f85a:6c27 with SMTP id d14-20020a056a00198e00b00541f85a6c27mr2365909pfl.81.1663293426636; Thu, 15 Sep 2022 18:57:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663293426; cv=none; d=google.com; s=arc-20160816; b=TwSyyADZf5jMlKZDWUhGMvR98ZWU3v5KGC0tSWWvZyhnpxlsNtVsW+vUyBaWdX9/v6 R9CsiZBa7Cp/AxIE1ST8CAztwhVEpKPBrn/z1NPrA+flNWBvmz++GGiv0F52nY8KRFam x1ZDUe5M4bxx4ukc0Bkjww4lw4wcyGInV8+dCPgl81EwcD284c80uVA/xFdINA3dPnuB 0Rkmic616vDvJ+pmnN9legSbNCckonnQeFLzfXq5BKzQ2KiFXkGEwHrEG1bvH8Zk/S5A Nsmszfv4K9wd+GC83cBYW5y+TMGtjnKHJohfFk0VRlc9FEvy9t/H4+2+wRHwlLFa26Za ZzOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=3Uwpw85QRCkIb0Vj4n6dYB5Hs7piNCkgQOwoSrNMwoM=; b=0rBWul1JfdNDgyavhKLBK3vqUYejAABRQSNmFwoulW/+/7Mlr45ckGVcPDJYPdwzAL OidXiKlReJ2vRsab5tSAjnpakCE2Nme891KPtLJjQZRzQJM3XqWkSlCO7oHNo+fBxjTD ZRNLnM+ACaiKESQ9QI3bhWz7qBcsYtEHGrGPTT7fxPKgU9DZf4urbvuDCcur0zwhaG63 antH4eCWbmQVsTLZLFAr/Ia3xPrJe00pcU+UO/9F5twZOVVCTl66wLxxjs1Z/igmbXym +QxLKhQKMDShef07CmUk+Ka7Ax3431HhQ9KUzbme+7E4g/TgeHQ/UzkX6HboTl/p93Um iHfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=XxpSfhQh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x5-20020a656aa5000000b0042b77c2ce6bsi20536452pgu.130.2022.09.15.18.56.53; Thu, 15 Sep 2022 18:57:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=XxpSfhQh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229816AbiIPBio (ORCPT + 99 others); Thu, 15 Sep 2022 21:38:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229588AbiIPBin (ORCPT ); Thu, 15 Sep 2022 21:38:43 -0400 X-Greylist: delayed 123 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Thu, 15 Sep 2022 18:38:41 PDT Received: from alexa-out-sd-01.qualcomm.com (alexa-out-sd-01.qualcomm.com [199.106.114.38]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35F394054F; Thu, 15 Sep 2022 18:38:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1663292321; x=1694828321; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=3Uwpw85QRCkIb0Vj4n6dYB5Hs7piNCkgQOwoSrNMwoM=; b=XxpSfhQhOoRWXiMVy/tXxaM4pBE9/iUDb9fFmlCJWR4mt8lO1tF205iJ rBKFv7CHiYM94HMwLZEjcxY1qaK6S5gT1QTRIWtp4y1V/ZHaKHGsD/C/k 9KO7jZ9UXj8f+d1kU6p5gt/Yi5JJMK1Hm2bY06u7S74yAEuB/iZ5IITtc A=; Received: from unknown (HELO ironmsg04-sd.qualcomm.com) ([10.53.140.144]) by alexa-out-sd-01.qualcomm.com with ESMTP; 15 Sep 2022 18:36:37 -0700 X-QCInternal: smtphost Received: from unknown (HELO nasanex01a.na.qualcomm.com) ([10.52.223.231]) by ironmsg04-sd.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Sep 2022 18:36:34 -0700 Received: from ecbld-sh026-lnx.qualcomm.com (10.80.80.8) by nasanex01a.na.qualcomm.com (10.52.223.231) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.29; Thu, 15 Sep 2022 18:36:32 -0700 From: Maria Yu To: CC: Maria Yu , , , , Subject: [PATCH v3] remoteproc: core: do pm relax when in RPROC_OFFLINE Date: Fri, 16 Sep 2022 09:36:23 +0800 Message-ID: <1663292183-7957-1-git-send-email-quic_aiquny@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <128dc161-8949-1146-bf8b-310aa33c06a8@quicinc.com> References: <128dc161-8949-1146-bf8b-310aa33c06a8@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nasanex01a.na.qualcomm.com (10.52.223.231) X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org RPROC_OFFLINE state indicate there is no recovery process is in progress and no chance to do the pm_relax. Because when recovering from crash, rproc->lock is held and state is RPROC_CRASHED -> RPROC_OFFLINE -> RPROC_RUNNING, and then unlock rproc->lock. When the state is in RPROC_OFFLINE it means separate request of rproc_stop was done and no need to hold the wakeup source in crash handler to recover any more. Signed-off-by: Maria Yu --- drivers/remoteproc/remoteproc_core.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index e5279ed9a8d7..247ced6b0655 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -1956,6 +1956,17 @@ static void rproc_crash_handler_work(struct work_struct *work) if (rproc->state == RPROC_CRASHED || rproc->state == RPROC_OFFLINE) { /* handle only the first crash detected */ mutex_unlock(&rproc->lock); + /* + * RPROC_OFFLINE state indicate there is no recovery process + * is in progress and no chance to have pm_relax in place. + * Because when recovering from crash, rproc->lock is hold and + * state is RPROC_CRASHED -> RPROC_OFFLINE -> RPROC_RUNNING, + * and then unlock rproc->lock. + * RPROC_OFFLINE is only an intermediate state in recovery + * process. + */ + if (rproc->state == RPROC_OFFLINE) + pm_relax(rproc->dev.parent); return; } -- 2.7.4