From patchwork Tue Jun 12 10:30:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Matias Bjorling X-Patchwork-Id: 10459947 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 43D26602A0 for ; Tue, 12 Jun 2018 10:30:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4316D2867F for ; Tue, 12 Jun 2018 10:30:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 37B312863D; Tue, 12 Jun 2018 10:30:42 +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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, 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 3C75D2863D for ; Tue, 12 Jun 2018 10:30:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932711AbeFLKak (ORCPT ); Tue, 12 Jun 2018 06:30:40 -0400 Received: from mail-lf0-f67.google.com ([209.85.215.67]:37097 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754278AbeFLKai (ORCPT ); Tue, 12 Jun 2018 06:30:38 -0400 Received: by mail-lf0-f67.google.com with SMTP id g21-v6so33219846lfb.4 for ; Tue, 12 Jun 2018 03:30:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lightnvm-io.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=seVdsKj0EQqMOF4CwT0aE9lpFmK2oc2WEb1GlFRmp/w=; b=kfvru/5eFh3HH50kPj1Q3ZaJHW0/PUE3dV5WJJ/XbvNqzmJx64N9kM5R6Cx1sjO3Cn RZ5+S432OPanaEwHLfOjnG9R2zz/QRNvPGXppF6VBY4QGvXcckztD3vheSAEhnaviCU5 qCHRzdpcGOIhRVQw2KU7YamR/z8ILcnQeRYR0iGErCrXCdsqc8UMVkhugAbvWinyoKxW W9uxHMaqnE1k5i/T/+sfEXlNObAzVLoGecMoZKtoVKLwQpunTkMF7jCHaG8WXq64nZVD 2U/ChbGpI8s5xtaXP09B91T2xZ7lu6671eKzJCB0Eynd9UIqvoUaYXbdLtzIpvrE4JEX pqNQ== 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 :content-transfer-encoding; bh=seVdsKj0EQqMOF4CwT0aE9lpFmK2oc2WEb1GlFRmp/w=; b=a4E0h0He8qweh/mlsxWJy0iin5FXtzbEA8px9H1t50XNmGb5/FprWVO12EyjhSierN v3WEDTnvRXPjA9oAYmcyG70rhnmovpmWJQKZZV9GLNg9ngImPet1okUnrbl+4RN4JsC9 Mg9Z0/6D5gLrdmV/AEfmxfBEobCunS5VqQ2zbQGjELUxJnDwUE+cjYYTii4VFbR1MJQO jjrRxLXXptRthdZ8xV6+bFtS1cdGXPrZr6K9einZh5GC4zrMafooDaEOeBEqGHaSl49U Op7MSjefyEghePCGNpQmrxr/lsJLQbQ3Ta0Jm1gj+Gc1G8ZsOajNtfEUSDT0Q51P5u1J l6Qg== X-Gm-Message-State: APt69E1nqdQxBg0//1KmnxQwRNQaBXfwK7vF5kldrFJ6Ev+dhzqgGeH1 Uix39LECmcoJg6z+MDFw1l0pYw== X-Google-Smtp-Source: ADUXVKKsNvUn99+ld/27T7eJE+tis6jZ6hHbZ0A/7pC9heWUx51QVgHsPTzFZWuFuK7XhsTv+KqmjA== X-Received: by 2002:a2e:330b:: with SMTP id d11-v6mr1932969ljc.67.1528799437622; Tue, 12 Jun 2018 03:30:37 -0700 (PDT) Received: from Macroninja.cnexlabs.com (95-166-82-66-cable.dk.customer.tdc.net. [95.166.82.66]) by smtp.gmail.com with ESMTPSA id f63-v6sm142211lje.79.2018.06.12.03.30.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Jun 2018 03:30:36 -0700 (PDT) From: =?UTF-8?q?Matias=20Bj=C3=B8rling?= To: igor.j.konopko@intel.com, marcin.dziegielewski@intel.com, javier@cnexlabs.com, hans.holmberg@cnexlabs.com Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, =?UTF-8?q?Matias=20Bj=C3=B8rling?= Subject: [PATCH] lightnvm: pblk: limit get chk meta request size Date: Tue, 12 Jun 2018 12:30:08 +0200 Message-Id: <20180612103008.19436-1-mb@lightnvm.io> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 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 For devices that does not specify a limit on its transfer size, the get_chk_meta command may send down a single I/O retrieving the full chunk metadata table. Resulting in large 2-4MB I/O requests. Instead, split up the I/Os to a maximum of 256KB and issue them separately to improve I/O latency. Signed-off-by: Matias Bjørling Reviewed-by: Javier González --- drivers/nvme/host/lightnvm.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/nvme/host/lightnvm.c b/drivers/nvme/host/lightnvm.c index b9989717418d..3b644b0e9713 100644 --- a/drivers/nvme/host/lightnvm.c +++ b/drivers/nvme/host/lightnvm.c @@ -583,7 +583,13 @@ static int nvme_nvm_get_chk_meta(struct nvm_dev *ndev, struct ppa_addr ppa; size_t left = nchks * sizeof(struct nvme_nvm_chk_meta); size_t log_pos, offset, len; - int ret, i; + int ret, i, max_len; + + /* + * limit requests to maximum 256K to avoid issuing arbitrary large + * requests when the device does not specific a maximum transfer size. + */ + max_len = min_t(unsigned int, ctrl->max_hw_sectors << 9, 256 * 1024); /* Normalize lba address space to obtain log offset */ ppa.ppa = slba; @@ -596,7 +602,7 @@ static int nvme_nvm_get_chk_meta(struct nvm_dev *ndev, offset = log_pos * sizeof(struct nvme_nvm_chk_meta); while (left) { - len = min_t(unsigned int, left, ctrl->max_hw_sectors << 9); + len = min_t(unsigned int, left, max_len); ret = nvme_get_log_ext(ctrl, ns, NVME_NVM_LOG_REPORT_CHUNK, dev_meta, len, offset);