From patchwork Fri Aug 19 08:34:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rebecca Mckeever X-Patchwork-Id: 12948532 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 2B96DC25B0E for ; Fri, 19 Aug 2022 08:37:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 626A68D0003; Fri, 19 Aug 2022 04:37:24 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5D55C8D0001; Fri, 19 Aug 2022 04:37:24 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 49CC38D0003; Fri, 19 Aug 2022 04:37:24 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 3BE528D0001 for ; Fri, 19 Aug 2022 04:37:24 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 0653AAC1CA for ; Fri, 19 Aug 2022 08:37:24 +0000 (UTC) X-FDA: 79815687966.20.992B084 Received: from mail-qk1-f194.google.com (mail-qk1-f194.google.com [209.85.222.194]) by imf26.hostedemail.com (Postfix) with ESMTP id E9D9D14001C for ; Fri, 19 Aug 2022 08:37:22 +0000 (UTC) Received: by mail-qk1-f194.google.com with SMTP id f14so2858827qkm.0 for ; Fri, 19 Aug 2022 01:37:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc; bh=2ovy6cOrAq5hbHsy+zYmpR6YppyOweI7oSxHXbcd+Tw=; b=EX292WCZQn3k56I4UVurdpZlVXNrGus9pO/H54MgD4RjHhGgyDZCGDahZ8JyYgdknx /k0qBNK/1B8kbQsZZaHhgm/oEJ10NC+vsnwhj7sxrFKSMZie1BB9J1ngMqgizqdUKfV+ VDrPkPK6rymo9iga7G22+WRekb/rdAINJYUHjhbe3SZe0PZiBfyg9NPEek1bQasyAxNt H+1TcaNPi8HfSgyGplEePLzjA1jKYdWJ+wn/cJykirJINBTltn6QQX7cibXK/9IPosC/ tpyZ2MU3+iPIIsq2hHcdwTlSWdY1PFfjA4LLKrHCZ2Q49ilhtQbik46ltxrA0TVMKiIp mYKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc; bh=2ovy6cOrAq5hbHsy+zYmpR6YppyOweI7oSxHXbcd+Tw=; b=cLIVrC7xOCNwKTJPWeIa6C649/6wk3sgnITResQxSiWhsFp+O6i4xw+JxbB+4vBfDi w/kVrpwI7H8ZI4Cnd2DKbV7hpIYBtkfqqS4nF/wm7Xt1J3cLD/XTEj2cZOLeOoL8AI1H dIOcFvoo0kTV2IsrUbTx22Gsv9KsV52LpYDfh9hBq7vQ4dP9zkCms4FU5lCtVXi3Z9ve tc+Fro4pl7sNcdqncH6ULx0uAmtxlHNrbO2+niae4LZq9L6e5TKIwnEdj5J6xVmDgxiA awsFtG5R27gFJS7y4O5LojnkrdKkeJB4WHuLJM/ICozDydP2Hj1QkRO9PumYwD7LMvfA rNmg== X-Gm-Message-State: ACgBeo0J708NoLGxg78TjACg6PEblhUrpNXOjldDYLe6gjm73gydufXF 9XTeQ9ggZuWHF6OvtWuUg/c= X-Google-Smtp-Source: AA6agR4i2/flNAUUbOKuONjVpkKw1q/Sspz8B7ZUxzAEVVmgwbOWyHjEphvGVeqpOvrFYezqzZJl3Q== X-Received: by 2002:a05:620a:269a:b0:6b5:b76c:11c9 with SMTP id c26-20020a05620a269a00b006b5b76c11c9mr4585731qkp.100.1660898242746; Fri, 19 Aug 2022 01:37:22 -0700 (PDT) Received: from sophie ([89.46.62.64]) by smtp.gmail.com with ESMTPSA id 66-20020a370945000000b006b8d1914504sm3078750qkj.22.2022.08.19.01.37.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Aug 2022 01:37:22 -0700 (PDT) From: Rebecca Mckeever To: Mike Rapoport , linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: David Hildenbrand , Rebecca Mckeever Subject: [PATCH v2 0/8] memblock tests: update and extend memblock simulator Date: Fri, 19 Aug 2022 01:34:48 -0700 Message-Id: X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1660898243; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=2ovy6cOrAq5hbHsy+zYmpR6YppyOweI7oSxHXbcd+Tw=; b=pcerAXdD61p9rWXFlMiZoR3915+VUdh5jCleHQJig/Kn7tUNO56ODpmj3nq1ukznW4xWvm Y7/sM207Jk0+GfQExbou7SvckfWN93NlwZNHc0yvy+i5GG15Zd7NJK9vrPp+nELxWzhdLi Cx7xiNK/Xj4YxAN1GbREZxJOdxnfkII= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=EX292WCZ; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf26.hostedemail.com: domain of remckee0@gmail.com designates 209.85.222.194 as permitted sender) smtp.mailfrom=remckee0@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1660898243; a=rsa-sha256; cv=none; b=Jsao4cu6/3XCZURLNVF89tINPUQTeFgyGSkLcAh5m8mFjeygwmVIr3xIoSwGO3m+j56NKq wECsNguRIG6Hrtg02L9t3ynIi8oPRXxA2nExad+K1C70Qv6c8w7H3RbJ5tgu1zKFhBN2ek 2Wbr9zOMvyH9hFE+bDiWg+sfciSyfGo= X-Stat-Signature: f4xygzc1tng8ztoh3n14tmr4keoe6rgk X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: E9D9D14001C Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=EX292WCZ; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf26.hostedemail.com: domain of remckee0@gmail.com designates 209.85.222.194 as permitted sender) smtp.mailfrom=remckee0@gmail.com X-Rspam-User: X-HE-Tag: 1660898242-946562 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000064, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: These patches update existing tests in memblock simulator, add additional tests for memblock functions that are already being tested, and add test coverage for additional memblock functions. Updated tests for: - memblock_alloc() - memblock_alloc_try_nid() - memblock_alloc_from() The updates to memblock_alloc() tests include the addition of an assert that checks whether the entire chunk of allocated memory is cleared. For memblock_alloc_try_nid() and memblock_alloc_from(), the assert that checks whether the allocated memory is cleared now checks the entire chunk of allocated memory instead of just the first byte. To make this more robust, setup_memblock() and dummy_physical_memory_init() fill the entire MEM_SIZE simulated physical memory with nonzero values by calling fill_memblock(). setup_memblock() is called at the beginning of most tests for memblock_alloc() functions. Additional tests for: - memblock_add() - memblock_reserve() - memblock_remove() - memblock_free() - memblock_alloc() Introducing test coverage for: - memblock_alloc_raw() - memblock_alloc_try_nid_raw() - memblock_set_bottom_up() - memblock_bottom_up() - memblock_trim_memory() The tests for the memblock_alloc_*raw() functions test both top-down and bottom-up allocation directions. To add coverage for memblock_alloc_raw(), the alloc_api was updated so that it runs through all the existing tests twice: once for memblock_alloc() and once for memblock_alloc_raw(). When the tests run memblock_alloc_raw(), they test that the entire memory region is nonzero instead of testing that it is zero. Similarly, the alloc_nid_api was updated to run through its tests twice: once for memblock_alloc_try_nid() and once for memblock_alloc_try_nid_raw(). When the tests run memblock_alloc_try_nid_raw(), they test that the entire memory region is nonzero instead of testing that it is zero. The patch set also adds labels to verbose output for generic memblock_alloc*() tests that indicate which allocation direction is set. The function names of those tests do not include this information. Reviewed-by: David Hildenbrand Reviewed-by: David Hildenbrand --- Changelog v1 -> v2 Updates based on feedback from Shaoqin Huang: PATCH 1: - tests/alloc_api.c: - Remove fill_memblock() from alloc_no_memory_generic_check(). - tests/common.c, tests/common.h: - Change fill_memblock() to file static. PATCH 3: - Shaoqin Huang and I discussed using run_top_down() and run_bottom_up() even for functions with `top_down` and `bottom_up` in the name to maintain a consistent output style. However, this would make the output more redundant, so no changes were made. PATCH 4: - tests/basic_api.c: - Rename instances of r1_size and r2_size to new_r1_size and new_r2_size. PATCH 6: - tests/alloc_api.c, tests/alloc_nid_api.c, tests/common.h: - Change verify_mem_content() to a common function defined in common.h. PATCH 8: - tests/basic_api.c: - Rename instances of r2_base and r2_size to new_r2_base and new_r2_size. --- Rebecca Mckeever (8): memblock tests: update tests to check if memblock_alloc zeroed memory memblock tests: update zeroed memory check for memblock_alloc_* tests memblock tests: add labels to verbose output for generic alloc tests memblock tests: add additional tests for basic api and memblock_alloc memblock tests: update alloc_api to test memblock_alloc_raw memblock tests: update alloc_nid_api to test memblock_alloc_try_nid_raw memblock tests: add tests for memblock_*bottom_up functions memblock tests: add tests for memblock_trim_memory tools/testing/memblock/tests/alloc_api.c | 175 +++- .../memblock/tests/alloc_helpers_api.c | 20 +- tools/testing/memblock/tests/alloc_nid_api.c | 260 +++--- tools/testing/memblock/tests/basic_api.c | 767 ++++++++++++++++++ tools/testing/memblock/tests/common.c | 7 + tools/testing/memblock/tests/common.h | 53 ++ 6 files changed, 1095 insertions(+), 187 deletions(-)