From patchwork Wed Dec 7 01:04:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 86939 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp78089qgi; Tue, 6 Dec 2016 17:04:54 -0800 (PST) X-Received: by 10.84.168.129 with SMTP id f1mr143365312plb.42.1481072694186; Tue, 06 Dec 2016 17:04:54 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a28si21589306pfl.157.2016.12.06.17.04.53; Tue, 06 Dec 2016 17:04:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752767AbcLGBEv (ORCPT + 25 others); Tue, 6 Dec 2016 20:04:51 -0500 Received: from mail-pg0-f51.google.com ([74.125.83.51]:35288 "EHLO mail-pg0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752492AbcLGBEt (ORCPT ); Tue, 6 Dec 2016 20:04:49 -0500 Received: by mail-pg0-f51.google.com with SMTP id p66so155194092pga.2 for ; Tue, 06 Dec 2016 17:04:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=9zuBd72h/Qwh49fFkTkwj7xL1w1kDIBE9Ya+ENtcJEo=; b=W+UWxebr/nVPdCCIFc4gcmQXi3KPkcXbjp+JYfxFCOjaN8d6ak3e8njVqtu5k7NK1w nT57AXxwCwIgoNV2/h6n9DbUvJQP5KgjiU5CDs17h7wZ+/knZ4pcmPam+egneH4Fm4c9 KEzYTD7DUhSlLNvICjR89zFhd2at6PFq8CgLU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=9zuBd72h/Qwh49fFkTkwj7xL1w1kDIBE9Ya+ENtcJEo=; b=Vjmz41cTLRX5L66+abW2jQ8mLYrEhSYPD5hSY2ccTYk4xoWeVpDFi/XXHA08uDID6u mJcIZO7qW/4zfes/BxSkewMB9Sbwya4g1kSnAaCioux08Mi2FIw4CA6IsQudLesYUTvX e3XOyJQXeOXFYa3YaAaM4tBz4leEZpt3Qf9hb25vyuIsFHnACdM756mmETSz9Zhi5ueg 2gYfni1sQjIill8ku5oPMYWfqRJV1B0PFpFKLj6EDNH5VMrp5kbnNxZddl5qpgTCtaNf MNTbLJqR5NEOAzQGMOE4rCRHUR3FluaSxQtETEb+TzBXzImTJYfnWZvc6HVbR7FcaFrV 5BgQ== X-Gm-Message-State: AKaTC01pTj6Schcp5OHWH/l/Vb3eP9f5HvTTtpVFhHACvo3g+gKVOGhmoWwDshNwXMfzbiua X-Received: by 10.84.216.10 with SMTP id m10mr141708706pli.131.1481072688574; Tue, 06 Dec 2016 17:04:48 -0800 (PST) Received: from localhost.localdomain (ip68-111-223-48.sd.sd.cox.net. [68.111.223.48]) by smtp.gmail.com with ESMTPSA id i76sm37383270pfk.89.2016.12.06.17.04.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 06 Dec 2016 17:04:47 -0800 (PST) From: Bjorn Andersson To: Ohad Ben-Cohen , Bjorn Andersson Cc: linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, Sarangdhar Joshi Subject: [PATCH] remoteproc: Drop wait in __rproc_boot() Date: Tue, 6 Dec 2016 17:04:45 -0800 Message-Id: <1481072685-2888-1-git-send-email-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.5.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In the event that rproc_boot() is called before the firmware loaded completion has been flagged it will wait with the mutex held, obstructing the request_firmware_nowait() callback from completing the wait. As rproc_fw_config_virtio() has been reduced to only triggering auto-boot there is no longer a reason for waiting in rproc_boot(), so drop this. Cc: Sarangdhar Joshi Signed-off-by: Bjorn Andersson --- A separate patch should be written that drops firmware_loading_complete, but this requires handling the case where rproc_del() is called before request_firmware_nowait() finishes. drivers/remoteproc/remoteproc_core.c | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) -- 2.5.0 diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index f0f6ec1ab12b..953ee29bcab3 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -972,7 +972,7 @@ static void rproc_fw_config_virtio(const struct firmware *fw, void *context) /* if rproc is marked always-on, request it to boot */ if (rproc->auto_boot) - rproc_boot_nowait(rproc); + rproc_boot(rproc); release_firmware(fw); /* allow rproc_del() contexts, if any, to proceed */ @@ -1070,7 +1070,6 @@ static void rproc_crash_handler_work(struct work_struct *work) /** * __rproc_boot() - boot a remote processor * @rproc: handle of a remote processor - * @wait: wait for rproc registration completion * * Boot a remote processor (i.e. load its firmware, power it on, ...). * @@ -1079,7 +1078,7 @@ static void rproc_crash_handler_work(struct work_struct *work) * * Returns 0 on success, and an appropriate error value otherwise. */ -static int __rproc_boot(struct rproc *rproc, bool wait) +static int __rproc_boot(struct rproc *rproc) { const struct firmware *firmware_p; struct device *dev; @@ -1113,10 +1112,6 @@ static int __rproc_boot(struct rproc *rproc, bool wait) goto downref_rproc; } - /* if rproc virtio is not yet configured, wait */ - if (wait) - wait_for_completion(&rproc->firmware_loading_complete); - ret = rproc_fw_boot(rproc, firmware_p); release_firmware(firmware_p); @@ -1135,22 +1130,11 @@ static int __rproc_boot(struct rproc *rproc, bool wait) */ int rproc_boot(struct rproc *rproc) { - return __rproc_boot(rproc, true); + return __rproc_boot(rproc); } EXPORT_SYMBOL(rproc_boot); /** - * rproc_boot_nowait() - boot a remote processor - * @rproc: handle of a remote processor - * - * Same as rproc_boot() but don't wait for rproc registration completion - */ -int rproc_boot_nowait(struct rproc *rproc) -{ - return __rproc_boot(rproc, false); -} - -/** * rproc_shutdown() - power off the remote processor * @rproc: the remote processor *