Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp1184634imw; Tue, 5 Jul 2022 05:20:42 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sLz+NCTrPtLEtzS80XY7mqABpD8qur1UX+OhWd+gaHxtRD913zYlu0Ek+kM51mOrOevbl/ X-Received: by 2002:a65:5207:0:b0:3fb:c00f:f6e4 with SMTP id o7-20020a655207000000b003fbc00ff6e4mr30098444pgp.415.1657023642199; Tue, 05 Jul 2022 05:20:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657023642; cv=none; d=google.com; s=arc-20160816; b=Jd54FCbb/tMhoIeRQ0Sv/A00SZZOiA29hPF8K+76M9PrEsnpat5XnqK9xiBHQZ8N8P Yh6+w3RpcWx+9xH47bINf8pUc4dhsq8XfgXbwmNomGQxlQHZVMohsYiScpujoSRyUvV6 kz57d80s6uiBMThWW7omKagsve2FUlEJiHvU7miKK0B0b0+i55xnQe+UcjRU/mN2YdbE 3VkH6Oj6W9eKSDRViA+VyaNPIVXWzvtZ+B9mkehy0e4FPNzenV9S04FRwK+w7uFk/vuX /X38xioeSdC6FseZhatmMS5kvqUaoK8AMqp0Z8XVK+s2oy/aQZfhn2wL8hAKLQoVUOIU aGmA== 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=shTB0DnuQEAQMrBnn3hQIHFMKfWKIyiEX/Amn09n/BM=; b=pbOIp2ojcyHfE+18SwT9Rz9XwieC9wNthFxPN8zzcRqndVy2MLqeIAjQqey4ID4xZR 1Admh67LFGMN58BVPjQv1vUZ7mFhmvA5trIuSWOXdiMXkO2c41FoPRIKq5bMlIC8TS1B DAPujzPSc5JZuRqftjG2HTXKRE9Qb+iam/bZ1VfgBiSwBvlMaQHPWl5seqOy6AfEUEUa Kk5MHwqAQukhIzjg/m3Kkum+CUUy3GSD7ZIeV9VUBqi9LH01i+5lhh3wuYeA2a9iXqIQ Z7KKthhskpTDCqEJKAuTWG2XQtdb+GG8F+7j92bRZDXkdoQbNohvTuZkgnIoku4ThgzA +B+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=HhwnmPTd; 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 o17-20020a637e51000000b004126fc5d2casi2591644pgn.572.2022.07.05.05.20.26; Tue, 05 Jul 2022 05:20:42 -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=HhwnmPTd; 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 S236620AbiGEMR6 (ORCPT + 99 others); Tue, 5 Jul 2022 08:17:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235363AbiGEMJE (ORCPT ); Tue, 5 Jul 2022 08:09:04 -0400 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 0E0A310AF; Tue, 5 Jul 2022 05:09:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1657022944; x=1688558944; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=shTB0DnuQEAQMrBnn3hQIHFMKfWKIyiEX/Amn09n/BM=; b=HhwnmPTdLApE9RNsPw/SkvmThpgEmkJsNqxGyygOxtamdYJeoZuq3OZC raB/ct330TJa+xAsZg951Gk+a//bH4KC6BhBjs5AX7J7vWo5qay2+fu21 0KpqR8CCNTfwV8U/8zGAVJuh5C/SJcns5fs4eDAztVm7PAJl3oipFqaoj E=; Received: from unknown (HELO ironmsg-SD-alpha.qualcomm.com) ([10.53.140.30]) by alexa-out-sd-01.qualcomm.com with ESMTP; 05 Jul 2022 05:09:03 -0700 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg-SD-alpha.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jul 2022 05:09:03 -0700 Received: from nalasex01a.na.qualcomm.com (10.47.209.196) by nasanex01c.na.qualcomm.com (10.47.97.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Tue, 5 Jul 2022 05:09:03 -0700 Received: from blr-ubuntu-87.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Tue, 5 Jul 2022 05:09:00 -0700 From: Sibi Sankar To: CC: , , , , , , , Siddharth Gupta , Sibi Sankar Subject: [V3 7/7] remoteproc: sysmon: Send sysmon state only for running rprocs Date: Tue, 5 Jul 2022 17:38:20 +0530 Message-ID: <1657022900-2049-8-git-send-email-quic_sibis@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1657022900-2049-1-git-send-email-quic_sibis@quicinc.com> References: <1657022900-2049-1-git-send-email-quic_sibis@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 nalasex01a.na.qualcomm.com (10.47.209.196) 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,T_SCC_BODY_TEXT_LINE 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 From: Siddharth Gupta When a new remoteproc boots up, send the sysmon state notification of only running remoteprocs. Sending state of remoteprocs booting up in parallel can cause a race between SSR clients of the remoteproc that is booting up and the sysmon notification for the same remoteproc, resulting in an inconsistency between which state the remoteproc that is booting up in parallel. For example - if remoteproc A and B crash one after the other, after remoteproc A boots up, if the remoteproc A tries to get the state of remoteproc B before the sysmon subdevice for B is invoked but after the ssr subdevice of B has been invoked, clients on remoteproc A might get confused when the sysmon notification indicates a different state. Signed-off-by: Siddharth Gupta Signed-off-by: Sibi Sankar --- drivers/remoteproc/qcom_sysmon.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/remoteproc/qcom_sysmon.c b/drivers/remoteproc/qcom_sysmon.c index a9f04dd83ab6..57dde2a69b9d 100644 --- a/drivers/remoteproc/qcom_sysmon.c +++ b/drivers/remoteproc/qcom_sysmon.c @@ -512,10 +512,12 @@ static int sysmon_start(struct rproc_subdev *subdev) mutex_lock(&sysmon_lock); list_for_each_entry(target, &sysmon_list, node) { - if (target == sysmon) + mutex_lock(&target->state_lock); + if (target == sysmon || target->state != SSCTL_SSR_EVENT_AFTER_POWERUP) { + mutex_unlock(&target->state_lock); continue; + } - mutex_lock(&target->state_lock); event.subsys_name = target->name; event.ssr_event = target->state; -- 2.7.4