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: 9463691 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5FAFB60459 for ; Wed, 7 Dec 2016 01:04:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0DFB6284EE for ; Wed, 7 Dec 2016 01:04:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 003A1284FA; Wed, 7 Dec 2016 01:04:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6B90A284EE for ; Wed, 7 Dec 2016 01:04:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752657AbcLGBEu (ORCPT ); Tue, 6 Dec 2016 20:04:50 -0500 Received: from mail-pg0-f47.google.com ([74.125.83.47]:33096 "EHLO mail-pg0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751689AbcLGBEt (ORCPT ); Tue, 6 Dec 2016 20:04:49 -0500 Received: by mail-pg0-f47.google.com with SMTP id 3so155213404pgd.0 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=htVMb4yaxugmSbRJloT/41ZKBtL3cFywHwk+4WbLacz0IcNX4lyWx5Yt6ox7ZmyuKJ 8eJqciGmKDpvFobOvtwBAuPoT++OrfH/zc4v+mIahCJTsYPlVbULiZYyZhE4DNhgn4p+ ZKbakhBQZIwwkLshXFxyGuR4v6NcnGxuq5vgjOVjwzk1YEzPVORf/HFTzU4S1LhZy5LO VInVHgl1f2rrGNDFoBehe6+zuQ65BmRumjMkrBCHdHDSCT0QehvOagro8zUal4V6YOGX ipvPycmX9xnNJ34ZUkMuOowPg8ZxrDn7H4mhCqmxOd6cX2iYYoMk0bwF6gP/p4HdeCfz QSaw== X-Gm-Message-State: AKaTC03eWYpXlUqG+Ydbn9Pu2J4yeKPN7IcU78JDh80++iGANmeyqbtF9u6G3HDhfn3DYtE3 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-remoteproc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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(-) 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 *