From patchwork Mon Feb 1 14:15:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sreekanth Reddy X-Patchwork-Id: 374925 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,MIME_NO_TEXT, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E8C97C433DB for ; Mon, 1 Feb 2021 14:13:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A9C8964EA2 for ; Mon, 1 Feb 2021 14:13:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232324AbhBAONJ (ORCPT ); Mon, 1 Feb 2021 09:13:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231284AbhBAONI (ORCPT ); Mon, 1 Feb 2021 09:13:08 -0500 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C2B0C061573 for ; Mon, 1 Feb 2021 06:12:28 -0800 (PST) Received: by mail-pj1-x1031.google.com with SMTP id a20so10375578pjs.1 for ; Mon, 01 Feb 2021 06:12:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:mime-version; bh=8t/6W30CCVQ/nNMtpdYz5AiGKHXoaDJZSnjHthbtS6U=; b=QOjolRufHwJTAuK439OWLp2lWSsw3L4zeqIeAclUNWDUBdBUyu/n/B5edhNz4I8AtS lcDBINkw4njeL3x30KWGffGB7TaMwtmIkqbJ9x4jmxI2CytUc51VXKJmC3T9VpSvu5QF TzC8A+Du1It+W0aR1DgFLeW/7TKuvnNS2Ruoc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version; bh=8t/6W30CCVQ/nNMtpdYz5AiGKHXoaDJZSnjHthbtS6U=; b=TBefzOhrLQl3fGFqUbJROJujHBoC9viSOCY4M2dj3nukGf7UpU3LJBTI8k3JJwFlrj RhwpxokhllnP6H0LGjGB/0QXtRidML0OthRA0Gm/p3SZmRnYy/+d95tAmPZyNRDh5/kH PsVzFNSGP25Hc6JnwIBsQK9pXAMIbrgz93siG+DPozh3d/Cr7PmKPpXmQ3KrUu/Eyorp fI3Igxymd/yXHsH6soIm7OphVJKVm6rrlUEEUlo0RhQd8zWVyOJDJOzW1RsEVtC3qenq LnCmqkgmQM1nT3fPaJcoktq8pshC20hDE+ItrYZuCfEuK1k+7Kgg7d5LnCsr0TDQ+gbB pe9A== X-Gm-Message-State: AOAM530Mn/cbiR8mNq4A73yRbYOJNJL3Lwzd8Vu30naTlF0HuV54gkmC Gd6BJiZZ2LM8LcT+RkUFJVrDAc8YNZdE6Jon X-Google-Smtp-Source: ABdhPJytYytO2A+gQ0xyABGeADR3Yj8q9E2YMn54q0wlHfrTOvvIfj9/z09pTHxv27rJ9FHgi3CNAA== X-Received: by 2002:a17:90a:d258:: with SMTP id o24mr17971082pjw.231.1612188747483; Mon, 01 Feb 2021 06:12:27 -0800 (PST) Received: from dhcp-10-123-20-36.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id 83sm17995849pfb.68.2021.02.01.06.12.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Feb 2021 06:12:25 -0800 (PST) From: Sreekanth Reddy To: martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, sathya.prakash@broadcom.com, suganath-prabu.subramani@broadcom.com, Sreekanth Reddy Subject: [PATCH] mpt3sas: fix ReplyPostFree pool allocation Date: Mon, 1 Feb 2021 19:45:22 +0530 Message-Id: <20210201141522.25363-1-sreekanth.reddy@broadcom.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Currently driver allocate memory for ReplyPostFree queues in chunks of 16 ReplyPostFree queue count. On less resource environment such as VM with 1GB and two CPUs, memory allocation for ReplyPostFree pools may fail, since driver tries to allocate a memory for 16 ReplyPostFree queue count even though the actual number of ReplyPostFree queue used is two. Now, the driver will allocate memory for only the actual number of ReplyPostFree queues instead for 16 queues if the ReplyPostFree queue count is less than 16. Signed-off-by: Sreekanth Reddy --- drivers/scsi/mpt3sas/mpt3sas_base.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c index f5582c8..e2455b9 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_base.c +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c @@ -5641,7 +5641,8 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) reply_post_free_sz = ioc->reply_post_queue_depth * sizeof(Mpi2DefaultReplyDescriptor_t); rdpq_sz = reply_post_free_sz * RDPQ_MAX_INDEX_IN_ONE_CHUNK; - if (_base_is_controller_msix_enabled(ioc) && !ioc->rdpq_array_enable) + if ((_base_is_controller_msix_enabled(ioc) && !ioc->rdpq_array_enable) + || (ioc->reply_queue_count < RDPQ_MAX_INDEX_IN_ONE_CHUNK)) rdpq_sz = reply_post_free_sz * ioc->reply_queue_count; ret = base_alloc_rdpq_dma_pool(ioc, rdpq_sz); if (ret == -EAGAIN) {