Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp1795059rwn; Fri, 16 Sep 2022 00:25:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM76WLgXhVkEV/ChAqBDIPEgOO6DVKregXQIYXfvx1omPI6t/bIF/WrsPXF+ccq/Ar4Z/zt0 X-Received: by 2002:a17:902:f816:b0:178:3bc6:dfd with SMTP id ix22-20020a170902f81600b001783bc60dfdmr3417453plb.10.1663313106121; Fri, 16 Sep 2022 00:25:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663313106; cv=none; d=google.com; s=arc-20160816; b=PqQH44VpMKnAwI7g9liSXss/Rw83VY1oPBdAgV0MJ0cyv5uXBfucDFXE0gb+z5YrdG 5/ejF4ZP29csL1So+wOKwndLLjYXhHgjPGMH821g9NgPTgr+KUqpYRBqdzgzgMGYIoj0 Bzc/yDjhE0eDmHsMYbyerhc34T01TmQm2WoUSMaDdNQqDN8GXQzI2xaDAK/YPe8+DYp5 VUYx4BnSLt5k+5adMyb0niIpjBRQrzLKqSvIEbCjrOMZ1sRk9LSF8egBl69OaBy5Ydvp RDNP9995SD0SI9GQ99um8S0v5SCsHJXWRzOcihBG3MmXUWPv9qARB5KJ8zpxivEOIUmm a6Hg== 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=5L6dIif8ingzv+vHB+hMzVyWir1OfL0FJ4UuSGWbKbQ=; b=XSenUF2qOwnNUqFOwQumrqcJZe97mTfzk3+TZuwxVM9JdNN8t6Mup1mZW3TjyKUXId 5mLgeat8BlbvTLKXq8y3GE2/8d+DjeVCaR80ouYH9m9mDNyDBMzGkFN1BYr1JAlmg9Lg ypipVNyvrlbdLmuVGAl2Tl6uRVb/hOgBuTpiZbEG1hXcdm0BoUqIWZL1Rc4Rfuq4AELe aSR8gf878ZQwZTneR5hNIJoTrNz3HeXwSmIxkYoxzbBLAOFp7GzvXtZaZ2LXuKX0Wgup DQeYPMMZ6Xw1gOwQkwHnMTrXazPIll71WTTcrcur3/2mt5o4G4IhLFFxQBg5vxJW29ul CYyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=w2+w+hnP; 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 lp6-20020a17090b4a8600b0020061cbc731si1992571pjb.165.2022.09.16.00.24.54; Fri, 16 Sep 2022 00:25: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=w2+w+hnP; 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 S229518AbiIPHMp (ORCPT + 99 others); Fri, 16 Sep 2022 03:12:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229436AbiIPHMn (ORCPT ); Fri, 16 Sep 2022 03:12:43 -0400 Received: from alexa-out-sd-02.qualcomm.com (alexa-out-sd-02.qualcomm.com [199.106.114.39]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03C8E36849; Fri, 16 Sep 2022 00:12:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1663312362; x=1694848362; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=5L6dIif8ingzv+vHB+hMzVyWir1OfL0FJ4UuSGWbKbQ=; b=w2+w+hnP0SKo0we31kB3zqM6R4RL7LmZtdWMYPZVxAbp1H8YuBF8acC/ O5gV1Jy/L9SIjNJl8EdmmmWygSoRSmSGQJll7ecxXuGXBTLyXOCpUpUuL /Kauu7rsCYAngQxN1tZoaYKtXqe47+Uk/tqHfv5CDm61XZdnKVkadLtRD Y=; Received: from unknown (HELO ironmsg04-sd.qualcomm.com) ([10.53.140.144]) by alexa-out-sd-02.qualcomm.com with ESMTP; 16 Sep 2022 00:12:40 -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; 16 Sep 2022 00:12:40 -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; Fri, 16 Sep 2022 00:12:38 -0700 From: Maria Yu To: CC: Maria Yu , , , , Subject: [PATCH v4] remoteproc: core: do pm relax when in RPROC_OFFLINE Date: Fri, 16 Sep 2022 15:12:31 +0800 Message-ID: <1663312351-28476-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: nasanex01b.na.qualcomm.com (10.46.141.250) 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..6bc7b8b7d01e 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 held 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