From patchwork Mon Oct 24 11:31:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10168 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp640566wru; Mon, 24 Oct 2022 13:32:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4K+qNyrw52Kqa4tKMQrDNYseEqf+CGY66NZpVUcv50MDFnOzf7R038TkGEMKZdwGPnar8t X-Received: by 2002:a63:2f45:0:b0:457:dc63:68b4 with SMTP id v66-20020a632f45000000b00457dc6368b4mr29495669pgv.228.1666643577440; Mon, 24 Oct 2022 13:32:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666643577; cv=none; d=google.com; s=arc-20160816; b=nDWSGSLBbJyd3nTleSNshhQ1jHsmvylCjoh2avPa9xO666Mi8EAP3eZueSOaS+dK4d qh8HDFDBQ5ku4MG5MqWN4fbtX4Mo8Fg4B1j5NCIsibiWtcLPxolW+WzNiHE3GwR4hsxj lkAkiJfkD8lDoSEhxx4fG065AywtCR/lnSd1vrytWqpF+DmEhJuJdeI7ZNqEyPh+eq6t lzODnjIOunDowU1tgOwVksh4CIu8cWL76fq0ZmvA3LPMnXqPFVlOclRHppUSMIETlF6M C49NWQcTRY1CzdoUZXrytVLcYkBlMsX1LprzkncIABNZmFl1XYcPGNsViPpqyqYhlIBp k7PA== 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=wLkwuhFx7CMSJJkMHARhztI0/VVVJyqMyvmnXJg6+FDGUPkF70DkhhrjstU2mw7evH I8OqxnjBGJU0S+hCm01Wd9HrcP9bNFFj19qhQyoHAm+4ouwABpz0Zav5VJ4CaXczCcny hDSJ2OZLgQqsfcHMnkXb+B7p+SPdZV3W6B/47rQmlqlgMAtFqRHD6ouxVds4JWMaBSGJ NTrY6Vk3cuS9KywFkRWVPNqtzCqeHMpl2f+4LXctRFwGl9kaetC23bNDhv7B5lWGgM00 GTz/F0bPaTadPq7tfzzpXLADxIR33ca7DDs8mmLUTChAwthEzWz1+uHt2X7Jsn661Ct9 dtyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GIhWzstZ; 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 lk3-20020a17090b33c300b00212e70e2c25si11117399pjb.165.2022.10.24.13.32.44; Mon, 24 Oct 2022 13:32:57 -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=GIhWzstZ; 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 S234226AbiJXUWk (ORCPT + 99 others); Mon, 24 Oct 2022 16:22:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232593AbiJXUVy (ORCPT ); Mon, 24 Oct 2022 16:21:54 -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 46E8C19DD95; Mon, 24 Oct 2022 11:38:05 -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 191A9B815F9; Mon, 24 Oct 2022 12:12:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67E28C4314C; Mon, 24 Oct 2022 12:12:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613552; bh=LFrupX4v25cr6gY6G5bOu9JuHOtT4txHADScSlAhRDE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GIhWzstZB1KP93D6n2+Q8HN6EQH6frplJWSJIj/Yae2pjCHZ1/cstel/Ns9KAZL82 e33SCoAWPfw9EuLogflZ3qwaxR+wXD+7qx2Q/a/JvxK4MUsYb8Uf82SHSFZDGXrxi1 sIOLCkBPN172qc9LYPGoJNmjSf7PlNl6BBCyefoI= 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.4 180/255] crypto: ccp - Release dma channels before dmaengine unrgister Date: Mon, 24 Oct 2022 13:31:30 +0200 Message-Id: <20221024113008.851338831@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@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?1747602456173972477?= X-GMAIL-MSGID: =?utf-8?q?1747602456173972477?= 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);