From patchwork Wed Jun 14 21:18:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 13280453 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 60C70EB64D8 for ; Wed, 14 Jun 2023 21:19:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9F2316B0072; Wed, 14 Jun 2023 17:19:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9A04B6B0078; Wed, 14 Jun 2023 17:19:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 867D48E0002; Wed, 14 Jun 2023 17:19:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 73B5C6B0072 for ; Wed, 14 Jun 2023 17:19:13 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 3400B1A06A9 for ; Wed, 14 Jun 2023 21:19:13 +0000 (UTC) X-FDA: 80902618986.07.CBA73AF Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf26.hostedemail.com (Postfix) with ESMTP id 6C9C914000C for ; Wed, 14 Jun 2023 21:19:09 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="GzJN/pOX"; spf=pass (imf26.hostedemail.com: domain of broonie@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=broonie@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1686777549; 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-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=n+pTHg4rEerI+W3K9o98nuhcQ4X5qOiBJlx3UGdOHkw=; b=tHEq+k2nO889uhb2lfs5rvLuOSe4/t+/S2qsxcmxm/ll0CCei1I/1ryLAfgyQSLOL++ONV J2Be8Mvc0ohiRIvHpaf4QRdzHXwWEsxwIUBfRHpjm8WJ1nC+7Gf2p8RQId8Vx9vK4Ey4V3 A4jghQYJV+tX/aYFmJUvv6pxzFfIpMI= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1686777549; a=rsa-sha256; cv=none; b=hH8nhOVEeTWPoHye255xXsAguzxZEfyC3FXR+r3eTIlagkaadnR7o536F7r/PJy94Ij5Xf QkdoXizFmmS9QHMJ95rbWOQHVBGMZqNDdEQjHk22kOvsrva4HMFEqgh5YPixSdgWFu6Aq2 8hRoh4IWbTixyTVmtDNA2U1IqkJ/m3k= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="GzJN/pOX"; spf=pass (imf26.hostedemail.com: domain of broonie@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=broonie@kernel.org; dmarc=pass (policy=none) header.from=kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 70ADA60DF4; Wed, 14 Jun 2023 21:19:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 268C5C433C8; Wed, 14 Jun 2023 21:19:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686777547; bh=UEhz/kpeox3MvxRfpolw9Y3cKpiMR3f1Bj+mCSrsu+w=; h=From:Date:Subject:To:Cc:From; b=GzJN/pOX0gp/xstmlig24vmyKpwxXIYsnKum50WEILylD4i6NTZFzKYVhffUDxW1Z XfP3kJEiqS+53Z56BzKvRJWl4cEsXDphkVNy+DQNzIwXOwcsHHjnpj3L1guuKBw/hK Nti/cS6HDhwvoFs/OnnPPv1R5aTlFX7llyepiWR9tdJTSxhyAmaw13FMj/V+4t+m12 omVscywuF6a6xs8I2zCR2jW1FVzEqxEHt2YFQtmnSO2O0XYMsJR9ULTbp5It/FMSeI scbeCkf0FRyKN6q71Lilt9y90n4UZqGzYZzM5XUc8GNfEr8dGEUIBk9Ks9ZHFkdoQ8 YTK3QY5/fgFzw== From: Mark Brown Date: Wed, 14 Jun 2023 22:18:58 +0100 Subject: [PATCH] selftests/mm: Fix cross compilation with LLVM MIME-Version: 1.0 Message-Id: <20230614-kselftest-mm-llvm-v1-1-180523f277d3@kernel.org> X-B4-Tracking: v=1; b=H4sIAMIuimQC/x2NQQqDQAwAvyI5N6Db1kK/UnqImtTg7loSsQXx7 117nIFhNnA2ZYd7tYHxqq5zLtCcKuhHyi9GHQpDqMO5bpsLTs5RFvYFU8IY14QUrnQbSIRagdJ 15IydUe7Ho/zMNh36bSz6/a8ez33/AdkJN7h6AAAA To: Andrew Morton , Shuah Khan , Paul Walmsley , Palmer Dabbelt , Albert Ou , Nathan Chancellor , Nick Desaulniers , Tom Rix Cc: linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, llvm@lists.linux.dev, Mark Brown X-Mailer: b4 0.13-dev-c6835 X-Developer-Signature: v=1; a=openpgp-sha256; l=3189; i=broonie@kernel.org; h=from:subject:message-id; bh=UEhz/kpeox3MvxRfpolw9Y3cKpiMR3f1Bj+mCSrsu+w=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBkii7IGttHdFnUF0lmq6L7TPI3idmAEp2wD+7pMnu+ wqAt+VyJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCZIouyAAKCRAk1otyXVSH0OZoCA CB/4e2WEwUuvnxjdo+IKA2oPKHQrf9LrGE8Bum4qjdJu1TWsTJNE2T1qrdmYPXAQZFQYlmViy7AeDT l21o4NRfo4DZmLv6rx3O49Lq+orAst4ATm/P3+uFGOH08jBnhGTAULa/4edYKGQO/xVq3BKr8zSyBn 2at4XPXbnZzWMqx/LUDYTS699PrfTxw3ZA1q78EnuQMxxhn+RYZdESgpPYMs7kd6wkGE+d5ZUJbJqL ku8wS2yMyX66n13s89P4L824wzcEDcenfJDGTyiQyh3xBP1kueox5NrVPUwAT63but7/Wz82WcRQGZ DGUl9W9QiMMHEckJYUrVY6fLz5cnkt X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB X-Rspamd-Queue-Id: 6C9C914000C X-Rspam-User: X-Stat-Signature: mxhue5m419b5btiwykz73qqghaucdm4a X-Rspamd-Server: rspam03 X-HE-Tag: 1686777549-507053 X-HE-Meta: U2FsdGVkX1/iqsR18DwDdI0SnFUxhDR4dLS870qcySUbIrvx/hNnaQ0Q8wafJX8BDJ0fd//t+le8117eJp+kCwqjWf711ohjpavbfEPSd3w46oJ3uKhMYEU/pxyGigyMBPa6Bc9ftzaVH0DsBIYrioCxS2qd6pKRPF217phG6mmqr2B6wdkPL/SnD4RnvDPAUdger1hYXnPn8Qd0V4njhsgiLV3thAD0bSxDzU+z4Hu1ZhGYKcGy/osEMI5DO7h6Mjp9DHWL3y5ZpQTwQnq95t/ivXIT6fr3Z8a0msDMzxw+SzzkbyJehuVUmWzwdv4ArDCbMxv87j2QbdiGtsCS6HM3n702/IDxhjncAfQOhpxDAc56lyYLi5bed5uBAYgLgPyoufX2OcJs+QJdOduXw2icD8AUkEnaELV/YKZqVtwy/Z6n5sivRdWdUbRruMRfwtjRgN0+pnx7Dt/UWZ+g5SLZ4PnQL4fDdprJNer/CpjSmM9IqLUZau6aZmXOzuYti7rn9q+XUf7M+y/ohXz/snoQ6WSiMlG/pB6eeCKl2KEF5C8jjnxwtqf731NjyK8DHoO4bwfU6BOzS+UgNRPH20RgVFDKiwG8e8hofg/ndafE5waMa+ZWeo3AoaIb+lbT+6vtrD4ib9lUD0JpFz//YRixxQNmaQI/9W/FZj59oD9/8o2XBLyK3b9+WOSUEfmJCIbk3eZsruePvweSpLhbxRi9+TG+Ypf+c+tEkOX5FeOXUs/Fc6zTI9AWvlrcsWOezNGuPVXrcNbTuku14YJFTwHPqor6Q5pb+hUCkGEtzPzM5NOUc1pVhYUReyHwjPjCoxafwuNpEhmpJ0S8621YhropJNnlZs5iWP6Wly3iinYHz4S+MZNrXGMEN00d4bTFCidIoYCBnU6w+xHswdrnKNiwo/v1ejMFr5wje1Mcx8zeuDLc/6FpirZmS7X6FkNmPqthaQELku/hYOvhmD7 8yB9k7Jt dlX2hD/wOORDrLfyqvHE2/1dK2zlUqxPYBgZCj9xHKrwKZg/8yU/zHBDwSLNg9f829lxB4F8Ce858/hagrMc4CrpdtnOMLlebzMKHAe4Y5nQUSuFKTXhTYR7Q73vd9gQS7VrYibvCz59JSBwWzw9FQG6iYFCbjWBO7bC/UynV6iphYzsq3umtRy4Ru/9KmDdQvWNHqt4qdnOS8g1yw6oWtcpJGDijoJzgRMC+6i72C0sgAlA2Wb8nzUWkK7cuHQRQJaG8A20ngLJ5R9qE7O2AJXjrnQz1tp5ijPGKhlx30obcZGN5vOXxUsC/VZLcBTlCF78oqiDqY3QWurH5DrGq1l0/6HX7NciCCFv7 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: Currently the MM selftests attempt to work out the target architecture by using CROSS_COMPILE or otherwise querying the host machine, storing the target architecture in a variable called MACHINE rather than the usual ARCH though as far as I can tell (including for x86_64) the value is the same as we would use for architecture. When cross compiling with LLVM we don't need a CROSS_COMPILE as LLVM can support many target architectures in a single build so this logic does not work, CROSS_COMPILE is not set and we end up selecting tests for the host rather than target architecture. Fix this by using the more standard ARCH to describe the architecture, taking it from the environment if specified. Signed-off-by: Mark Brown --- tools/testing/selftests/mm/Makefile | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) --- base-commit: 858fd168a95c5b9669aac8db6c14a9aeab446375 change-id: 20230614-kselftest-mm-llvm-a25a7daffa6f Best regards, diff --git a/tools/testing/selftests/mm/Makefile b/tools/testing/selftests/mm/Makefile index 23af4633f0f4..4f0c50c33ba7 100644 --- a/tools/testing/selftests/mm/Makefile +++ b/tools/testing/selftests/mm/Makefile @@ -5,12 +5,15 @@ LOCAL_HDRS += $(selfdir)/mm/local_config.h $(top_srcdir)/mm/gup_test.h include local_config.mk +ifeq ($(ARCH),) + ifeq ($(CROSS_COMPILE),) uname_M := $(shell uname -m 2>/dev/null || echo not) else uname_M := $(shell echo $(CROSS_COMPILE) | grep -o '^[a-z0-9]\+') endif -MACHINE ?= $(shell echo $(uname_M) | sed -e 's/aarch64.*/arm64/' -e 's/ppc64.*/ppc64/') +ARCH ?= $(shell echo $(uname_M) | sed -e 's/aarch64.*/arm64/' -e 's/ppc64.*/ppc64/') +endif # Without this, failed build products remain, with up-to-date timestamps, # thus tricking Make (and you!) into believing that All Is Well, in subsequent @@ -65,7 +68,7 @@ TEST_GEN_PROGS += ksm_tests TEST_GEN_PROGS += ksm_functional_tests TEST_GEN_PROGS += mdwe_test -ifeq ($(MACHINE),x86_64) +ifeq ($(ARCH),x86_64) CAN_BUILD_I386 := $(shell ./../x86/check_cc.sh "$(CC)" ../x86/trivial_32bit_program.c -m32) CAN_BUILD_X86_64 := $(shell ./../x86/check_cc.sh "$(CC)" ../x86/trivial_64bit_program.c) CAN_BUILD_WITH_NOPIE := $(shell ./../x86/check_cc.sh "$(CC)" ../x86/trivial_program.c -no-pie) @@ -87,13 +90,13 @@ TEST_GEN_PROGS += $(BINARIES_64) endif else -ifneq (,$(findstring $(MACHINE),ppc64)) +ifneq (,$(findstring $(ARCH),ppc64)) TEST_GEN_PROGS += protection_keys endif endif -ifneq (,$(filter $(MACHINE),arm64 ia64 mips64 parisc64 ppc64 riscv64 s390x sparc64 x86_64)) +ifneq (,$(filter $(ARCH),arm64 ia64 mips64 parisc64 ppc64 riscv64 s390x sparc64 x86_64)) TEST_GEN_PROGS += va_high_addr_switch TEST_GEN_PROGS += virtual_address_range TEST_GEN_PROGS += write_to_hugetlbfs @@ -112,7 +115,7 @@ $(TEST_GEN_PROGS): vm_util.c $(OUTPUT)/uffd-stress: uffd-common.c $(OUTPUT)/uffd-unit-tests: uffd-common.c -ifeq ($(MACHINE),x86_64) +ifeq ($(ARCH),x86_64) BINARIES_32 := $(patsubst %,$(OUTPUT)/%,$(BINARIES_32)) BINARIES_64 := $(patsubst %,$(OUTPUT)/%,$(BINARIES_64))