From patchwork Thu Jun 27 02:49:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Le Moal X-Patchwork-Id: 11018673 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 508311708 for ; Thu, 27 Jun 2019 02:49:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 43D6328A1D for ; Thu, 27 Jun 2019 02:49:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2445328A31; Thu, 27 Jun 2019 02:49:14 +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.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable 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 BEC1228A2D for ; Thu, 27 Jun 2019 02:49:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726945AbfF0CtN (ORCPT ); Wed, 26 Jun 2019 22:49:13 -0400 Received: from esa1.hgst.iphmx.com ([68.232.141.245]:34994 "EHLO esa1.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726829AbfF0CtM (ORCPT ); Wed, 26 Jun 2019 22:49:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1561603752; x=1593139752; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=E0hftjpsF+Kau0lGhV8j+bPXbIbWwoKJzrqW74jtxtE=; b=khTcvIHLfMCVLzwG1ee2y1D8Uq36+WdoOKbh9kjpYqcqaQXl3AZF5vqc S4YZyFAFtDIi+WQSLTJ2NE+TwDxC6rS0YV4loqCdGoKldQC+W/kzEJEj+ vI4Av0HMK45vjH+wWwtrDjjDi2fR9CxJyDvsqmd00GZDNP8Oxw1Ux2yEA NTUBDx9mRvQQpZ44wzPmLeJUW78lDBs4k+UR9vxv0+gdhp7a8sIznUDxA PY6hkC50W43BGXmzCoH46CXMlal0kS/xF7R/ZKL96Bt8z83IkK6wTP7YN n404BEDvxoLa4cxG30Q0zhyQZuxNToTm9dmodeLvCxwfkFlZO/0Z1BQoj g==; X-IronPort-AV: E=Sophos;i="5.63,422,1557158400"; d="scan'208";a="218022024" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 27 Jun 2019 10:49:11 +0800 IronPort-SDR: /+A0qUZw4sEPySWSRUGbfX87WlPZL84ApO2CecYTwoPy53Doqnqlc7NNzks2AtUSImz9k5z1oy SIRMWo+QQshFeuqlheFUcrWRMvIjhMJ9GI6RJMFx698Enx27VqoVJupV9GjyXKuoQr9XYVLXKl LUEJtUE1hvRPWF6Xu5Jx9baro5RVnmJ9mdoEM922gChtBfFbxgybwABiR+kvZj0+/anu/anNu/ W4HfueNlo6fHmUjrJi2SOIhT8sIBk20KOF4CI4bz8FXqbjzJNLcsj6KgqXmLgQ0QsdbfmXMiGb 62dQsFADeFhn433hRr/ve+Yp Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP; 26 Jun 2019 19:48:20 -0700 IronPort-SDR: 16n8vWYVWNzHhnxF8f5OkL82zZYTsytQY3GffVNo7kPkI9P2vrwl8nleWo+tUuZbnslJKQEBhY eZNCbJA9uPHBaiSXx+N6NKVp2GRehNJOTBwHysGgj5LMULaCCzXJRfNBCR0tb9x05heqb+O3Bu Y3PrdSTUrosngpkvSTv27TR3hVv1d6Awp9WiykvH2NpQ9CG1OL3/YLejlaRmKmDtfd7RGVG34x ZEszuAmN2mflH+/N8ZndLH31JE9jJ+jJdXgxqi2wY3mHQsH/aiSOLGGcwjkTAZUlfYoY6eQkpe HQA= Received: from washi.fujisawa.hgst.com ([10.149.53.254]) by uls-op-cesaip01.wdc.com with ESMTP; 26 Jun 2019 19:49:11 -0700 From: Damien Le Moal To: linux-scsi@vger.kernel.org, "Martin K . Petersen" , linux-block@vger.kernel.org, Jens Axboe Cc: Christoph Hellwig , Bart Van Assche Subject: [PATCH V4 0/3] Fix zone revalidation memory allocation failures Date: Thu, 27 Jun 2019 11:49:07 +0900 Message-Id: <20190627024910.23987-1-damien.lemoal@wdc.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This series addresses a reccuring problem with zone revalidation failures observed during extensive testing with memory constrained system and device hot-plugging. The problem source is failure to allocate large memory areas with alloc_pages() or kmalloc() in blk_revalidate_disk_zones() to store the disk array of zones (struct blk_zone) or in sd_zbc_report_zones() for the report zones command reply buffer. The solution proposed here is to: 1) limit the number of zones to be reported with a single report zones command execution, and 2) Use vmalloc to allocate large-ish arrays and buffers in place of alloc_pages() or kmalloc(). With these changes, tests do not show any zone revalidation failures while not impacting the time taken for a disk zone inspection during device scan and revalidation. Changes from v3: * Reworked use of flush_kernel_vmap_range() and invalidate_kernel_vmap_range() to contain the calls within bio.c, transparently to the user of bio_map_kern(). * Add similar support to bio_copy_kern(). Changes from v2: * Move invalidate_kernel_vmap_range() of vmalloc-ed buffer to sd_zbc.c in patch 2, after completion of scsi_execute_req(). * In patch 2, add flush_kernel_vmap_range() before scsi_execute_req(). Changes from V1: * Added call to invalidate_kernel_vmap_range() for vmalloc-ed buffers in patch 1. * Fixed patch 2 compilation error with Sparc64 (kbuild robot) Damien Le Moal (3): block: Allow mapping of vmalloc-ed buffers sd_zbc: Fix report zones buffer allocation block: Limit zone array allocation size block/bio.c | 43 +++++++++++++++++++++- block/blk-zoned.c | 29 +++++++-------- drivers/scsi/sd_zbc.c | 83 +++++++++++++++++++++++++++++++----------- include/linux/blkdev.h | 5 +++ 4 files changed, 122 insertions(+), 38 deletions(-)