Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp2602569lqz; Wed, 3 Apr 2024 03:09:37 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUY3rri095OehYSqrANuObFUAUsvc3wUaFPlFh5vcJdBrjdlmTmYWR29CAA+utbAw8EUQYRKwT4iJZeFNy6Q4fcmY0BYxh3svSyw6W/kg== X-Google-Smtp-Source: AGHT+IFqfxu7tYBoUmSTFYjif+e50sZ9XZZ/pPyLiJ3hSDOUNc1chPQLf5EQ0GBDpV+4MJLu5k6+ X-Received: by 2002:a17:906:cecc:b0:a4e:3f52:6588 with SMTP id si12-20020a170906cecc00b00a4e3f526588mr1466111ejb.41.1712138977065; Wed, 03 Apr 2024 03:09:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712138977; cv=pass; d=google.com; s=arc-20160816; b=cjURdzp6BPEqBmW3a8TGPAp+BCf5vOWqY1qJrDeR0JZprlYpCwESoM0TdLHeMTXNGk GE2qRX/m68y4QOlHjOlW+aZ/LNzyC98Em1r0Rchx1xn/JD2YLJ/kRBWynMj7aaTWK+nJ jqqviJ1soDYelhLSJBa1b4TNMudSCgLFCowqq/kThnmldNKWzo7dJ1NoyCL3nYFnGvwF g0pGxvAKwow5umfdQLnwQACKO7WRTmmE+MMgypZvV9qpiUr0R7uIPoYGjodo9gWHGDH0 X3SklxEjo/rDzSnXF3dfDrisA7l0l30EOwbuqwoOPH3UMrfHB42CiQK3AHQAInZKHzoH MSmA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=juzHClGeyLqMHjFrv0Zehppjuyvdo2TIjzoaBDKesDs=; fh=VzMToBYo5MUfLaQO74C2Chjt/otG4r80qnd7ynZ/RBQ=; b=FpWFYyv90l4JJkrR5+NAV1YELFlhfodGuBS748zl8gC2CKfkc2uvwZfougNYrFgaV0 5/SQR+sU4QrhoBwP/fIqvu521U0WI/ZRtgpI34x1vBgUv+619JXzpOSmIo+M437aChYh dTKq6feAZ3ET7rMSKqO/OMzzJOs2YjHVE24H+GiZMHPGMHb4ycRLkEOpNDXMdPtU+lEB yFLn3LD8QWmRxhxgcZMuJ6YvWN4lZhwZydjJ6kN5e08KsRbjwy/KiCFYl7EIkERQEs5w QTm9Q5/HfWN6JrFvTzROJqDaFR58AgHVFm1tha4AvfFvoHb16U5SeFWMMMiHKey2PN/M YcEg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-crypto+bounces-3298-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-crypto+bounces-3298-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id k22-20020a1709065fd600b00a4dffd58150si6662127ejv.914.2024.04.03.03.09.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 03:09:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto+bounces-3298-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-crypto+bounces-3298-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-crypto+bounces-3298-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id DCB971F2956E for ; Wed, 3 Apr 2024 10:08:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8571813AA38; Wed, 3 Apr 2024 10:05:55 +0000 (UTC) X-Original-To: linux-crypto@vger.kernel.org Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BBE8513666C; Wed, 3 Apr 2024 10:05:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.188 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712138755; cv=none; b=q749H9rnIGQClnA9djefcE2umHrZZsW0styM1G1An0gtWPdx12P94yU8/1C46AY3smY5q0Ub2A4oXxxeQe1gvDrvDe2guUfH+bJeYXrcL/kuPeDlrBBVFP/Jpo2NeDFtArxwaQPRbOXxzd/MXcW6joRsxY+9bOqT2GQrfPbLWTo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712138755; c=relaxed/simple; bh=6juDJaoMe0wdCGTDP0uluhcWqVlklCQTZZ0GR81b9kU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=uv2Cfwzu/TvUmws6aQC1/IevLgCZSyxTF8uUaPWQGumQp6kq9vz/290Gqm0u8tUaaVfpKZYydwNsFRYYUoQsv4etFbMJCaLxWeztchABJhqjYFYWI/t8512SXy4kgc+Ii4b6IH/DmE9KKhbmVYscC2IcfPNrUDjeTiAH971Treo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.188 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.174]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4V8gKM1lP5zXkcR; Wed, 3 Apr 2024 18:02:31 +0800 (CST) Received: from dggpemd200003.china.huawei.com (unknown [7.185.36.122]) by mail.maildlp.com (Postfix) with ESMTPS id DA9B6140F81; Wed, 3 Apr 2024 18:05:28 +0800 (CST) Received: from localhost.localdomain (10.67.165.2) by dggpemd200003.china.huawei.com (7.185.36.122) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.28; Wed, 3 Apr 2024 18:05:28 +0800 From: Chenghai Huang To: , CC: , , , , , , , , , , , Subject: [PATCH 8/9] crypto: hisilicon/debugfs - Resolve the problem of applying for redundant space in sq dump Date: Wed, 3 Apr 2024 18:01:01 +0800 Message-ID: <20240403100102.2735306-9-huangchenghai2@huawei.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20240403100102.2735306-1-huangchenghai2@huawei.com> References: <20240403100102.2735306-1-huangchenghai2@huawei.com> Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpemd200003.china.huawei.com (7.185.36.122) When dumping SQ, only the corresponding ID's SQE needs to be dumped, and there is no need to apply for the entire SQE memory. This is because excessive dump operations can lead to memory resource waste. Therefor apply for the space corresponding to sqe_id separately to avoid space waste. Signed-off-by: Chenghai Huang --- drivers/crypto/hisilicon/debugfs.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/crypto/hisilicon/debugfs.c b/drivers/crypto/hisilicon/debugfs.c index e9fa42381242..8e259ed4aecd 100644 --- a/drivers/crypto/hisilicon/debugfs.c +++ b/drivers/crypto/hisilicon/debugfs.c @@ -320,17 +320,16 @@ static int qm_sq_dump(struct hisi_qm *qm, char *s, char *name) if (ret) return ret; - sqe = kzalloc(qm->sqe_size * sq_depth, GFP_KERNEL); + sqe = kzalloc(qm->sqe_size, GFP_KERNEL); if (!sqe) return -ENOMEM; qp = &qm->qp_array[qp_id]; - memcpy(sqe, qp->sqe, qm->sqe_size * sq_depth); - sqe_curr = sqe + (u32)(sqe_id * qm->sqe_size); - memset(sqe_curr + qm->debug.sqe_mask_offset, QM_SQE_ADDR_MASK, + memcpy(sqe, qp->sqe + sqe_id * qm->sqe_size, qm->sqe_size); + memset(sqe + qm->debug.sqe_mask_offset, QM_SQE_ADDR_MASK, qm->debug.sqe_mask_len); - dump_show(qm, sqe_curr, qm->sqe_size, name); + dump_show(qm, sqe, qm->sqe_size, name); kfree(sqe); -- 2.30.0