Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1966640pxu; Sun, 13 Dec 2020 09:06:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJwvhxlX6npyvCOt9lipzmN7CsHyuSaOk2C+FqaDfuwZ/4vtaZwA4PeFBYw2UWeXaMslanaX X-Received: by 2002:a17:906:3687:: with SMTP id a7mr19253861ejc.210.1607879164872; Sun, 13 Dec 2020 09:06:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607879164; cv=none; d=google.com; s=arc-20160816; b=xOUmp++uAffHN/dW2t5pJ2iULb4xU3BRaJyfNKBIkDAyMu+KingfgD14iwVKGzyZfi uSwhFjDvib+kD9GQ04xpUmvdR8Nytzwzk1lhMk7ZmkQq/oqbmkRziiUJZEi0LOSm/duF w6+uJyY/O0wzgfdMe1+6tyW9BUdOt/lUmHf5ruIk5UesWB3IZw3oRu6xFekpnJNe2KOp LbsqUPZQjUzLkivBMPN+uoGUO+LbPgkrUZ84klsut+teBTu0T+DxPSZ5nnW1Z8OqPvwU WLYV9ti5YxV+60YVgBPBnuh21r+wMGNE1o+1/pS+S+wUmwQYgPXkwoxhjAFN46Tp36k+ vdEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from:dmarc-filter :sender:dkim-signature; bh=/AJJdvvgcxzEk2iIh8Q9OM+WIMHQvzRBydUe39VSYsA=; b=yP6kb22ZGEcuj3+fSULBrzZrtJMO29Go9Nqi+CRWg663/VTiY0oI+0PkgK8YBVyE0L NuFnaG2IpzEX9efGsrfDPD5tIhjVm4Y0H8q4wwtI0xMpr4gCW/WGHrO6vgmktXMocxHG r2vHrO/dGCrKwVbYeWOiQfnRzKGxcDlzzSqKWPeKXWXO1gPG9yxZV7hhAfvztlvZ3a21 u3Q6sze6fw8fGtLEgBQ/U5AYg3h0Hr1gYsldAP6creyWCu1GlCU4IfqqkzlkKlNOmnQe DVEhXJfppvFgskM8GyxQNdS6rxf8ntkQzrTkkGRMbVt330ShEQaupJIXOBZAM6ChqFsj Dn3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b="dRqaK/wy"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n11si8869311eda.390.2020.12.13.09.05.41; Sun, 13 Dec 2020 09:06:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b="dRqaK/wy"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405334AbgLLUta (ORCPT + 99 others); Sat, 12 Dec 2020 15:49:30 -0500 Received: from so254-31.mailgun.net ([198.61.254.31]:42394 "EHLO so254-31.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726348AbgLLUta (ORCPT ); Sat, 12 Dec 2020 15:49:30 -0500 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1607806146; h=Message-Id: Date: Subject: Cc: To: From: Sender; bh=/AJJdvvgcxzEk2iIh8Q9OM+WIMHQvzRBydUe39VSYsA=; b=dRqaK/wyr3fgLOP6hgoDrF8e+UAC6/DqhThvEzMZ6B1hZda/tZtRubf+roPzNW8QloHSmygc 5DPTLxMFCjmh6db0vxXKfrtKKXzq1CNGUSXcAnvv6MAW5dpGOqOgVhMQpSKeQfaY0f7T6EdP Xv6mo3Q2Rc3JO2WNsf6/vmz1wuc= X-Mailgun-Sending-Ip: 198.61.254.31 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n10.prod.us-east-1.postgun.com with SMTP id 5fd52c8f35a25d1b164a9460 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Sat, 12 Dec 2020 20:48:15 GMT Sender: rishabhb=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id BB760C43461; Sat, 12 Dec 2020 20:48:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=ALL_TRUSTED,BAYES_00,SPF_FAIL, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from rishabhb-linux.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: rishabhb) by smtp.codeaurora.org (Postfix) with ESMTPSA id 89FC3C433C6; Sat, 12 Dec 2020 20:48:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 89FC3C433C6 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=rishabhb@codeaurora.org From: Rishabh Bhatnagar To: linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org Cc: tsoni@codeaurora.org, bjorn.andersson@linaro.org, psodagud@codeaurora.org, sidgup@codeaurora.org, Rishabh Bhatnagar Subject: [PATCH] remoteproc: Create a separate workqueue for recovery tasks Date: Sat, 12 Dec 2020 12:48:07 -0800 Message-Id: <1607806087-27244-1-git-send-email-rishabhb@codeaurora.org> X-Mailer: git-send-email 2.7.4 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Create an unbound high priority workqueue for recovery tasks. Recovery time is an important parameter for a subsystem and there might be situations where multiple subsystems crash around the same time. Scheduling into an unbound workqueue increases parallelization and avoids time impact. Also creating a high priority workqueue will utilize separate worker threads with higher nice values than normal ones. Signed-off-by: Rishabh Bhatnagar --- drivers/remoteproc/remoteproc_core.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index 46c2937..8fd8166 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -48,6 +48,8 @@ static DEFINE_MUTEX(rproc_list_mutex); static LIST_HEAD(rproc_list); static struct notifier_block rproc_panic_nb; +static struct workqueue_struct *rproc_wq; + typedef int (*rproc_handle_resource_t)(struct rproc *rproc, void *, int offset, int avail); @@ -2475,7 +2477,7 @@ void rproc_report_crash(struct rproc *rproc, enum rproc_crash_type type) rproc->name, rproc_crash_to_string(type)); /* create a new task to handle the error */ - schedule_work(&rproc->crash_handler); + queue_work(rproc_wq, &rproc->crash_handler); } EXPORT_SYMBOL(rproc_report_crash); @@ -2520,6 +2522,10 @@ static void __exit rproc_exit_panic(void) static int __init remoteproc_init(void) { + rproc_wq = alloc_workqueue("rproc_wq", WQ_UNBOUND | WQ_HIGHPRI, 0); + if (!rproc_wq) + return -ENOMEM; + rproc_init_sysfs(); rproc_init_debugfs(); rproc_init_cdev(); @@ -2536,6 +2542,7 @@ static void __exit remoteproc_exit(void) rproc_exit_panic(); rproc_exit_debugfs(); rproc_exit_sysfs(); + destroy_workqueue(rproc_wq); } module_exit(remoteproc_exit); -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project