From patchwork Sun Aug 14 05:53:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rebecca Mckeever X-Patchwork-Id: 12942842 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 28447C25B06 for ; Sun, 14 Aug 2022 05:54:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9DCF38E0002; Sun, 14 Aug 2022 01:54:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 98CB58E0001; Sun, 14 Aug 2022 01:54:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8549F8E0002; Sun, 14 Aug 2022 01:54:07 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 75D4F8E0001 for ; Sun, 14 Aug 2022 01:54:07 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 3DE42401EB for ; Sun, 14 Aug 2022 05:54:07 +0000 (UTC) X-FDA: 79797132534.29.07E1A63 Received: from mail-il1-f196.google.com (mail-il1-f196.google.com [209.85.166.196]) by imf23.hostedemail.com (Postfix) with ESMTP id CE602140080 for ; Sun, 14 Aug 2022 05:54:06 +0000 (UTC) Received: by mail-il1-f196.google.com with SMTP id t15so2483500ilm.7 for ; Sat, 13 Aug 2022 22:54:06 -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=wrwi8GtN3fRrxIdUVrrGXPLLd97vwIWrzt605IFHiZ0=; b=CidX2evztA+2QPN7xMHAJkFi153/lxk5gnNOlt8Zx3pFVGgFCbg2WkETuP+L2cp7lj y22+Hxql5H09NY4BB7t5lEF2516X4DXVJNT3n1u6PJnzEhLJjkG4CBYAm3peTZZh7ONM I6LQBslmqqMPXXQQIXqQFD/JUrMSeh3DOJdG5WJ9ARTNL2NERVffdV+h4Q8GD8XfakbM 3NIkCEP9dMtWllA+a7hYkMcawytEfrE2u8NDG8f6AW2Herm0QFWBL0tU9W4HNKt1CRnP e66BRuWpkaUm8kMnMEQQr5hfvIYovXVvfGwFdWETbUFfLioNCRgXaNW9jTml/iAB6vNf YQpQ== 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=wrwi8GtN3fRrxIdUVrrGXPLLd97vwIWrzt605IFHiZ0=; b=I3mBr/dsl91VNAQnyMCrpUYh6QwSfUI80qLWFDt/MMvdIltUrX7utG300+vWfv2KWl xIzayYc7bZPSA2pyvVastotuC4pdesXDm6tZxeqcrNFJGBTX2cpLB1Bl8lhH+wphXXUp GdAE58f8jW3X/URMGHnUrzFieZ70KUtYHXdpdGx+AUSQY02JHMya8D6CgfR36b/wH0/V IreYjkgCXMhPSsiOiWHh4XHPhqP3gxg7jutmYXTWD56ynxmSOVDGbTE4jvsHDJSW8r1I NNfUTTsL8Z0cwSqQa0itiUqAlO5LTimpPVdb8/Am8Pq/AZsk4ZNQq+VJZtsrm2Zl4BhA y50Q== X-Gm-Message-State: ACgBeo2NfuFBE6unQpqTkz1jcXQBAUK0V6aCiuDVGF2Digm6U6d8mTlz 83T0jkLdQjMKiPdOIa/SApI= X-Google-Smtp-Source: AA6agR4BPV1jtYapGpFrcvgoh8EnpXG1nJmPptQtTObKU/KoXaQEHVkuXzC8fMkCSkHZUq/TcNfDOQ== X-Received: by 2002:a05:6e02:1b0e:b0:2df:67ee:beaf with SMTP id i14-20020a056e021b0e00b002df67eebeafmr4793237ilv.239.1660456446135; Sat, 13 Aug 2022 22:54:06 -0700 (PDT) Received: from sophie (static-198-54-128-70.cust.tzulo.com. [198.54.128.70]) by smtp.gmail.com with ESMTPSA id n44-20020a02716c000000b0034358669334sm1780815jaf.87.2022.08.13.22.54.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Aug 2022 22:54:05 -0700 (PDT) From: Rebecca Mckeever To: Mike Rapoport , linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: David Hildenbrand , Rebecca Mckeever Subject: [PATCH 0/8] memblock tests: update and extend memblock simulator Date: Sun, 14 Aug 2022 00:53:52 -0500 Message-Id: X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1660456446; a=rsa-sha256; cv=none; b=ymQoAr2QXyZ5S2fabLW/SCwHU0oPXgE2R+cOR2Jzih8v/dRfyD8AT8UinJO0gN8dES0YL3 idKJ9LaLL6MI7V0UkiBvzfyBVNLIoBw2HiL4rDWmdJFncsUlt9/mAUBn9XnNZxFChfHYW6 L7w9rxtAIi6jU9RVj3WGXrhj49oZ40Y= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=CidX2evz; spf=pass (imf23.hostedemail.com: domain of remckee0@gmail.com designates 209.85.166.196 as permitted sender) smtp.mailfrom=remckee0@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1660456446; 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=wrwi8GtN3fRrxIdUVrrGXPLLd97vwIWrzt605IFHiZ0=; b=SZJsc+rMlWzakgHAdMWU+8xMw7rky/iyYmZwBNvXUfsIcp4oP7k6sySk31Jodhz2nAg0HU Ev15w4I3Wcf8g6WTRVqn3lpigRq2IMLKHR/AvptYg9rBOu2JAg0rysQ62Ikl5j89/DYmWm sFXuxJF6zzNXtj1Wrx6j3q6hIdKv/w0= X-Stat-Signature: n6gie4fbas9kywuuu565pxpw9c4fz3pw X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: CE602140080 Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=CidX2evz; spf=pass (imf23.hostedemail.com: domain of remckee0@gmail.com designates 209.85.166.196 as permitted sender) smtp.mailfrom=remckee0@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspam-User: X-HE-Tag: 1660456446-876366 X-Bogosity: Ham, tests=bogofilter, spamicity=0.036803, 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. Tests that don't call setup_memblock() call fill_memblock() directly. 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 patchset 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. 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 | 184 ++++- .../memblock/tests/alloc_helpers_api.c | 20 +- tools/testing/memblock/tests/alloc_nid_api.c | 268 +++--- tools/testing/memblock/tests/basic_api.c | 773 +++++++++++++++++- tools/testing/memblock/tests/common.c | 7 + tools/testing/memblock/tests/common.h | 46 ++ 6 files changed, 1108 insertions(+), 190 deletions(-)