From patchwork Fri Dec 23 00:09:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Hicks X-Patchwork-Id: 636519 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A8C8DC4332F for ; Fri, 23 Dec 2022 00:10:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231484AbiLWAKY (ORCPT ); Thu, 22 Dec 2022 19:10:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231278AbiLWAKV (ORCPT ); Thu, 22 Dec 2022 19:10:21 -0500 Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 062EA2315E; Thu, 22 Dec 2022 16:10:18 -0800 (PST) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 722E55C011A; Thu, 22 Dec 2022 19:10:17 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 22 Dec 2022 19:10:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tyhicks.com; h= cc:cc:content-transfer-encoding:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm1; t=1671754217; x=1671840617; bh=TU q6QLAfgtkzRFmgm+1eHv8sP3D0VwkxRhMPteL5eRU=; b=jQ1Ho8O+fV6KYMif/M xtG8bmIxTiCYGIS2cit8HIiaePY8NDhLhFm3ROhswgkSWEltJcrFGHIVsMxfiBEn Ndu31gu7llLeBgHvGK3nA2XCuQH+wAUUw+3PGv1ihbfJ2LSzLVkjqVmIrzYqqCTy QKCHE4Yw0dr21XME2H+ZaBcP1VbxQvJsF4e02CUPHHg3uqKserLn3wFtAzelAYos sjeE8qpw7cxKjaAkSPXw00ET6xPIjOVVn0HkZNAs/VDXVvRCZkiJtQedbVhKXncC F3Dpj8KCJUX6m+yuuGahL6yhhhfOzAygAh3qhREE1pIxoFKwoKOA9XPFOSc+W36w EDAw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; t=1671754217; x=1671840617; bh=TUq6QLAfgtkzR Fmgm+1eHv8sP3D0VwkxRhMPteL5eRU=; b=vPZeXw+fazvtT5Bn/tw8lVIxb9VCy FUmnCZCig0cx4f1aXy8UkP9c8UozVrBahRFCf4UhoqZ29p4mljFH19Xr5q3n7u4d bKhCy28nWgc+mApB6NkMc1eN9tg73Mr2c/cPwJ8LgT7RA7zL88kzq2yR2zbNwwOB YPwEvMG29QmE4zdvLjKMh2NRjfQRGKy0goRiRVCHjL4JYodytkPh3UbhvWJuWXqx bW/53ESeE/vYe3eQ4BIZMS6Biit/X4NLKWKoCqCQEE//YVIKhvoTUDHyqaPJTIJ6 kxEpe17tizF3ZLMaifyEBk+xgCvWw0PYS/wScYHyUkYaU/Kq4cmel+Srw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrhedugddulecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefvhihlvghr ucfjihgtkhhsuceotghouggvsehthihhihgtkhhsrdgtohhmqeenucggtffrrghtthgvrh hnpefhvddukeefleefffekuedvvdelheevkedugfefgedvfeffudfguedutdefueeujeen ucffohhmrghinhepkhgvrhhnvghlrdhorhhgnecuvehluhhsthgvrhfuihiivgeptdenuc frrghrrghmpehmrghilhhfrhhomheptghouggvsehthihhihgtkhhsrdgtohhm X-ME-Proxy: Feedback-ID: i78e14604:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 22 Dec 2022 19:10:16 -0500 (EST) From: Tyler Hicks To: gregkh@linuxfoundation.org, stable@vger.kernel.org Cc: Karolina Drobnik , Paolo Bonzini , Shuah Khan , kvm@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Gavin Shan , Marc Zyngier , Mike Rapoport , Tyler Hicks Subject: [PATCH 5.15 1/2] tools/include: Add _RET_IP_ and math definitions to kernel.h Date: Thu, 22 Dec 2022 18:09:57 -0600 Message-Id: <20221223000958.729256-2-code@tyhicks.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221223000958.729256-1-code@tyhicks.com> References: <20221223000958.729256-1-code@tyhicks.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org From: Karolina Drobnik commit 5cf67a6051ea2558fd7c3d39c5a808db73073e9d upstream. Add max_t, min_t and clamp functions, together with _RET_IP_ definition, so they can be used in testing. Signed-off-by: Karolina Drobnik Signed-off-by: Mike Rapoport Link: https://lore.kernel.org/r/230fea382cb1e1659cdd52a55201854d38a0a149.1643796665.git.karolinadrobnik@gmail.com [tyhicks: Backport around contextual differences due to the lack of v5.16 commit d6e6a27d960f ("tools: Fix math.h breakage"). That commit fixed a commit that was merged in v5.16-rc1 and, therefore, doesn't need to go back to the stable branches.] Signed-off-by: Tyler Hicks (Microsoft) --- tools/include/linux/kernel.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/include/linux/kernel.h b/tools/include/linux/kernel.h index a7e54a08fb54..c2e109860fbc 100644 --- a/tools/include/linux/kernel.h +++ b/tools/include/linux/kernel.h @@ -14,6 +14,8 @@ #define UINT_MAX (~0U) #endif +#define _RET_IP_ ((unsigned long)__builtin_return_address(0)) + #define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) #define PERF_ALIGN(x, a) __PERF_ALIGN_MASK(x, (typeof(x))(a)-1) @@ -52,6 +54,10 @@ _min1 < _min2 ? _min1 : _min2; }) #endif +#define max_t(type, x, y) max((type)x, (type)y) +#define min_t(type, x, y) min((type)x, (type)y) +#define clamp(val, lo, hi) min((typeof(val))max(val, lo), hi) + #ifndef roundup #define roundup(x, y) ( \ { \ From patchwork Fri Dec 23 00:09:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Hicks X-Patchwork-Id: 636649 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 89195C4332F for ; Fri, 23 Dec 2022 00:10:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235659AbiLWAKf (ORCPT ); Thu, 22 Dec 2022 19:10:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235227AbiLWAKZ (ORCPT ); Thu, 22 Dec 2022 19:10:25 -0500 Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D41B22BF8; Thu, 22 Dec 2022 16:10:22 -0800 (PST) Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 0E2B15C0110; Thu, 22 Dec 2022 19:10:22 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Thu, 22 Dec 2022 19:10:22 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tyhicks.com; h= cc:cc:content-transfer-encoding:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm1; t=1671754222; x=1671840622; bh=on htEckhuX8csdtNozlcaBjqdIEEh4L7+8wYGdwUQtU=; b=OL6SwrpwQEbQ99nqQt sf7U9qkrJc8k9sPOzJaV7bfIxFwfmAE8tn5s8gIGc60Df7D068SXzBcWe5NBc/Gi xo7kv0XBCp1p3zyqvEGsl6AcKf3rmmvFeuXIReMajv9Y5+24gyhw+d8zJJN8b9BX fSqJC+By6q3F/1E7TICQKcOt3KMSpLbxBED1zDCrWzf99nOTYMlCP/zFKUSmFWF6 1NWcflTBXYN6ruNqOJxeOafjf/LcNp9Haso0AeJIr34oqx+d/oZCZAwEqMGuc53E 5RkCqDkoceOvRrvcJMN+qCxSq4PlvaPf5/sZHjCcgTmPuoTn0cik+cuVexQozWn4 x/EA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; t=1671754222; x=1671840622; bh=onhtEckhuX8cs dtNozlcaBjqdIEEh4L7+8wYGdwUQtU=; b=LYLT8OqlbPm6qYtjmIt58QE+u9f59 P8ZL7Z9e3ozdIR+ZfcqpSfawmNTQwEOOMSN1LSaX9VQUqjumQ46pi/IvrKq2SvEK SW4rRY8fP+9pvm085lWNpDlsEY1CPTOjX4aBqvDRlUmAOjz0GMdKRfFEg3DrD2pN 93arsnKNS/LZ4cjGr0xI3wTt/Uxfk9MVmlicyTZAU8FPo0ENO7ObnVqWbUIp84LX sW+Xkgz+fNWMbg/qauQoodlVHvley6McZ4p4K3GqUdD3usZvW+qRf2BNy/mf2zJz Awk3kccMXI9zrRBEj9OqzbXdfNSezDQ5HjjHT6LS8FyDxZmIIOXKhkzDg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrhedugddvtdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefvhihlvghr ucfjihgtkhhsuceotghouggvsehthihhihgtkhhsrdgtohhmqeenucggtffrrghtthgvrh hnpeetfeeikeekieeuieehffeigeetffekhedtteegkeehgefgffevfeegheevtdejheen ucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegtohguvg esthihhhhitghkshdrtghomh X-ME-Proxy: Feedback-ID: i78e14604:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 22 Dec 2022 19:10:20 -0500 (EST) From: Tyler Hicks To: gregkh@linuxfoundation.org, stable@vger.kernel.org Cc: "Tyler Hicks" , Paolo Bonzini , Shuah Khan , kvm@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Gavin Shan , Marc Zyngier , Karolina Drobnik , Mike Rapoport Subject: [PATCH 5.15 2/2] KVM: selftests: Fix build regression by using accessor function Date: Thu, 22 Dec 2022 18:09:58 -0600 Message-Id: <20221223000958.729256-3-code@tyhicks.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221223000958.729256-1-code@tyhicks.com> References: <20221223000958.729256-1-code@tyhicks.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org From: "Tyler Hicks" Fix the stable backport of commit 05c2224d4b04 ("KVM: selftests: Fix number of pages for memory slot in memslot_modification_stress_test"), which caused memslot_modification_stress_test.c build failures due to trying to access private members of struct kvm_vm. v6.0 commit b530eba14c70 ("KVM: selftests: Get rid of kvm_util_internal.h") and some other commits got rid of the accessors and made all of the KVM data structures public. Keep using the accessors in older kernels. There is no corresponding upstream commit for this change. Signed-off-by: Tyler Hicks (Microsoft) --- tools/testing/selftests/kvm/memslot_modification_stress_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/kvm/memslot_modification_stress_test.c b/tools/testing/selftests/kvm/memslot_modification_stress_test.c index 1d806b8ffee2..766c1790df66 100644 --- a/tools/testing/selftests/kvm/memslot_modification_stress_test.c +++ b/tools/testing/selftests/kvm/memslot_modification_stress_test.c @@ -72,7 +72,7 @@ struct memslot_antagonist_args { static void add_remove_memslot(struct kvm_vm *vm, useconds_t delay, uint64_t nr_modifications) { - uint64_t pages = max_t(int, vm->page_size, getpagesize()) / vm->page_size; + uint64_t pages = max_t(int, vm_get_page_size(vm), getpagesize()) / vm_get_page_size(vm); uint64_t gpa; int i;