From patchwork Thu Apr 17 07:22:43 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandr Moshkov X-Patchwork-Id: 14055017 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) (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 01FD3C369C7 for ; Thu, 17 Apr 2025 07:24:21 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1u5JaV-0005Z8-CU; Thu, 17 Apr 2025 03:23:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1u5JaT-0005Yq-Ek for qemu-devel@nongnu.org; Thu, 17 Apr 2025 03:23:05 -0400 Received: from forwardcorp1a.mail.yandex.net ([178.154.239.72]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1u5JaP-0000KR-Vs for qemu-devel@nongnu.org; Thu, 17 Apr 2025 03:23:04 -0400 Received: from mail-nwsmtp-smtp-corp-main-83.vla.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-83.vla.yp-c.yandex.net [IPv6:2a02:6b8:c15:2b89:0:640:9815:0]) by forwardcorp1a.mail.yandex.net (Yandex) with ESMTPS id 8B82660BA5; Thu, 17 Apr 2025 10:22:54 +0300 (MSK) Received: from dtalexundeer-nx.yandex-team.ru (unknown [2a02:6b8:b081:b4a7::1:15]) by mail-nwsmtp-smtp-corp-main-83.vla.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id mMDENE2FXmI0-QU85yTm0; Thu, 17 Apr 2025 10:22:53 +0300 Precedence: bulk X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1744874573; bh=6vkcrufMD9Fan0ZZ7J+fwJE90F7HwL5Ni7txLgFp6/k=; h=Message-Id:Date:Cc:Subject:To:From; b=chxLdQUIHPt8VPx6aW1Jca/wcAieb9IsSmlg8M4UWGm5pkMyv0L8glb+WgOhlKMyh 7E/VQ9wZts6yXOpXCiljHY1qd5W9uiKbVJVkDC7K406h238KgDLCeyvIHyY2GYcKp5 8Xzli23fNqcHIxGo2qqots9jho7VPMAnKgRAFgy0= Authentication-Results: mail-nwsmtp-smtp-corp-main-83.vla.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Alexandr Moshkov To: qemu-devel@nongnu.org Cc: Cleber Rosa , "yc-core @ yandex-team . ru" , Paolo Bonzini , =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= , Alexandr Moshkov Subject: [PATCH v4 0/2] tests/functional: add memlock tests Date: Thu, 17 Apr 2025 12:22:43 +0500 Message-Id: <20250417072244.147510-1-dtalexundeer@yandex-team.ru> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Received-SPF: pass client-ip=178.154.239.72; envelope-from=dtalexundeer@yandex-team.ru; helo=forwardcorp1a.mail.yandex.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Add new tests to check the correctness of the `-overcommit memlock` option (possible values: off, on, on-fault) by using `/proc/{qemu_pid}/smaps` file to check in Size, Rss and Locked fields of anonymous segments: * if `memlock=off`, then Locked = 0 on every anonymous smaps; * if `memlock=on`, then Size, Rss and Locked values must be equal for every anon smaps where Rss is not 0; * if `memlock=on-fault`, then Rss and Locked must be equal on every anon smaps and anonymous segment with Rss < Size must exists. --- v3 -> v4: * add skipLockedMemoryTest decorator to skip test if system's locked memory limit is below the required threashold; * add to MemlockTest skipLockedMemoryTest decorator with 2 GB limit. v2 -> v3: Move tests to tests/functional dir, as the tests/avocado dir is being phased out. v2 was [PATCH v2] tests/avocado: add memlock tests. Supersedes: <20250414075702.9248-1-dtalexundeer@yandex-team.ru> v1 -> v2: In the previous send, i forgot to specify new patch version (v2) So i resend previous patch with version specified. Alexandr Moshkov (2): tests/functional: add skipLockedMemoryTest decorator tests/functional: add memlock tests tests/functional/meson.build | 1 + tests/functional/qemu_test/__init__.py | 2 +- tests/functional/qemu_test/decorators.py | 19 +++++ tests/functional/test_memlock.py | 102 +++++++++++++++++++++++ 4 files changed, 123 insertions(+), 1 deletion(-) create mode 100644 tests/functional/test_memlock.py