Message ID | 20221109110621.1791999-1-punit.agrawal@bytedance.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp274139wru; Wed, 9 Nov 2022 03:15:34 -0800 (PST) X-Google-Smtp-Source: AMsMyM64ne7V5Q+coUR8ULb/lsA/+YYWX2NqiYrZ5EUK3zgz0aZfJui8lP7QJHFim6jA6nINthVC X-Received: by 2002:a05:6402:4006:b0:461:f4e2:82e0 with SMTP id d6-20020a056402400600b00461f4e282e0mr61143650eda.68.1667992534411; Wed, 09 Nov 2022 03:15:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667992534; cv=none; d=google.com; s=arc-20160816; b=ROKog87H5esogHVIYpMoqxZavLrbwpjJJWxbBPhl1BBm06kc2SlASlLzM7ZX7ADVVP YVnImcmddtMysjxoLHw2jFfnyGpKZxHS2byXIcdM1NymTEH8uVba/bLFHN++fdGfM0ZP J72ZaK7yBqW2otU8Pfaw04y0n1WYQDDyUeIb1HV9SOI+Wy0dYj5+O+98ig/Uz/M6rwMX bph2ZTablYecUPagIEd6niiUJdqfn/zOE4b23PrkIvZH9fSu21re2taaOl8cGYr74XtS zH9OC/kD+bxGkSKhurfxagYXQw3qSi802BDRHrimez0T/JVskcvJbSBvTrVdM0noF3XC pTog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=bkxuXtDed4rc7dbRvY9+2yDzxFpGHl/JP9vCeNecjEQ=; b=gbOOc9rk7+kkKsSIRHU8yp974RJeyhRDw48Xp6kK/QzS93MjxfXkKilEgNNqLtcyoz zBuA+jfu64mjblEcA+oS3K2zlBMCfz0YiR+SEbjavEXaZmMu9Jx9p6Iu1K0198W5rAKu cMsm9fZT8oc1R28SF5XTgNqw2RDsWQ2SLaz4jF0ayLLoAoL5eAK9ZzMpN7FBy2vOKrV2 bG06t9ZlnQGAJmMa9zGnbVhlb/dhLjwSqaExmH6sXI7fYAwhSSEIkTeWqRyBnsJ3SBV9 tzAVFWe0GjH3bvtN4VeLNUdwugq4AlM3P3pVptd73anvYAfLyFVBPv5lxiG71IGTv8S0 Qyvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=6DFmQR5s; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c6-20020a05640227c600b0045c42a9f588si17291194ede.408.2022.11.09.03.15.09; Wed, 09 Nov 2022 03:15:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=6DFmQR5s; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230390AbiKILGk (ORCPT <rfc822;dexuan.linux@gmail.com> + 99 others); Wed, 9 Nov 2022 06:06:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230140AbiKILGc (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 9 Nov 2022 06:06:32 -0500 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79E7E22B3C for <linux-kernel@vger.kernel.org>; Wed, 9 Nov 2022 03:06:31 -0800 (PST) Received: by mail-wm1-x32c.google.com with SMTP id i5-20020a1c3b05000000b003cfa97c05cdso1004809wma.4 for <linux-kernel@vger.kernel.org>; Wed, 09 Nov 2022 03:06:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=bkxuXtDed4rc7dbRvY9+2yDzxFpGHl/JP9vCeNecjEQ=; b=6DFmQR5sbsez/Ge+WY3V6ty840AoV8XrukBvGEINyWwWIa5Atsx6UQyioeb3ThYd1s 87Edyh3XI17NuhV9Xv1ikEJTOvzAwntA2hRBdcY1OQVe1wcWysR5z8K8257HmINhRMkF +Ss0VI9GYh4W35My1qvSx8d9WAtR3C6MBL/8gaXeXMJIiBoSaZZvSInCKIktQmFb7wMb JvW7wN/vhoLc0Tuik/alsqmt5DnR8guLjwad/Sd1H55rYZq4+J0qLGKO4zf2qCrKFnfJ cbOxYBOTaoeSFMza9dYvOTuQ1glAgXey9AnoloQzoCu0IePxDHqlmajTlF7PGlacKPJP bP9A== 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:subject:date:message-id :reply-to; bh=bkxuXtDed4rc7dbRvY9+2yDzxFpGHl/JP9vCeNecjEQ=; b=eBbPo9r1AB/JJswVQKkWCWelCKYxETN0IYgseDUAOEjXVYomnrkobl5nwCM/B298mT D/k5rDlsVLTRcBCiJFuiCY3Od+aY6M/jJnPcN47AsJghBM/OiKX0cG7EXRFTyYb80F2m +2IVINQ6qsdvyk3zclVouRlgPYRtoNcxNSrLz1SseOxqcqBgZv7/aE5cK12wYzTCuVvH WFH6cND2ZFWOHNX4douPImxa2Z+3l56YsVMqDteY9r5uoekssR5j/d7E6+NLkKO0dt54 SHX7xXn8123emhuoT5g96rKde/6YmzUUhD1BZ69HA6JC9BO2IeAYfUG5eTl7OOIEGVrv Jegw== X-Gm-Message-State: ACrzQf3HCIDzkUxkbYayY1HjHy7I2iRQ2ffDfRnQY/3l9iUsVR8FMEp7 jVodbm7v4nJKPu8296rThKb5bg== X-Received: by 2002:a05:600c:2e46:b0:3cf:8a34:2e98 with SMTP id q6-20020a05600c2e4600b003cf8a342e98mr23430198wmf.30.1667991989984; Wed, 09 Nov 2022 03:06:29 -0800 (PST) Received: from localhost ([95.148.15.66]) by smtp.gmail.com with ESMTPSA id r2-20020adfdc82000000b0022ae401e9e0sm12999034wrj.78.2022.11.09.03.06.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Nov 2022 03:06:29 -0800 (PST) From: Punit Agrawal <punit.agrawal@bytedance.com> To: akpm@linux-foundation.org, shuah@kernel.org Cc: adobriyan@gmail.com, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kselftest@vger.kernel.org, Punit Agrawal <punit.agrawal@bytedance.com> Subject: [PATCH] selftests: proc: Fix proc-empty-vm build error on non x86_64 Date: Wed, 9 Nov 2022 11:06:21 +0000 Message-Id: <20221109110621.1791999-1-punit.agrawal@bytedance.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749016939806214696?= X-GMAIL-MSGID: =?utf-8?q?1749016939806214696?= |
Series |
selftests: proc: Fix proc-empty-vm build error on non x86_64
|
|
Commit Message
Punit Agrawal
Nov. 9, 2022, 11:06 a.m. UTC
The proc-empty-vm test is implemented for x86_64 and fails to build
for other architectures. Rather then emitting a compiler error it
would be preferable to only build the test on supported architectures.
Mark proc-empty-vm as a test for x86_64 and customise to the Makefile
to build it only when building for this target architecture.
Fixes: 5bc73bb3451b ("proc: test how it holds up with mapping'less process")
Signed-off-by: Punit Agrawal <punit.agrawal@bytedance.com>
---
tools/testing/selftests/proc/Makefile | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
Comments
On Wed, Nov 09, 2022 at 11:06:21AM +0000, Punit Agrawal wrote: > The proc-empty-vm test is implemented for x86_64 and fails to build > for other architectures. Rather then emitting a compiler error it > would be preferable to only build the test on supported architectures. Ehh, can you just port it to whatever arch you're using? What's the address space on arm/arm64? #ifdef __amd64__ munmap(NULL, ((size_t)1 << 47) - 4096); #else #error "implement 'unmap everything'" #endif This program is almost arch-independent. > +TEST_GEN_PROGS_x86_64 += proc-empty-vm
Alexey Dobriyan <adobriyan@gmail.com> writes: > On Wed, Nov 09, 2022 at 11:06:21AM +0000, Punit Agrawal wrote: >> The proc-empty-vm test is implemented for x86_64 and fails to build >> for other architectures. Rather then emitting a compiler error it >> would be preferable to only build the test on supported architectures. > > Ehh, can you just port it to whatever arch you're using? > What's the address space on arm/arm64? On arm64, it is 0x0000ffffffffffff ((1 << 48) - 1) when using 48bit VA, but goes up when using 52-bit VA[0]. > #ifdef __amd64__ > munmap(NULL, ((size_t)1 << 47) - 4096); > #else > #error "implement 'unmap everything'" > #endif > > This program is almost arch-independent. I did try updating the #ifdef but then hit the asm block in vsyscall(). Also, the test would be still fail to build on other architectures. While support for architectures is added, it would be good to not have the compiler throw an error on unsuspecting kselftest users. >> +TEST_GEN_PROGS_x86_64 += proc-empty-vm [0] https://docs.kernel.org/arm64/memory.html
Punit Agrawal <punit.agrawal@bytedance.com> writes: > The proc-empty-vm test is implemented for x86_64 and fails to build > for other architectures. Rather then emitting a compiler error it > would be preferable to only build the test on supported architectures. > > Mark proc-empty-vm as a test for x86_64 and customise to the Makefile > to build it only when building for this target architecture. > > Fixes: 5bc73bb3451b ("proc: test how it holds up with mapping'less process") > Signed-off-by: Punit Agrawal <punit.agrawal@bytedance.com> > --- > tools/testing/selftests/proc/Makefile | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/tools/testing/selftests/proc/Makefile b/tools/testing/selftests/proc/Makefile > index cd95369254c0..6b31439902af 100644 > --- a/tools/testing/selftests/proc/Makefile > +++ b/tools/testing/selftests/proc/Makefile > @@ -1,14 +1,18 @@ > # SPDX-License-Identifier: GPL-2.0-only > + > +# When ARCH not overridden for crosscompiling, lookup machine > +ARCH ?= $(shell uname -m 2>/dev/null || echo not) > + > CFLAGS += -Wall -O2 -Wno-unused-function > CFLAGS += -D_GNU_SOURCE > LDFLAGS += -pthread > > -TEST_GEN_PROGS := > +TEST_GEN_PROGS_x86_64 += proc-empty-vm > + > TEST_GEN_PROGS += fd-001-lookup > TEST_GEN_PROGS += fd-002-posix-eq > TEST_GEN_PROGS += fd-003-kthread > TEST_GEN_PROGS += proc-loadavg-001 > -TEST_GEN_PROGS += proc-empty-vm > TEST_GEN_PROGS += proc-pid-vm > TEST_GEN_PROGS += proc-self-map-files-001 > TEST_GEN_PROGS += proc-self-map-files-002 I noticed that a hunk has gone missing from the patch. Please ignore this version - I'll post an updated one shortly.
diff --git a/tools/testing/selftests/proc/Makefile b/tools/testing/selftests/proc/Makefile index cd95369254c0..6b31439902af 100644 --- a/tools/testing/selftests/proc/Makefile +++ b/tools/testing/selftests/proc/Makefile @@ -1,14 +1,18 @@ # SPDX-License-Identifier: GPL-2.0-only + +# When ARCH not overridden for crosscompiling, lookup machine +ARCH ?= $(shell uname -m 2>/dev/null || echo not) + CFLAGS += -Wall -O2 -Wno-unused-function CFLAGS += -D_GNU_SOURCE LDFLAGS += -pthread -TEST_GEN_PROGS := +TEST_GEN_PROGS_x86_64 += proc-empty-vm + TEST_GEN_PROGS += fd-001-lookup TEST_GEN_PROGS += fd-002-posix-eq TEST_GEN_PROGS += fd-003-kthread TEST_GEN_PROGS += proc-loadavg-001 -TEST_GEN_PROGS += proc-empty-vm TEST_GEN_PROGS += proc-pid-vm TEST_GEN_PROGS += proc-self-map-files-001 TEST_GEN_PROGS += proc-self-map-files-002