From patchwork Mon Jul 11 12:24:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Chen X-Patchwork-Id: 12913465 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6F148C43334 for ; Mon, 11 Jul 2022 12:29:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=muMd/2RGKUMNWVn3FyTMOMSltDp7W7sg0Iva0t01W2o=; b=Cd62n4H5YQYLvB 4s70smpaR13RxOUbUsiCEM3uWxxv/P0pleLVk/ys882FX2QoDpPXjbpYC4Cs9+xiRT/ogc6fOHqQo 7cEEbngmDJFslCFAt0mlfQAaGNDE3j0UWe2rYOalNyaB6vkuqKKQBX83t1W7I6eCKkOugUSOWHJvL sRq5xUL+/a0PXlaDlb/wnFtSZX3K76IEQRMcQWmy/1FHmKFEGHJDeB6urYSMyU+QuJnYxAIQ+9rIG oJ5jFk4ECtLDhGWjdqMYBmrBl7hzNDWdcykDwc5OlxuWKH4xuVBxsM9J3Y+DFeaddQ+eUjJwqyFiw EkWpK10ZuLbuuimOvHkA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oAsWC-001Pdd-5k; Mon, 11 Jul 2022 12:28:04 +0000 Received: from sender4-op-o14.zoho.com ([136.143.188.14]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oAsW8-001PaJ-L7 for linux-arm-kernel@lists.infradead.org; Mon, 11 Jul 2022 12:28:01 +0000 ARC-Seal: i=1; a=rsa-sha256; t=1657542474; cv=none; d=zohomail.com; s=zohoarc; b=mTYrTnKkEr+cHoZzwUWzoySyMDYwyJHGayRwmV3goFkvb4OBV7RimTOzTY/Lj0PfO9bJNJ3PFdQVj4sAYijZMxmUgZVI+awVdfE82SDlv0iyXWH/UkMb/Q1ARhKlHLdTLsP8gCoOnyRsB/Yb/znNDUaQN040rgBG1qML8nFAB+Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1657542474; h=Content-Transfer-Encoding:Cc:Date:From:MIME-Version:Message-ID:Subject:To; bh=ewN4EUuycObOYW0SLHnXrpbyF2hcjOKmDmqQa9qow+Q=; b=eonyWLjjL3dIAg04CjrercdmL0p9ChaAeFzDHnjHy3ulSUQJe01/0daekqfQsLnJiD63hjiyfsoNvYFf3eRKbF5+RaNIyi84nicZcoFYcBX+zpbZ+Vm96+B0NnsqOEKeHDKUCSTwbiStYUq5IdQ7hi+kkPM14/BVfTSqjNKmdPg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=linux.beauty; spf=pass smtp.mailfrom=me@linux.beauty; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1657542474; s=zmail; d=linux.beauty; i=me@linux.beauty; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-Id:Message-Id:MIME-Version:Content-Transfer-Encoding:Reply-To; bh=ewN4EUuycObOYW0SLHnXrpbyF2hcjOKmDmqQa9qow+Q=; b=O+f//ihUMnagKkZDjAeTqyZlBVXpvNhbaP8ksXbo7DOIOguy4f81+zQbl40Lb4Wm VIs5WyE5xPgp6xVrmMZRnc6Yp7E6hOqqXfSoPdl1u/gSNQUzL0Blf8H3tLbe4YASgLE xezfb81h0A0FGgB/yxIbvk+mZsrjHSXjyMXm2M0o= Received: from sh-lchen.ambarella.net (180.169.129.130 [180.169.129.130]) by mx.zohomail.com with SMTPS id 1657542473449720.3148602247644; Mon, 11 Jul 2022 05:27:53 -0700 (PDT) From: Li Chen To: Catalin Marinas , Will Deacon , Rob Herring , Frank Rowand , Andrew Morton Cc: Li Chen , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 0/4] add struct page and Direct I/O support to reserved memory Date: Mon, 11 Jul 2022 20:24:50 +0800 Message-Id: <20220711122459.13773-1-me@linux.beauty> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 X-ZohoMailClient: External X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220711_052800_784260_9E579CB3 X-CRM114-Status: GOOD ( 12.85 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This patch series use ZONE_DEVICE and mhp to add Direct I/O support to reserved memory when rmem is as dio's src buffer. Our use case is when isp generates frame and writes to given memory region, arm(kernel) will try to read frames from the reserved memory region. If throughput is low, frame loss will be serious. Before this patch series, we can only use bufferd I/O and the throughput is very low even with the help of AIO/io_uring. This patch is tested on v5.15.35 + no-map rmem region, and can be git am into 5.19-rc5 without conflicts. Li Chen (4): of: add struct page support to rmem mm/sparse: skip no-map memblock check when fill_subsection_map arm64: mm: move memblock_clear_nomap after __add_pages sample/reserved_mem: Introduce a sample of struct page and dio support to no-map rmem arch/arm64/mm/mmu.c | 2 +- drivers/of/Kconfig | 9 ++ drivers/of/of_reserved_mem.c | 218 +++++++++++++++++++++++++++++++- include/linux/of_reserved_mem.h | 11 ++ mm/sparse.c | 4 +- samples/Kconfig | 7 + samples/Makefile | 1 + samples/reserved_mem/Makefile | 2 + samples/reserved_mem/rmem_dio.c | 116 +++++++++++++++++ 9 files changed, 367 insertions(+), 3 deletions(-) create mode 100755 samples/reserved_mem/Makefile create mode 100755 samples/reserved_mem/rmem_dio.c