Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp3570290ioo; Mon, 30 May 2022 05:13:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzl6fK9c0Pmskmwas5QVLotC75sS+2u9TnY/Hw1AGsv9EZUBk/oI1PkJ7tEVi5IGrhnh8j+ X-Received: by 2002:a63:85c2:0:b0:3fa:cefb:ae4b with SMTP id u185-20020a6385c2000000b003facefbae4bmr23453657pgd.50.1653912829054; Mon, 30 May 2022 05:13:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653912829; cv=none; d=google.com; s=arc-20160816; b=limcby74Z7RvBscQ2/OZVCjB0jItreEyl0N+eQ8G+ssakslwJ4vRlmuoTdoWxdvbKU rlLcHjhDQ0MzSdE4YF4GkxsxFLQj7f/lepaZpaeu4XZRIRSOy7LfTOmrQtX1PVyCESyf l0M8TgozVweAchSWG7xn9iBp5jcKO+MiRmpiPdUTWPTtov13/LZ+rNTJ/ZDjbv/QpAjI kmYJ59FdP4QqEuk2yLNvP75yFRwRJBlPYTNq2rwr+YZsp7+sEmx5WEC/0navmg0FXOCl m0d7mDyIsX2VkNSg5f/hCHFJZx7qrgeU2SegC2gPGD0hrGvGN5Fmdu3V6iRxxpMCzYnG XKQw== 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=X5f0NVCJbgU0lrg5NV7uYmu4jzTi7nMUHYbkTqXsJFPf6oU1KQud1pH4dRNI5ehSu1 k9oe6uwaHWXVTKll9pvD6vWyMlpVGehf1UorsD/+r9RhUG+uqMhZkD12Axm9xSEGLzk1 tjRUGUFwuKE8Cof4rsVSregpNXqDM5+feeG6TfQS//FtFvOK+/BK4LQeBdF87javWUcw UME510TI2ts1Wgegui7dyD6TQgdiHgmErhguRE0Q/3mR+VoV27u3vA9+VEOJKTAG741N LFlvFk8c9n1Y8ZXDxEymTmhcf1tAoUlqaGPr0/hhTGmf+rFaowehOFB/K3XEj9EhlWtK UFsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=Q+EXTRUf; 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 n184-20020a6327c1000000b003fb92ed82a9si13481375pgn.873.2022.05.30.05.13.35; Mon, 30 May 2022 05:13:49 -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=Q+EXTRUf; 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 S231281AbiE3GXw (ORCPT + 99 others); Mon, 30 May 2022 02:23:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232801AbiE3GX2 (ORCPT ); Mon, 30 May 2022 02:23:28 -0400 Received: from alexa-out.qualcomm.com (alexa-out.qualcomm.com [129.46.98.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9BEE7B487; Sun, 29 May 2022 23:23:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1653891807; x=1685427807; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=shTB0DnuQEAQMrBnn3hQIHFMKfWKIyiEX/Amn09n/BM=; b=Q+EXTRUfBlfgZrTKmjbC2c+8fT4OL+zkUWMJe2jqskfatjPyHTSJfVv6 gN8JMV0qy9Z8gp3oyzB2If0gcucoKd9eV9B3fnEi+OLvxqZjc+STSJ2Pj 2AMGWW3qWsQwTxQ7COxhh4++2CkEHpeonh+lLxpjF8McI6s5XfgKT4ruW A=; Received: from ironmsg08-lv.qualcomm.com ([10.47.202.152]) by alexa-out.qualcomm.com with ESMTP; 29 May 2022 23:23:27 -0700 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg08-lv.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 May 2022 23:23:26 -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; Sun, 29 May 2022 23:23:26 -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; Sun, 29 May 2022 23:23:23 -0700 From: Sibi Sankar To: CC: , , , , , , , Siddharth Gupta , Sibi Sankar Subject: [V2 6/6] remoteproc: sysmon: Send sysmon state only for running rprocs Date: Mon, 30 May 2022 11:52:51 +0530 Message-ID: <1653891771-17103-7-git-send-email-quic_sibis@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1653891771-17103-1-git-send-email-quic_sibis@quicinc.com> References: <1653891771-17103-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