From mboxrd@z Thu Jan 1 00:00:00 1970 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 00AAEC433EF for ; Mon, 28 Feb 2022 14:47:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7B2A28D0002; Mon, 28 Feb 2022 09:47:17 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 762248D0001; Mon, 28 Feb 2022 09:47:17 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 650AD8D0002; Mon, 28 Feb 2022 09:47:17 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.26]) by kanga.kvack.org (Postfix) with ESMTP id 57AFC8D0001 for ; Mon, 28 Feb 2022 09:47:17 -0500 (EST) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay11.hostedemail.com (Postfix) with ESMTP id 1588580ADE for ; Mon, 28 Feb 2022 14:47:17 +0000 (UTC) X-FDA: 79192466514.06.E974EA4 Received: from mail-lj1-f169.google.com (mail-lj1-f169.google.com [209.85.208.169]) by imf07.hostedemail.com (Postfix) with ESMTP id 723AF4000C for ; Mon, 28 Feb 2022 14:47:16 +0000 (UTC) Received: by mail-lj1-f169.google.com with SMTP id r20so17760057ljj.1 for ; Mon, 28 Feb 2022 06:47:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=+T4HBXFbynYzp9NCIHMJxk+jY5JAUB+Pkhx9FGv2/08=; b=lZjS13JhrhbO4VVZDtKqTtLaPCWbfw7wRO/xBPdNDF85YyQ4JA/3Z8MeM1lFDhb/E6 GtfYHsiScz+AzwtC57GP090qGWvSnxiVQ77bZzMOqeXpwAS6SHMvfBJqhe7dPtJD0oXJ fupofbK/ftYf4OcK3RRcO+pTxKSOXVx74pqVKLQA09+0m1SXKcGYW75rtwekLtaGfHeT zSIjuXnWlqsNlZsVTBR0AEuXFUbBvVY6jubrHQelNoowV3rN9RR5FpeetMBgePrzfyIK q2rwpSizmQi1k0iBVp8qGksn+XMNw25A+Gc+xdyazMnnFaECUO8K+xz61PQMzLECg+oe LQOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=+T4HBXFbynYzp9NCIHMJxk+jY5JAUB+Pkhx9FGv2/08=; b=bNFH6naQVghO480Ab+xvDCzl6qdNNaYEZgIu42QKeLY1UtstKzkwZ9XpefWNZS6jkn NnTXF25feAVssBwgZe/aOM34+VB0UBO3ANExckIbfpXeMF3v6yXl9mX2z16y2IDnqp53 yJI/xQAzEme7FGIA2+j9gKcnPcSXwmCWQlpRHY2DYfr4spzBnfOjtOjjPJao1RZ2Xbc5 PUnOQt9gTABYjuZWK43jJMu9m6Trqjy2u5/RTtlgtb7ndbOHxP3Na+7xzEvajqXdAALy xhd0uT7qZfA4rTjMXhuZkxBpEZGFq9OCkdtFT9dZJ69s6wl96R+s7uYxB+9Tzl+LDyAM NrPA== X-Gm-Message-State: AOAM531QtJABsI+Rsw9Wg1+GRPVGx1uufK6U0UMgTXZTF/6OGdokAONv EgQC3Le2QFIPJuxO3kquoqvWip75PQk= X-Google-Smtp-Source: ABdhPJwmgYezxw2Ilwq5McE9oPdFNgJgf2yg1jrhcPuqjkMZMzM+aCO7rbw47ZY2Ao5f+88ka04U5g== X-Received: by 2002:a2e:9b54:0:b0:246:3b89:83e with SMTP id o20-20020a2e9b54000000b002463b89083emr13968319ljj.489.1646059634624; Mon, 28 Feb 2022 06:47:14 -0800 (PST) Received: from elysium.toya.net.pl (staticline-31-183-165-244.toya.net.pl. [31.183.165.244]) by smtp.gmail.com with ESMTPSA id r14-20020ac252ae000000b00443f3cbc03asm993996lfm.6.2022.02.28.06.47.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Feb 2022 06:47:14 -0800 (PST) From: Karolina Drobnik To: linux-mm@kvack.org Cc: rppt@kernel.org, akpm@linux-foundation.org, linux-kernel@vger.kernel.org, Karolina Drobnik Subject: [PATCH 0/9] Add tests for memblock allocation functions Date: Mon, 28 Feb 2022 15:46:42 +0100 Message-Id: X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 723AF4000C X-Stat-Signature: xofw5wuwxayd9wa59tzmwtjdfyr987be Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=lZjS13Jh; spf=pass (imf07.hostedemail.com: domain of karolinadrobnik@gmail.com designates 209.85.208.169 as permitted sender) smtp.mailfrom=karolinadrobnik@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspam-User: X-HE-Tag: 1646059636-483551 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Patches are on top of memblock/for-next. This series adds test coverage for memblock allocation functions that return virtual addresses: * memblock_alloc * memblock_alloc_try_nid * memblock_alloc_from These tests are a part of memblock simulator, a user space test suite that uses the actual memblock code[1]. All the tests are run as one, monolithic test, that exercises both basic operations and allocation functions of memblock. To simplify implementation of the memory allocation tests, reset_memblock() was split into two functions - reset_memblock_attributes() and reset_memblock_regions(). The former sets default values for region array names, allocation direction flag (bottom_up) and current memory limit. The latter only resets region arrays and corresponding counters. In addition to these, the patch set introduces a data structure that simulates physical memory, test_memory. It is a simple wrapper around a pointer to the memory block allocated via malloc(), which is added to memblock as available memory. This is required because the tested functions interact with the memory before allocating it. Patchset structure: * Patch 1 splits reset_memblock() into two functions - reset_memblock_regions() and reset_memblock_attributes(), and updates basic API tests to use the new definitions * Patch 2 adds test_memory struct and functions to add (or release) dummy physical memory * Patches 3 - 8 add test cases for memblock_alloc, memblock_alloc_try_nid and memblock_alloc_from for both allocation directions (default top down and bottom up) * Patch 9 adds README and TODO files [1] https://lore.kernel.org/linux-mm/cover.1643796665.git.karolinadrobnik@gmail.com/ Karolina Drobnik (9): memblock tests: Split up reset_memblock function memblock tests: Add simulation of physical memory memblock tests: Add memblock_alloc tests for top down memblock tests: Add memblock_alloc tests for bottom up memblock tests: Add memblock_alloc_from tests for top down memblock tests: Add memblock_alloc_from tests for bottom up memblock tests: Add memblock_alloc_try_nid tests for top down memblock tests: Add memblock_alloc_try_nid tests for bottom up memblock tests: Add TODO and README files tools/testing/memblock/Makefile | 3 +- tools/testing/memblock/README | 114 ++ tools/testing/memblock/TODO | 28 + tools/testing/memblock/main.c | 7 + tools/testing/memblock/tests/alloc_api.c | 742 +++++++++++ tools/testing/memblock/tests/alloc_api.h | 9 + .../memblock/tests/alloc_helpers_api.c | 393 ++++++ .../memblock/tests/alloc_helpers_api.h | 9 + tools/testing/memblock/tests/alloc_nid_api.c | 1167 +++++++++++++++++ tools/testing/memblock/tests/alloc_nid_api.h | 9 + tools/testing/memblock/tests/basic_api.c | 49 +- tools/testing/memblock/tests/basic_api.h | 1 - tools/testing/memblock/tests/common.c | 33 +- tools/testing/memblock/tests/common.h | 21 +- 14 files changed, 2550 insertions(+), 35 deletions(-) create mode 100644 tools/testing/memblock/README create mode 100644 tools/testing/memblock/TODO create mode 100644 tools/testing/memblock/tests/alloc_api.c create mode 100644 tools/testing/memblock/tests/alloc_api.h create mode 100644 tools/testing/memblock/tests/alloc_helpers_api.c create mode 100644 tools/testing/memblock/tests/alloc_helpers_api.h create mode 100644 tools/testing/memblock/tests/alloc_nid_api.c create mode 100644 tools/testing/memblock/tests/alloc_nid_api.h base-commit: f30b002ccfee8c60c8feb590e145c0b5e8fa4c67 -- 2.30.2