From patchwork Fri Oct 5 00:26:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Zhoujie Wu X-Patchwork-Id: 10627093 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 563FB13BB for ; Fri, 5 Oct 2018 00:24:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3C23229309 for ; Fri, 5 Oct 2018 00:24:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2F3BF2930F; Fri, 5 Oct 2018 00:24: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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 B93A629309 for ; Fri, 5 Oct 2018 00:24:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726674AbeJEHUY (ORCPT ); Fri, 5 Oct 2018 03:20:24 -0400 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174]:47430 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726073AbeJEHUX (ORCPT ); Fri, 5 Oct 2018 03:20:23 -0400 Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w950KJvN019499; Thu, 4 Oct 2018 17:24:12 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=pfpt0818; bh=Amb2cR+NKeXghKpmOXYeyIEpZkvdr477CCvDrJXim7E=; b=ju9OsxXREFaLsmOgmgpCsKnCF/538IwcHdr1cMLsCr8IpxCu1YTPuDk/8bTW21w6HQLS Lo4/pahEGVhvol3koqvJ8u0KYw2pR2BGGb6nXBN7C//fXS2NfQSUC7d/xWhM+n3QHF7V 9xSIjGo91zNAKBDQKWaaxuSeYSpy6bxQazqKDfr7YQhd/3B2ftR1DcyARcw2N0K3DpxB 4oJlgfUqgke9z9EJtuoQ3PvaUPWfmljSGvpV/D/X3Mjy4SvbNaEvRMiAQyeDZZgWI6Av 1qxG0M17bcFpM2zYdInAQ3JdSsrZsCaLR45RRzsrcv7AVvKT3iOvQU2eePvjLni263hG +A== Received: from sc-exch04.marvell.com ([199.233.58.184]) by mx0a-0016f401.pphosted.com with ESMTP id 2mt6rktkje-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 04 Oct 2018 17:24:12 -0700 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Thu, 4 Oct 2018 17:24:11 -0700 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server id 15.0.1210.3 via Frontend Transport; Thu, 4 Oct 2018 17:24:11 -0700 Received: from an-git01.marvell.com (unknown [10.80.127.149]) by maili.marvell.com (Postfix) with ESMTP id 64F6E3F703F; Thu, 4 Oct 2018 17:24:11 -0700 (PDT) From: Zhoujie Wu To: , CC: , Zhoujie Wu Subject: [PATCH] lightnvm: consider max hw sectors supported for max_write_pgs Date: Thu, 4 Oct 2018 17:26:30 -0700 Message-ID: <1538699190-4857-1-git-send-email-zjwu@marvell.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-10-04_10:,, signatures=0 X-Proofpoint-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1810050002 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When do GC, the number of read/write sectors are determined by max_write_pgs(see gc_rq preparation in pblk_gc_line_prepare_ws). Due to max_write_pgs doesn't consider max hw sectors supported by nvme controller(128K), which leads to GC tries to read 64 * 4K in one command, and see below error caused by pblk_bio_map_addr in function pblk_submit_read_gc. [ 2923.005376] pblk: could not add page to bio [ 2923.005377] pblk: could not allocate GC bio (18446744073709551604) Signed-off-by: Zhoujie Wu Reviewed-by: Javier González --- drivers/lightnvm/pblk-init.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/lightnvm/pblk-init.c b/drivers/lightnvm/pblk-init.c index e357388..2e51875 100644 --- a/drivers/lightnvm/pblk-init.c +++ b/drivers/lightnvm/pblk-init.c @@ -393,6 +393,7 @@ static int pblk_core_init(struct pblk *pblk) struct nvm_tgt_dev *dev = pblk->dev; struct nvm_geo *geo = &dev->geo; int ret, max_write_ppas; + struct request_queue *bqueue = dev->q; atomic64_set(&pblk->user_wa, 0); atomic64_set(&pblk->pad_wa, 0); @@ -407,6 +408,9 @@ static int pblk_core_init(struct pblk *pblk) pblk->min_write_pgs = geo->ws_opt; max_write_ppas = pblk->min_write_pgs * geo->all_luns; pblk->max_write_pgs = min_t(int, max_write_ppas, NVM_MAX_VLBA); + /* consider the max hw sector as well */ + pblk->max_write_pgs = min_t(int, pblk->max_write_pgs, + queue_max_hw_sectors(bqueue) / (geo->csecs >> 9)); pblk_set_sec_per_write(pblk, pblk->min_write_pgs); pblk->pad_dist = kcalloc(pblk->min_write_pgs - 1, sizeof(atomic64_t),