From nobody Wed Oct 14 23:29:31 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4E981329E79; Wed, 14 Oct 2026 20:01:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792008092; cv=none; b=f+zF0eZlrARTxkwWiFpKZzFKfvVmQEUbF1C8BwJkzdTti4q1yrw2qWvY1kAg4L8l3NgkVm+U4molmOQC3Sy1lNYySBF+Bei1AuhS1fFZz9KuXlkR3i7EiNki2S0sARXJDKwtqvl2qJjP76fJKlYjcdkFbnzfzJZPOe4Uo2HAmrI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792008092; c=relaxed/simple; bh=UjKNvEvAapCkXDaiwGGuY0Ctjo+bbdUzPEbSMdchq9w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Y2jKlcVg/m4C+srAl6LjHdCYTkA1LLGO24dmE84pn//aAOJlMauYsO5VDtHNN4omg9hz59cOC61HLJQkDyqmTVhZ7/i3TuWpcw4p8d30qQx4Tqs1FHNvKZn0QVSMmew9IZw8LJX38afGZ7t3Nr4nRS2jbaZ4RtNMF9Onp/0JtWc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=CELUp8Y8; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="CELUp8Y8" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B476A1F000C5; Wed, 14 Oct 2026 20:01:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1792008091; bh=emEk8CPevMzbjSFFu1Ej18NdZfPdEo64y3m/O08+QJs=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=CELUp8Y8B3LVVZzG5BKLZluNpSQkUoQl/BIumL+kjdmsDS9H69ORori8LMCCGxLDV L+w6W/QWQWcraXu/2glxvmNvFRu9i2s3E4T/q4gYvsLwQ6REPen4Crj3qH6fwTvOhA 2ouF3NrduLS6FX3+mjZTzQKyRek44UrRtwZdWxwAegJW5b37x2lKtcr6N5Y0oNk2YF 6y05clq60cC4us6sEwP6sPDwlLf0cM8804tZJFewCIWVI+4GIxW4YFjazfaZsj1SfX 1zoiIPvqzNHOcI7OqnIqgnPVa8xd5p6vGm8murEBvkvYIKvAmVi/cWx8XPXjDRlFGC 1LGAZSI/+LDDw== From: Sasha Levin To: Shuah Khan Cc: Sasha Levin , linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/5] selftests/prctl: build generated tests for the target architecture Date: Wed, 14 Oct 2026 16:01:23 -0400 Message-ID: <20261014200127.1363472-2-sashal@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261014200127.1363472-1-sashal@kernel.org> References: <20261014200127.1363472-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The prctl Makefile builds nothing when CROSS_COMPILE is set, even when the target is x86, and it lists its compiled programs in TEST_PROGS, which lib.mk treats as source-tree scripts. The binaries are therefore built into the source directory rather than OUTPUT. The architecture check also restricts set-anon-vma-name-test and set-process-name to x86 although neither depends on the architecture. Build the programs as TEST_GEN_PROGS, build the two generic tests on every architecture, and keep only the TSC tests x86 specific. Select them from the target ARCH when it is given and from the host's SUBARCH otherwise, using a private ARCH_PROCESSED instead of overriding ARCH. The override added by commit 5a1292137e89 ("selftests: fix ARCH normalization to handle command-line argument") changed the value that lib.mk uses to choose the clang target: leaving ARCH unset again lets lib.mk use the compiler's native triple. A command-line ARCH such as x86_64 is still normalized for the TSC test selection, while an ARCH spelling that lib.mk does not know, such as i686 with LLVM=3D1, is rejected in the same way as for the other selftests. Fixes: f59514b6a8c5 ("Documentation/prctl: don't build tsc tests when cross= compiling") Fixes: 5290586186d2 ("selftests: prctl: Add new prctl test for PR_SET_VMA a= ction") Fixes: e0606daeaab4 ("selftests: prctl: Add new prctl test for PR_SET_NAME") Signed-off-by: Sasha Levin --- tools/testing/selftests/prctl/Makefile | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/tools/testing/selftests/prctl/Makefile b/tools/testing/selftes= ts/prctl/Makefile index e770e86fad9ac..123f884e9dfa5 100644 --- a/tools/testing/selftests/prctl/Makefile +++ b/tools/testing/selftests/prctl/Makefile @@ -1,14 +1,12 @@ # SPDX-License-Identifier: GPL-2.0 -ifndef CROSS_COMPILE -ARCH ?=3D $(shell uname -m 2>/dev/null || echo not) -override ARCH :=3D $(shell echo $(ARCH) | sed -e s/i.86/x86/ -e s/x86_64/x= 86/) +top_srcdir =3D ../../../.. +include $(top_srcdir)/scripts/subarch.include +ARCH_PROCESSED :=3D $(shell echo $(or $(ARCH),$(SUBARCH)) | sed -e s/i.86/= x86/ -e s/x86_64/x86/) =20 -ifeq ($(ARCH),x86) -TEST_PROGS :=3D disable-tsc-ctxt-sw-stress-test disable-tsc-on-off-stress-= test \ - disable-tsc-test set-anon-vma-name-test set-process-name -all: $(TEST_PROGS) +TEST_GEN_PROGS :=3D set-anon-vma-name-test set-process-name +ifeq ($(ARCH_PROCESSED),x86) +TEST_GEN_PROGS +=3D disable-tsc-ctxt-sw-stress-test disable-tsc-on-off-str= ess-test \ + disable-tsc-test +endif =20 include ../lib.mk - -endif -endif --=20 2.53.0 From nobody Wed Oct 14 23:29:31 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 293053E763E; Wed, 14 Oct 2026 20:01:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792008093; cv=none; b=VB5QSSgGhjtjGINp4WB23QOtgtdXSFcNwNYaeZixXhlTdh0Sz+StqbtkRAvJGT8mu/2UFt/egh9hiEzJOeMULDm4U8hOuYM0auv8Tt+UrRWlmr76zMh2x2LdViwgW+ucqZGe6JEdStjDEhDMxY8M47cUMADepgIU85dAC/UYtdI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792008093; c=relaxed/simple; bh=KzY2bvVHdnK8o0jEdBR3mdF0zL8Lm0nOaXsKgcf+HE4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jhRfOp0Qq2dOlPLYuVPCU9gfXv1pzmCkdBhOkPFJaaFdX/q1+9ay4aLgk9j5ZUj7lw+JCfLDiTor8xVHT2xKoKo9B4SDPjBtyrsucaRmYw+hQdWYXf+BDs7TySMx0ilrx/auxsi4E8WiakV9VjHWW+1Qr5mI1NvKvO3hpuzrHLo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=RYPbz+Ca; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="RYPbz+Ca" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A4DA1F000C7; Wed, 14 Oct 2026 20:01:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1792008092; bh=RpCyM3yYQCSRwMwZTxO0x/ozF1soHumH44biXgdIoZ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=RYPbz+Ca2GA2jRHo7QQrKr22Kqpy4/HmAXNRYae95XNA1dgkLJidQVzL5q4L7YiC/ 8/4Q1cILBxWJmSJvGn5NuOGwT9S9HJCasqBG124Jn+WUobEthtRsYH0mAfMT6ktKm5 zoGrNgfP7l8MqfubdWHFOJohmUgjrzSvXy8g6XD2OuFmSdgSaD+9MD8yLGAB7E+ix+ 3GquwJl+KChzKnDGiAdpxe4tumL6WDhHJvjuXikjJbwsv3HLjtU3bbNT+VwqG+Peax kGsxynfJ6LffM1mL20IWq5r2cOIojO6RaHSJz/qqmkFvreOTok2zY4szzsI89qSqee nxi9E7xwdCVgg== From: Sasha Levin To: Shuah Khan Cc: Sasha Levin , Ivan Orlov , linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/5] selftests/prctl: skip the anonymous VMA naming test when unsupported Date: Wed, 14 Oct 2026 16:01:24 -0400 Message-ID: <20261014200127.1363472-3-sashal@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261014200127.1363472-1-sashal@kernel.org> References: <20261014200127.1363472-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" PR_SET_VMA_ANON_NAME is only implemented when CONFIG_ANON_VMA_NAME is enabled. Without it, set_anon_vma_name() returns -EINVAL for every request, so set-anon-vma-name-test reports a failure on kernels that simply do not provide the feature: # renaming: Expected rename_vma(...) (-22) >=3D 0 not ok 1 vma.renaming Probe the interface in the fixture setup by clearing the name of the anonymous mapping, which succeeds whenever the feature is available, and skip the test when the kernel rejects the request with EINVAL. Fixes: 5290586186d2 ("selftests: prctl: Add new prctl test for PR_SET_VMA a= ction") Signed-off-by: Sasha Levin --- tools/testing/selftests/prctl/set-anon-vma-name-test.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/testing/selftests/prctl/set-anon-vma-name-test.c b/tools= /testing/selftests/prctl/set-anon-vma-name-test.c index 5f9589534da8e..d3854ccb2a7a3 100644 --- a/tools/testing/selftests/prctl/set-anon-vma-name-test.c +++ b/tools/testing/selftests/prctl/set-anon-vma-name-test.c @@ -93,6 +93,9 @@ FIXTURE_SETUP(vma) { MAP_PRIVATE, self->fd_not_anon, 0); ASSERT_NE(self->ptr_not_anon, MAP_FAILED); close(self->fd_not_anon); + + if (rename_vma((unsigned long)self->ptr_anon, AREA_SIZE, NULL) =3D=3D -EI= NVAL) + SKIP(return, "PR_SET_VMA_ANON_NAME is not supported"); } =20 FIXTURE_TEARDOWN(vma) { --=20 2.53.0 From nobody Wed Oct 14 23:29:31 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 40BA3484246; Wed, 14 Oct 2026 20:01:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792008094; cv=none; b=WyGtVN7zGb5HsLF01dUQn4Z32yVKNaqQWET0inhtFACVYn/sjP2ntmRwaGAs3Jrvvx4u2pZv5TqCGGmG2e8qXKCz8XYguIzgkK+qLd3bV4QqX14pwHXe/ZQvexor/H/anUH2MGcI5csI0aO66ZXw7QWUXRr6XtgekaxQiq66kDc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792008094; c=relaxed/simple; bh=bbKB5pLydT8mVBMAJ+1iBWrVSm6WgdUY2bRQ5ZPyjb8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=aQ/reTFWCRCmWtdnFxKOM48S5aSv6wZ00h2/LAghSbNf+E3IZjk5TL1YZBq4Cmyk+kufKzCOUNkvmDYCWNkcs838g5DOX9hW+2hKHhZzZ6tFJI45g2vcrpfzRwVYTEGtllCg5B2bLZ1doKGK8L53jDKwZY0QqOdrAqj3XFG2Lo4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=oxwinNoV; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="oxwinNoV" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 53B8F1F000C9; Wed, 14 Oct 2026 20:01:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1792008093; bh=LIMv34cDJqzlLVhQT11taTszU7soywSUu9ZIVJ/8ciI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=oxwinNoV4XFgOGvrDWkmcFnZpsEtVhwE9ew5uAMZDedi6Nzg6RbKJ5L7Oya+xdVpy l1VrhaLN4+OLLbMFt4Mf2N+oRZ4ZV8VYVq5eFLmwE9l1J9M39Y5Sa6EnMSIai16Fbx SMoDMKjywPOGX58VLoNSg7Uu8BhIYtQ85iSLunGeuW0cX6ZJj0iaWaqQ8Ck7Ims91h +8AXUqzIp4WYXv/ATgPTZ/QyglyCR5vGxjMXd2Vc3rlBBPwzKGSJFWGit+KvV+83Cb kHVPBQfTiyQ4+MyPqfgjlXFUMr7xyuzvhDIl1Ly/s6rCO3c9iYbbYDwafsxc5av+HQ zhEbbRoJCCLQg== From: Sasha Levin To: Shuah Khan Cc: Sasha Levin , "Rafael J. Wysocki" , Srinivas Pandruvada , Daniel Lezcano , linux-pm@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/5] selftests/thermal: allow cross builds of the Intel tests Date: Wed, 14 Oct 2026 16:01:25 -0400 Message-ID: <20261014200127.1363472-4-sashal@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261014200127.1363472-1-sashal@kernel.org> References: <20261014200127.1363472-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The power_floor and workload_hint Makefiles build nothing when CROSS_COMPILE is set, even for an x86 target, and they include lib.mk only on x86. Other architectures therefore have no install or emit_tests rules for these suites, and their installation fails with a missing target. Select the x86 tests from the target ARCH when it is given and from the host's SUBARCH otherwise, and include lib.mk unconditionally so that the suites install and emit an empty runlist on other architectures. Use a private ARCH_PROCESSED instead of the ARCH override added by commit 5a1292137e89 ("selftests: fix ARCH normalization to handle command-line argument"): the override changed the value lib.mk uses to pick the clang target, whereas leaving ARCH unset lets lib.mk use the compiler's native triple. A command-line ARCH such as x86_64 is still normalized for the selection, while an ARCH spelling that lib.mk does not know, such as i686 with LLVM=3D1, is rejected as in other selftests. Fixes: 27801542b2b8 ("selftests/thermel/intel: Add test to read workload hi= nt") Fixes: d4d27e5a1a88 ("selftests/thermel/intel: Add test to read power floor= status") Signed-off-by: Sasha Levin --- .../selftests/thermal/intel/power_floor/Makefile | 12 +++++------- .../selftests/thermal/intel/workload_hint/Makefile | 12 +++++------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/tools/testing/selftests/thermal/intel/power_floor/Makefile b/t= ools/testing/selftests/thermal/intel/power_floor/Makefile index 07463c2160e09..16d26eab55652 100644 --- a/tools/testing/selftests/thermal/intel/power_floor/Makefile +++ b/tools/testing/selftests/thermal/intel/power_floor/Makefile @@ -1,12 +1,10 @@ # SPDX-License-Identifier: GPL-2.0 -ifndef CROSS_COMPILE -ARCH ?=3D $(shell uname -m 2>/dev/null || echo not) -override ARCH :=3D $(shell echo $(ARCH) | sed -e s/i.86/x86/ -e s/x86_64/x= 86/) +top_srcdir =3D ../../../../../.. +include $(top_srcdir)/scripts/subarch.include +ARCH_PROCESSED :=3D $(shell echo $(or $(ARCH),$(SUBARCH)) | sed -e s/i.86/= x86/ -e s/x86_64/x86/) =20 -ifeq ($(ARCH),x86) +ifeq ($(ARCH_PROCESSED),x86) TEST_GEN_PROGS :=3D power_floor_test +endif =20 include ../../../lib.mk - -endif -endif diff --git a/tools/testing/selftests/thermal/intel/workload_hint/Makefile b= /tools/testing/selftests/thermal/intel/workload_hint/Makefile index 49e3bc2b20f9d..e53d6ecd9f8de 100644 --- a/tools/testing/selftests/thermal/intel/workload_hint/Makefile +++ b/tools/testing/selftests/thermal/intel/workload_hint/Makefile @@ -1,12 +1,10 @@ # SPDX-License-Identifier: GPL-2.0 -ifndef CROSS_COMPILE -ARCH ?=3D $(shell uname -m 2>/dev/null || echo not) -override ARCH :=3D $(shell echo $(ARCH) | sed -e s/i.86/x86/ -e s/x86_64/x= 86/) +top_srcdir =3D ../../../../../.. +include $(top_srcdir)/scripts/subarch.include +ARCH_PROCESSED :=3D $(shell echo $(or $(ARCH),$(SUBARCH)) | sed -e s/i.86/= x86/ -e s/x86_64/x86/) =20 -ifeq ($(ARCH),x86) +ifeq ($(ARCH_PROCESSED),x86) TEST_GEN_PROGS :=3D workload_hint_test +endif =20 include ../../../lib.mk - -endif -endif --=20 2.53.0 From nobody Wed Oct 14 23:29:31 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 43D65486BBF; Wed, 14 Oct 2026 20:01:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792008104; cv=none; b=SaXf9+EBYNO8j36miRZL6GV1tmvBLoyWT8lKfIU5+VRcwak7CNZLF7g8vkcDgcaa6MrwYotylt9uz2oRxEeU2kfG/oPT46BI54QTtaPaPcUXd7ahZa8R5B+xc0rhUTH9HW5zSSNXeL+O5nfAcU0RtuR6MgBijHD1yq+1/eqBfRM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792008104; c=relaxed/simple; bh=WAsHgZsGk64Ci2c8n3RdN3pdKT/+dahk9wgGJUMt4JE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XnNrwb0C9CN91TS9Ry3YbBV9bRcFqeDlnytyV2/IBrp2Eot820VR7gqEZVH0YfCreCCSlC3ZLReiMTx/bJsXohGX2TAe6DgIzsZVU9b5Q8GubhIc0Texi56lQL8pvRIVdfofph1/Ldetc+jCNzSu+yfzfJimTbh8+pAOdWF5RFQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=afg5s7wY; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="afg5s7wY" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6A8B11F000C6; Wed, 14 Oct 2026 20:01:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1792008094; bh=pUU6GZFqMSNYXOwJs6Za3b0uigEcrfPKq411zI1Oteg=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=afg5s7wYZxjtRm5X1k10FyzdSHWgtQlQauEBDuFRVFEIQlJlGfT3/vdfc2TQE10Yn FjjrRX/dbLBBas0S+c0D0AvR4d/ehcxyBwLAdTzF8kGwnz3zQVIOn8dUAzf/ZbbjrH A4Tobzd6frYYVHOSuiq6k5AFb4k1CyMbFzpPVktySyb8rSmX3uFb5Fs8SBpd9OOdol x5wqyTuHbjBZmR+IJ381XuGitbn1GbkUgpEEQR5WS56BjnA8ZibfJnyfP0VTPHZl8g HIi8vezZ6o5cz8wprsuiAq3S8056uFz5LpewgBVgIl2+zznbZv58C0MxFGvWXpPJFv Dw0WnNOdEot2w== From: Sasha Levin To: Shuah Khan Cc: Sasha Levin , David Woodhouse , Nageswara R Sastry , kexec@lists.infradead.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/5] selftests/kexec: select tests using the target compiler Date: Wed, 14 Oct 2026 16:01:26 -0400 Message-ID: <20261014200127.1363472-5-sashal@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261014200127.1363472-1-sashal@kernel.org> References: <20261014200127.1363472-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The kexec Makefile recognizes PowerPC only through the ppc64le spelling of ARCH, so the canonical ARCH=3Dpowerpc used for cross builds omits the tests. The x86 jump test is selected with IS_64_BIT from scripts/Makefile.arch, which describes the build host rather than the compiler being used. On other architectures the Makefile includes no lib.mk rules at all, so installation and runlist generation fail with missing targets. Select x86 and PowerPC from the target ARCH when it is given and from the host's SUBARCH otherwise, without assigning ARCH, so that lib.mk keeps choosing the compiler's native clang target. Ask the selected compiler, including USERCFLAGS, whether it targets a 64-bit x86 ABI and whether it targets little-endian 64-bit PowerPC. lib.mk expands the generated program list before it appends USERCFLAGS to CFLAGS, so the flags are passed explicitly to keep both probes consistent. If the compiler cannot be run, select the jump test so that the build fails instead of silently dropping it. Include lib.mk unconditionally so that unsupported targets build, install and emit an empty runlist. Fixes: 65e38e32a959 ("selftests/kexec: Enable secureboot tests for PowerPC") Fixes: 7615b94b6371 ("selftests/kexec: Add x86_64 selftest for kexec-jump a= nd exception handling") Signed-off-by: Sasha Levin --- tools/testing/selftests/kexec/Makefile | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/tools/testing/selftests/kexec/Makefile b/tools/testing/selftes= ts/kexec/Makefile index 874cfdd3b75b3..97d5dd10208a1 100644 --- a/tools/testing/selftests/kexec/Makefile +++ b/tools/testing/selftests/kexec/Makefile @@ -1,20 +1,22 @@ # SPDX-License-Identifier: GPL-2.0-only # Makefile for kexec tests =20 -ARCH ?=3D $(shell uname -m 2>/dev/null || echo not) -ARCH_PROCESSED :=3D $(shell echo $(ARCH) | sed -e s/i.86/x86/ -e s/x86_64/= x86/) +top_srcdir =3D ../../../.. +include $(top_srcdir)/scripts/subarch.include +ARCH_PROCESSED :=3D $(shell echo $(or $(ARCH),$(SUBARCH)) | sed -e s/i.86/= x86/ -e s/x86_64/x86/) =20 -ifeq ($(ARCH_PROCESSED),$(filter $(ARCH_PROCESSED),x86 ppc64le)) -TEST_PROGS :=3D test_kexec_load.sh test_kexec_file_load.sh -TEST_FILES :=3D kexec_common_lib.sh +PROBE_CC =3D $(filter-out -fuse-ld=3D%,$(CC)) $(CFLAGS) $(USERCFLAGS) -E -= P -x c - +CC_IS_64BIT =3D $(shell echo __SIZEOF_LONG__ | $(PROBE_CC) || echo 8) +PPC64LE =3D $(shell printf '\043if defined(__powerpc64__) && __BYTE_ORDER_= _ =3D=3D \ + __ORDER_LITTLE_ENDIAN__\n1\n\043endif\n' | $(PROBE_CC)) =20 -include ../../../scripts/Makefile.arch - -ifeq ($(IS_64_BIT)$(ARCH_PROCESSED),1x86) -TEST_PROGS +=3D test_kexec_jump.sh -TEST_GEN_PROGS :=3D test_kexec_jump +ifeq ($(ARCH_PROCESSED),x86) +TEST_PROGS =3D test_kexec_load.sh test_kexec_file_load.sh \ + $(if $(filter 8,$(CC_IS_64BIT)),test_kexec_jump.sh) +TEST_GEN_PROGS =3D $(if $(filter 8,$(CC_IS_64BIT)),test_kexec_jump) +else ifneq (,$(filter powerpc ppc64le,$(ARCH_PROCESSED))) +TEST_PROGS =3D $(if $(filter 1,$(PPC64LE)),test_kexec_load.sh test_kexec_f= ile_load.sh) endif +TEST_FILES =3D $(if $(TEST_PROGS),kexec_common_lib.sh) =20 include ../lib.mk - -endif --=20 2.53.0 From nobody Wed Oct 14 23:29:31 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 574674457C9; Wed, 14 Oct 2026 20:01:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792008103; cv=none; b=i4LyejZ+HCmSHbIZQwk0nJCmMy842c3VgipmcI1ep/+FCwWdXW378Immso4ecfIGEBLQ3Yv5G1UsQ1asGusoEDD08jJkiF3jFrMS34DT84IyRUAZwIoAh0pzMRznkKfcFPLWQjv73jJRuyDU8ym+7K6TujZQlCf0lu63RNACX/I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792008103; c=relaxed/simple; bh=0tAHEcYTW+OwgiT66RVgWT0bNhUb0oeZZfmAhqOq1nU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WgfTMsuUlr1sWs4UkxGl2mFIOFR+S1HKkv+6g5hutvoR5YujcwlF73z4iJCJ7odvjEZ6Qm+/9cRVUY9y03BbFYtnzE8C45jlQmMoaYaL6P5rfITRtPWCSAeQQJ0S4rVZ/5o5uu9yNzEHqQ5E0ODOvywONdBvXi9QOh/DxzWYWhM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=nEeVqphZ; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="nEeVqphZ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6C5791F000CA; Wed, 14 Oct 2026 20:01:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1792008095; bh=5iaDdnJhObPPRQFwTZP6b+2aUMe/jODWWDxgOwCiG34=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=nEeVqphZDviyZQmRzvNbF+IQV+q2ExcoWI4rYPUGspc8DdF1F68oV79o1iaaFLNBA d3bz0P7DS+HAFp0+60baQbC8/tBN6a1LUi32oE6mkRVzCj8AhHKDhNjQGZpnu169iY sc8uXAONla+ZIECAYdvMK1vNkQPZgJucwqg5s6T/8mjtWWPFnA0tjjtrsal2VE1l4v 83Ydh133AKolM4CWMoIyCnMPTpVsGUIgxtJuhrv4nYx+uEu+tigBxs/VK12A8nTOKx wuy4b/xMLcwDX56S9mq2UVbmFj8f4wzuZurjHGqEzmZurvyjY/xlIcW2HIrCv77yH2 d7ul3LJcDipsA== From: Sasha Levin To: Shuah Khan Cc: Sasha Levin , Willy Tarreau , =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= , Wake Liu , linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH 5/5] selftests/size: use nolibc startup and syscall wrappers Date: Wed, 14 Oct 2026 16:01:27 -0400 Message-ID: <20261014200127.1363472-6-sashal@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261014200127.1363472-1-sashal@kernel.org> References: <20261014200127.1363472-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" get_size provides its own _start and is linked statically against the C library with -nostartfiles. That combination assumes startup and TLS details that vary between architectures and C library versions: errno lives in thread-local storage that is never set up, and the static link expects symbols from the skipped startup files. CI builds have failed with undefined _init/_fini on ARM with clang and an undefined _DYNAMIC on LoongArch. Build the test with the in-tree nolibc instead. nolibc provides the startup code, so the test returns from main(), and it provides the write() and syscall() wrappers without the TLS errno problem. A failing sysinfo() is now reported as a TAP failure instead of crashing the test. Keep the static link and the existing TAP output. Since the test no longer uses the system C library headers, the kernel UAPI headers have to be installed before it is built. Add the headers target as an order-only prerequisite, as nolibc-test does, so that a standalone build installs them. Link libgcc only when the selected compiler is GCC, which needs it for division helpers on ARM, and detect that from the compiler rather than from LLVM so that CC=3Dclang builds do not try to link a libgcc that clang does not provide. nolibc does not support arc, csky, microblaze, nios2 or xtensa, so the test can no longer be built for those architectures. This conversion also makes the separate i386 vDSO workaround proposed for get_size unnecessary. Link: https://lore.kernel.org/r/20260929043637.1917707-1-wakel@google.com Fixes: 3ce51050fadd ("selftest: size: Add size test for Linux kernel") Cc: stable@vger.kernel.org # 6.18.x Signed-off-by: Sasha Levin Reviewed-by: Thomas Wei=C3=9Fschuh --- tools/testing/selftests/size/Makefile | 9 ++++++- tools/testing/selftests/size/get_size.c | 33 +++++++------------------ 2 files changed, 17 insertions(+), 25 deletions(-) diff --git a/tools/testing/selftests/size/Makefile b/tools/testing/selftest= s/size/Makefile index b87facc00a6e9..884b42d7fd0e2 100644 --- a/tools/testing/selftests/size/Makefile +++ b/tools/testing/selftests/size/Makefile @@ -1,6 +1,13 @@ # SPDX-License-Identifier: GPL-2.0-only -CFLAGS :=3D -static -ffreestanding -nostartfiles -s +CFLAGS =3D -Os -static -nostdlib -nostdinc -ffreestanding -fno-stack-prote= ctor -s +CFLAGS +=3D -isystem $(top_srcdir)/tools/include/nolibc $(KHDR_INCLUDES) =20 TEST_GEN_PROGS :=3D get_size =20 include ../lib.mk + +CC_IS_GCC :=3D $(shell printf '\043if defined(__GNUC__) && !defined(__clan= g__)\nGCC\n\043endif\n' | \ + $(CC) $(CFLAGS) -E -P -x c - 2>/dev/null) +LDLIBS +=3D $(if $(filter GCC,$(CC_IS_GCC)),-lgcc) + +$(OUTPUT)/get_size: | headers diff --git a/tools/testing/selftests/size/get_size.c b/tools/testing/selfte= sts/size/get_size.c index 2980b1a63366b..ada6a271711a7 100644 --- a/tools/testing/selftests/size/get_size.c +++ b/tools/testing/selftests/size/get_size.c @@ -11,26 +11,12 @@ * own execution. It also attempts to have as few dependencies * on kernel features as possible. * - * It should be statically linked, with startup libs avoided. It uses - * no library calls except the syscall() function for the following 3 - * syscalls: - * sysinfo(), write(), and _exit() - * - * For output, it avoids printf (which in some C libraries - * has large external dependencies) by implementing it's own - * number output and print routines, and using __builtin_strlen() - * - * The test may crash if any of the above syscalls fails because in some - * libc implementations (e.g. the GNU C Library) errno is saved in - * thread-local storage, which does not get initialized due to avoiding - * startup libs. + * It is statically linked with nolibc startup and syscall wrappers. + * For output, it avoids printf by implementing its own print routines. */ =20 -#include -#include -#include - -#define STDOUT_FILENO 1 +#include +#include =20 static int print(const char *s) { @@ -39,7 +25,7 @@ static int print(const char *s) while (s[len] !=3D '\0') len++; =20 - return syscall(SYS_write, STDOUT_FILENO, s, len); + return write(STDOUT_FILENO, s, len); } =20 static inline char *num_to_str(unsigned long num, char *buf, int len) @@ -80,8 +66,7 @@ static int print_k_value(const char *s, unsigned long num= , unsigned long units) return ccode; } =20 -/* this program has no main(), as startup libraries are not used */ -void _start(void) +int main(void) { int ccode; struct sysinfo info; @@ -91,12 +76,12 @@ void _start(void) print("TAP version 13\n"); print("# Testing system size.\n"); =20 - ccode =3D syscall(SYS_sysinfo, &info); + ccode =3D syscall(__NR_sysinfo, &info); if (ccode < 0) { print("not ok 1"); print(test_name); print(" ---\n reason: \"could not get sysinfo\"\n ...\n"); - syscall(SYS_exit, ccode); + return 1; } print("ok 1"); print(test_name); @@ -112,5 +97,5 @@ void _start(void) print(" ...\n"); print("1..1\n"); =20 - syscall(SYS_exit, 0); + return 0; } --=20 2.53.0