From patchwork Mon Oct 24 11:31:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9625 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp531817wru; Mon, 24 Oct 2022 09:07:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5+74DrLu77t0aA1DI7XSGX9HECuTaanyF3O1k1NTUTEGjscXLXy9I7mAIDE2BM83gfUTGU X-Received: by 2002:a17:906:9bc3:b0:78d:816f:3743 with SMTP id de3-20020a1709069bc300b0078d816f3743mr28736311ejc.380.1666627624946; Mon, 24 Oct 2022 09:07:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627624; cv=none; d=google.com; s=arc-20160816; b=ONduCPBF03Bz8E2re7GEpq+5MouozgYOU5HO8dVAdiYP89Y2b/qlIDg24Q8hU/GB94 ZT0oTA4QC7iUrx+4xHqIptt/djPQCLmE1loyVR7QNr+HP0sKFyjvco3lW1XsUk7xf7Iv 9Vx7/VPb/Da850WPN9Uibo61suYTkbLxTyanTXpsz+MWx8dtNRnJabSWmWzHbontn/2m +hhr7UUJddcYR4dy/HKNZI22LYv+L1yyDvmUvoCDVlRPcBF6Tjh+xJAaC9gLNqvPTEEh RdjcJk1QNO8IXse2YdJWnz2gVASFVwzVGEFL9p3MPXAWc0DHUqxRffwvMHqeXmT+PGRJ D3vw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=io5qfRANefCYz9sWd9kgRUXqmX1h4Bue7mawuWIr6DE=; b=rv1+GHq/TpyE4AmfjA+cz8hLnAwkI50b+JSKa54We4jWeuJla8IlulCDb1nfLzg0Ms RILmLdbULDhcaZwF/cSnMY/99v16WVzlKOO1N+HH9IILgRAoWB0hRLTU8zut8Ti8UbEM XmJ/Oir6ocU9IMnM5n+iYnK6j0/Cdh1vXmo64s/0Y1YkcJ45wrL7YIvkztRQH8hOJxNs OOohOS+LNwidulEf0vgzLhkC0tivT6qB6HBHJdPzuVnMwmfTm9y2P/NDmcawWrksOZGJ cO8emc9odfxJImklztBkIJmhnON4MQmrCUhd7XEMshR2ExNCdeFNdauFj2j7i/aPiavD Be4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NaMT7sFm; 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=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id rv20-20020a17090710d400b00780a882d337si104578ejb.480.2022.10.24.09.06.36; Mon, 24 Oct 2022 09:07:04 -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=@linuxfoundation.org header.s=korg header.b=NaMT7sFm; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232896AbiJXQGD (ORCPT + 99 others); Mon, 24 Oct 2022 12:06:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232790AbiJXQDY (ORCPT ); Mon, 24 Oct 2022 12:03:24 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7CA21E099B; Mon, 24 Oct 2022 07:56:12 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C4F68B8168A; Mon, 24 Oct 2022 12:28:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2C6C7C433C1; Mon, 24 Oct 2022 12:28:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614481; bh=LFrupX4v25cr6gY6G5bOu9JuHOtT4txHADScSlAhRDE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NaMT7sFmGDIflHR+w2TU4YowiFiYEFqWHYAO7hwlyyzWfoN640UdXcn8SQoHH3zkP zcMyeqZtQ0WxDptQEVE2UK9wIcVISn3ay5eGVvTMIz7Nb7hz019xc6LbglbW5A2cCx AHogY7Os8lmymaURdKocsHA+7gH2hwHneacWfyi0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Koba Ko , Tom Lendacky , Herbert Xu , Sasha Levin Subject: [PATCH 5.10 277/390] crypto: ccp - Release dma channels before dmaengine unrgister Date: Mon, 24 Oct 2022 13:31:14 +0200 Message-Id: <20221024113034.731136500@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585728445587985?= X-GMAIL-MSGID: =?utf-8?q?1747585728445587985?= From: Koba Ko [ Upstream commit 68dbe80f5b510c66c800b9e8055235c5b07e37d1 ] A warning is shown during shutdown, __dma_async_device_channel_unregister called while 2 clients hold a reference WARNING: CPU: 15 PID: 1 at drivers/dma/dmaengine.c:1110 __dma_async_device_channel_unregister+0xb7/0xc0 Call dma_release_channel for occupied channles before dma_async_device_unregister. Fixes: 54cce8ecb925 ("crypto: ccp - ccp_dmaengine_unregister release dma channels") Reported-by: kernel test robot Signed-off-by: Koba Ko Acked-by: Tom Lendacky Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- drivers/crypto/ccp/ccp-dmaengine.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/ccp/ccp-dmaengine.c b/drivers/crypto/ccp/ccp-dmaengine.c index b3eea329f840..b9299defb431 100644 --- a/drivers/crypto/ccp/ccp-dmaengine.c +++ b/drivers/crypto/ccp/ccp-dmaengine.c @@ -642,6 +642,10 @@ static void ccp_dma_release(struct ccp_device *ccp) for (i = 0; i < ccp->cmd_q_count; i++) { chan = ccp->ccp_dma_chan + i; dma_chan = &chan->dma_chan; + + if (dma_chan->client_count) + dma_release_channel(dma_chan); + tasklet_kill(&chan->cleanup_tasklet); list_del_rcu(&dma_chan->device_node); } @@ -767,8 +771,8 @@ void ccp_dmaengine_unregister(struct ccp_device *ccp) if (!dmaengine) return; - dma_async_device_unregister(dma_dev); ccp_dma_release(ccp); + dma_async_device_unregister(dma_dev); kmem_cache_destroy(ccp->dma_desc_cache); kmem_cache_destroy(ccp->dma_cmd_cache);