From patchwork Fri Mar 24 19:22:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaying Liang X-Patchwork-Id: 9643905 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 E827E601E9 for ; Fri, 24 Mar 2017 19:31:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D318727F07 for ; Fri, 24 Mar 2017 19:31:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C74CF27F17; Fri, 24 Mar 2017 19:31:23 +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 5474127D16 for ; Fri, 24 Mar 2017 19:31:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S967061AbdCXTbG (ORCPT ); Fri, 24 Mar 2017 15:31:06 -0400 Received: from mail-cys01nam02on0071.outbound.protection.outlook.com ([104.47.37.71]:32512 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S967083AbdCXTaQ (ORCPT ); Fri, 24 Mar 2017 15:30:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector1-xilinx-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=CLzo8lL5sAkZ+jIlE/ugl6CVM/zd8kuwqcz8q6//xsQ=; b=fI8c0mjacKxZleJGf2NuKI4K70NNDztWGw/cayjbVGfMAmfgAuKFmu+KPfM+XrmbLfn5BAqG7JfLs/SNzfJEdBcV8ldj0SDm+T5tfQOu+Yj0XOwOjxG3Y/atH8TdadLiYL2e9zHjGbHckQ2sbskJQg7OOjQyZWt5zsOlgK2PZgs= Received: from BLUPR0201CA0019.namprd02.prod.outlook.com (10.163.116.29) by BY2PR0201MB0759.namprd02.prod.outlook.com (10.160.125.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.961.17; Fri, 24 Mar 2017 19:30:02 +0000 Received: from BL2NAM02FT014.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e46::209) by BLUPR0201CA0019.outlook.office365.com (2a01:111:e400:52e7::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.991.14 via Frontend Transport; Fri, 24 Mar 2017 19:30:01 +0000 Authentication-Results: spf=pass (sender IP is 149.199.60.100) smtp.mailfrom=xilinx.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=bestguesspass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.60.100 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.100; helo=xsj-pvapsmtpgw02; Received: from xsj-pvapsmtpgw02 (149.199.60.100) by BL2NAM02FT014.mail.protection.outlook.com (10.152.76.154) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.977.7 via Frontend Transport; Fri, 24 Mar 2017 19:30:01 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66]:55461 helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw02 with esmtp (Exim 4.63) (envelope-from ) id 1crUuM-0002av-LJ; Fri, 24 Mar 2017 12:29:58 -0700 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1crUuM-0002mW-Go; Fri, 24 Mar 2017 12:29:58 -0700 Received: from xsj-pvapsmtp01 (smtp.xilinx.com [149.199.38.66]) by xsj-smtp-dlp2.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id v2OJTqG1022980; Fri, 24 Mar 2017 12:29:52 -0700 Received: from [172.19.2.167] (helo=xsjjliang50.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1crUuG-0002jg-6S; Fri, 24 Mar 2017 12:29:52 -0700 From: Wendy Liang To: CC: , , "Wendy Liang" , Wendy Liang , Michal Simek Subject: [RFC LINUX PATCH 18/19] remoteproc: shutdown: set state to OFFLINE after stopping remote Date: Fri, 24 Mar 2017 12:22:34 -0700 Message-ID: <1490383355-23176-19-git-send-email-jliang@xilinx.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1490383355-23176-1-git-send-email-jliang@xilinx.com> References: <1490383355-23176-1-git-send-email-jliang@xilinx.com> X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.1.0.1062-22962.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:149.199.60.100; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(39860400002)(39850400002)(39450400003)(39410400002)(39840400002)(2980300002)(438002)(189002)(199003)(9170700003)(33646002)(50226002)(2906002)(9786002)(81166006)(36756003)(48376002)(6666003)(5660300001)(54906002)(36386004)(77096006)(2950100002)(189998001)(6916009)(47776003)(305945005)(356003)(4326008)(38730400002)(5003940100001)(110136004)(107886003)(8676002)(8936002)(50466002)(106466001)(2351001)(50986999)(76176999)(107986001)(217873001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR0201MB0759; H:xsj-pvapsmtpgw02; FPR:; SPF:Pass; MLV:sfv; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2NAM02FT014; 1:SURsS0vDrn1oMdrwiuRM726/SWtFw+id5h0BVHaS3kzB+vqbnULJas5pC41fliTJwMv9s9qG6NYpOSzzSXKim5U5ptnAv3lLTgGndRhCHRJT8s23w0u9gjZdUuZ66HO++3W2T35OI7FWocbByTCCqbH/FJYVaQsvWvh+NKpKLt+PK71Gscuz1MSylZIvawEb28ntpTf1PeweinXxvO9bibYB1Opu2PBeg8rl2RCGpEz3p+JH+D0B1w7lnZSP59ZLbOte+Sy5LaMKBhYsTQFOBopbmzR/McB3Z+xAk5RI1E+X1ovxufvK89qRq93oLHqc0W5yTWslq0dxQT5GsGf2UjII4sk32R55pU5hD+E1sYYNV+6lkPMQlUELPEc6CZd09WwZvn5kR5Opo5dUobIUhOq5V13bKVSjJVRwnv02oljw440seqITEp9gWWi8ERhm6HL7F1SCE/6t2zLRiI3Uv9bOYlQFN0woF5vEy9s21QPW796aY8fXEeIFz3sOiZQH4j4LOTMz10P49gmIdBHT+6QpQL6G+SJ10UGWDYf/yA4S9jyjqBF0lthLtXIdG41Q0dOzEXosgC2uuXyhYkRB9g== MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: c3d3dd72-4614-402e-9969-08d472ec2a38 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(8251501002)(2017030254075); SRVR:BY2PR0201MB0759; X-Microsoft-Exchange-Diagnostics: 1; BY2PR0201MB0759; 3:nxo3eP6ZL9dUzPirBFS3XnfTcbwrdZsXWLZ8ZivXOU14faPwICp7zutokw4WAx3Dh+mKFT/J57E/WW4j2XCe0C1X3ylOk55uugEddzYHu8x7jTNElcVQy1CRFNjVjyoeQKXX3NttDT22cunobXmn4M9WKY1w5ysntPdFxB72tGw4IKlYjg8DLux/uXJq1lIH+iI0p83BL/rw0RClEtWEdfhK9agevhbR1hJFjOHAh/9I53YARWVXJGqatr4+ihmnS4Ceru7HxQyguMZH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n8wD/0CpaoV5uTX6RBamMJe+yBxwgvdKhIg5F0Y1+KVkBM7XFKemOlwVEqBOGL/jjgdahHVLZCactniNsEqFdha3BTmChm+tpw1k5ENkMNe/mBvhFWjwX+DOoRFk6u5X6480dXnZVsoWwnLPSsWK+bUSmRoUO4ZPrCL/ufPIk+1+yTgRpt8iE7o/coU1Cbth4gMK5ZhmdAKf017FkKRNXWeBeRuBCUWJhPz/5YuxJWb4ig7CQzl5ynpoG1XRS5YlUzYaIEgu2eedkcsO33t9IC7l9NaDbcx9kI3a+nohs3u0x9XrUL43ur0jlMb32+IPMDQQqtG2nbGakgvvJMpmEwfwA96i05pVPWkKuBFnxQuUTI07n1mCe8SHOFLJzDWh0y3B9YwwD7umPSr7hds1A0dEwim/JY1nheH1+8WxNttpviL X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(192813158149592); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(13017025)(13023025)(13018025)(13024025)(5005006)(13015025)(8121501046)(10201501046)(3002001)(6055026)(6041248)(20161123562025)(20161123564025)(20161123555025)(20161123558025)(20161123560025)(6072148); SRVR:BY2PR0201MB0759; BCL:0; PCL:0; RULEID:; SRVR:BY2PR0201MB0759; X-Microsoft-Exchange-Diagnostics: 1; BY2PR0201MB0759; 4:SaF5/85WetA4CIuQpxTy55iKvZQHv79Z+NpbO6rTe4Uhb7ua4JqJLB4pUA5idfrpEB8qecNW58OUKyU12Bml+m5xs3z10mc77AuO7kH0N1fAsMRZ0qCin63gN0iatnEDRJR9wd+n+zdceqlB5DRxUN/YCXC93BM8cUUM9Ku4hF2H/4Uh2wGBDPYz/W/oQXN8v/INM6SJOi8dj4a91nLg1tcG8vg8tpTha+/6Wte02GlFlYMo0fITjOiBUzF4H8oXigIuDDcx2ZGgp6dbxyHvduGdRYvombjUV8aW2IZNGLBsNDAHUgiprubPrv5I3mD9bOQIBv4ZCqRZgta/ZuOH/ujQ47z/D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EWxxzSnLJhvxOfz2+tdPCvx83GjrfWbgx4js9p6KqaIBP84PRLwDr2FrCoV9zDUTomeQryRQQhMWLsoo2SqGM8noKxUcxY5KMZF5m0TSIbyhcBwnHTvgGLZfrN3MO29SS8jJjInnSdO43hMbUqNXXUUDd79qhM=; 5:nDXCGgT1UC3MUVwmavXrY6hs7yQ9LDEXGl706bewsIdhp627VTKPgo1yjpB/4dEcU5eKFUfD5ZQe2SgYIHNqkMO0M7PGpA+vuyqEG6KCo+m3SZ75AkJg61KxBv6uJi8b7yu+vzFSQbyK98INV8ZzyQ==; 24:XniIZO1E9bQw70y/li/ZB4W0iG6TsRpHopTqFvCXf6wYTMqdtyBX/KKh5+KlPt1uS+XPJL/5TaE6b1Gz740xV2GK0wLex0l1MCpubHShsiQ= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY2PR0201MB0759; 7:KTR2Sbf/HSbzfGDUi7kMYIB393dekAEUtpbDC0C4XQSuzmzi5AyZ6+1PMkOeA+IpUvlHVLdx05rkI5XJnjLjARq27vXTHnGQaUVtKshNT3v1kSE+w1JhlUp6Q4+EUVzto3zvkEBJcKy7jO6gNTPOFCOBR5aMkSXa6BDmvN8vuj3mVvWvWOIuQOGOXd71JcrfaEE5qVzie7JHirY3spobyfxb8rfRlM7j817HN3vKkSplv2AaF2daPXbI12JMHHMG7LeDKJVkCSXbxabGrLr0Ijnjjmv9j4ck4yEOHIBYutq3WuwtbO4po1Lt4stL6k5t0IXQz4dAZX/6VcdCpLrmHw== X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Mar 2017 19:30:01.0408 (UTC) X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.60.100]; Helo=[xsj-pvapsmtpgw02] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR0201MB0759 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 From: Wendy Liang Set rproc state to OFFLINE right after it stops the remote. Some remoteproc virtio operations depends on rproc state. And thus, we should set the rproc state to OFFLINE right after it stops the remote. Signed-off-by: Wendy Liang Signed-off-by: Michal Simek --- drivers/remoteproc/remoteproc_core.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index ffd1de2..62c0356 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -1369,6 +1369,7 @@ void rproc_shutdown(struct rproc *rproc) { struct device *dev = &rproc->dev; int ret; + int pre_rproc_state; ret = mutex_lock_interruptible(&rproc->lock); if (ret) { @@ -1391,6 +1392,9 @@ void rproc_shutdown(struct rproc *rproc) goto out; } + pre_rproc_state = rproc->state; + rproc->state = RPROC_OFFLINE; + /* clean up all acquired resources */ rproc_resource_cleanup(rproc); @@ -1402,11 +1406,9 @@ void rproc_shutdown(struct rproc *rproc) rproc->table_ptr = NULL; /* if in crash state, unlock crash handler */ - if (rproc->state == RPROC_CRASHED) + if (pre_rproc_state == RPROC_CRASHED) complete_all(&rproc->crash_comp); - rproc->state = RPROC_OFFLINE; - dev_info(dev, "stopped remote processor %s\n", rproc->name); out: