Message ID | 20221109221104.1797802-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 l7csp591362wru; Wed, 9 Nov 2022 14:21:55 -0800 (PST) X-Google-Smtp-Source: AMsMyM7/Wr6S0vQ/7YT10mKa/P+MX6Vhg8BoJT+RurA+4ljH5RKPlJxdUgNeZNOEL+F+9PBnkrhb X-Received: by 2002:a17:902:ced1:b0:186:b18a:d0d5 with SMTP id d17-20020a170902ced100b00186b18ad0d5mr63458245plg.60.1668032515286; Wed, 09 Nov 2022 14:21:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668032515; cv=none; d=google.com; s=arc-20160816; b=d/tZt60F/2ux0cEsd65rryf1OtVyfOSPET6ccBXQgCzwEiGn/38JUQ2Y+L51QACCdf EDHDpQoJ98XhombSbFwFX1LkB3WDeHb4KN7mYxqREZy8/q2Ng0DHa6cVbmCSn992Muqb D+7O39cLPscykSRbKbUp0h/jDTgYSrJwzNOUuTy/2gq6g83AP/m7aJJLs9v9kBZCZdOO piS2HWAYI9gYZsSm6JVryjXNFELgPHMro+X6xRqO5tiE+CAppvWw/Sscs8+c8uOOsbTY 8YZm75LYX8Y9qCAkpAMNyGrUqO9Pzb3Y6Nz+YE3axQdE5BeGp1yeljD+xNUVjvB1ksKm qinQ== 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=sJ3GKuVP0imx2POuBXkubXthFsDTUZ2cFaQOvp4RnX4=; b=VVBKb1AqqILssO8iGFcPh9EUAxgt5DjLVrhbmxJyWmiCAVKPPyGyNIgigLTRZ6xHmZ HaP6rVFCNtJPbb593vuzNeTuheE/AhAgJydnbTa+ki4xOD38J3TLKtqyyte8SMKruKI4 FMJ7mU4wZRfvaWc3+llcqSVqVZrRtJdnvGmd/hDgWWrs6coOQKcLRMplFxlbCaZsHSbW IVkwpblTCAjOMbjR9+mjFdnYMG1tu5PndKKOeB5hTO8auGOfOyeflRJtye+ShTSx7U4l coBJ1/n2LTVsbG28l0hXsWa6CqH4hGtqmwEUDyOpBcV1phrOcmqQhSg0WTcDb7lPLee5 Wa+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=8F6WoDkV; 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 k20-20020a634b54000000b0046ece301e82si16996675pgl.756.2022.11.09.14.21.41; Wed, 09 Nov 2022 14:21:55 -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=8F6WoDkV; 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 S232013AbiKIWLY (ORCPT <rfc822;dexuan.linux@gmail.com> + 99 others); Wed, 9 Nov 2022 17:11:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229784AbiKIWLV (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 9 Nov 2022 17:11:21 -0500 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0EB0B303E3 for <linux-kernel@vger.kernel.org>; Wed, 9 Nov 2022 14:11:20 -0800 (PST) Received: by mail-wr1-x431.google.com with SMTP id y16so27860064wrt.12 for <linux-kernel@vger.kernel.org>; Wed, 09 Nov 2022 14:11:19 -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=sJ3GKuVP0imx2POuBXkubXthFsDTUZ2cFaQOvp4RnX4=; b=8F6WoDkV30FemhBYOzo7/gw3yLnKcBlPDpi4cbnyhJkCjDl1OHXNEsIJfEOZjt0z6E kGCOjdGdNzYPQiMgn0DM2+3CS61G4LSzruznyEmDHiWHSmb8PJ6g1bcB6hX8R5WIZpdn /Gunw0Qd09fKmgQ7K8DWwVXcNOlk84THBdxrF1ubpWKUd6O3PdkB2j+a5YEWmOjmr3NX 0HRM8cvQWiilsDenpJraXTB3A5pOdw1CKxBgRhCsSpjnVsvdYAfpcFuSZPPPTBQ5EO+a 3deGsyMhlypOzCzIt/n1nXlJJugA0ZNKfVjK3oW0V4ojgqSv1NnREmeTbAs2s8O8JGNG WVRQ== 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=sJ3GKuVP0imx2POuBXkubXthFsDTUZ2cFaQOvp4RnX4=; b=SdOYXPZSycLfX02hkbGGUTBP3sJejjlG0aMBLMr89DRg540OVvDGOk8dy09N+teEnp zBk6RaA68X5mzhk821tpux7D1DetLD3L2Ogy5QFq0JGEDmIyvRwXON/EBO4m8qlii1x0 dUkd9Pk4IhJhOMyuCrTU0qbg8rGAnWCTFTJXzkIZ3vx3g1IO3Jgj2HUdPa2y7slAJizj PsxOWgES+wW6tYC2YwRh+/uzncOw1K7lC2puIsr4lFbAoESQupwVGKlap2VeK9q3wD49 ZawmQRH4e/+Uh6uBThKw+6d+uf9xPA7IehFXZQi3CVWLB6UzfLbtp6tH4RLZFExRbea8 ll3g== X-Gm-Message-State: ACrzQf3Gck47lbI/97oMEmLGtTUhJxMXtQaDvNh1YI1SdbNC+E1ThmQD ASsR7Qw8/rCikp/WiIWDxHkXBQ== X-Received: by 2002:a5d:4441:0:b0:236:6c3e:efb4 with SMTP id x1-20020a5d4441000000b002366c3eefb4mr39347938wrr.539.1668031878566; Wed, 09 Nov 2022 14:11:18 -0800 (PST) Received: from localhost ([95.148.15.66]) by smtp.gmail.com with ESMTPSA id s25-20020adfa299000000b00236b2804d79sm14626583wra.2.2022.11.09.14.11.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Nov 2022 14:11:18 -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 v2 1/2] selftests: proc: Fix proc-empty-vm build error on non x86_64 Date: Wed, 9 Nov 2022 22:11:03 +0000 Message-Id: <20221109221104.1797802-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=ham 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?1749058862659322109?= |
Series |
[v2,1/2] selftests: proc: Fix proc-empty-vm build error on non x86_64
|
|
Commit Message
Punit Agrawal
Nov. 9, 2022, 10:11 p.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 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>
---
v1 -> v2
* Fixed missing compilation on x86_64
Previous version
* https://lore.kernel.org/all/20221109110621.1791999-1-punit.agrawal@bytedance.com/
tools/testing/selftests/proc/Makefile | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
Comments
On Wed, 9 Nov 2022 22:11:03 +0000 Punit Agrawal <punit.agrawal@bytedance.com> 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. Why does it fail? What would be involved in making it available on other architectures?
On 11/9/22 15:11, 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. > > Mark proc-empty-vm as a test for x86_64 and customise 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> > --- > v1 -> v2 > * Fixed missing compilation on x86_64 > > Previous version > * https://lore.kernel.org/all/20221109110621.1791999-1-punit.agrawal@bytedance.com/ > > tools/testing/selftests/proc/Makefile | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) > > diff --git a/tools/testing/selftests/proc/Makefile b/tools/testing/selftests/proc/Makefile > index cd95369254c0..743aaa0cdd52 100644 > --- a/tools/testing/selftests/proc/Makefile > +++ b/tools/testing/selftests/proc/Makefile > @@ -1,14 +1,16 @@ > # 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 += 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 > @@ -26,4 +28,8 @@ TEST_GEN_PROGS += thread-self > TEST_GEN_PROGS += proc-multiple-procfs > TEST_GEN_PROGS += proc-fsconfig-hidepid > > +TEST_GEN_PROGS_x86_64 += proc-empty-vm Why do you need this? You already have conditional compiles. Conditionally add proc-empty-vm to TEST_GEN_PROGS like other tests do. > + > +TEST_GEN_PROGS += $(TEST_GEN_PROGS_$(ARCH)) > + > include ../lib.mk Same question Andrews asked you. What does it take to get this to work on other architectures. proc and vm tests should be arch. agnostic as a rule unless it is absolutely necessary to have them acrh. aware. thanks, -- Shuah thanks, -- Shuah
On 11/9/22 17:02, Andrew Morton wrote: > On Wed, 9 Nov 2022 22:11:03 +0000 Punit Agrawal <punit.agrawal@bytedance.com> 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. > > Why does it fail? What would be involved in making it available > on other architectures? > I have the same question and also don't like adding TEST_GEN_PROGS_x86_64 Please see my comments on the two patches regarding this. thanks, -- Shuah
Hi Andrew, Thanks for taking a look. Andrew Morton <akpm@linux-foundation.org> writes: > On Wed, 9 Nov 2022 22:11:03 +0000 Punit Agrawal <punit.agrawal@bytedance.com> 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. > > Why does it fail? What would be involved in making it available > on other architectures? The test is written to fail building on architectures other than x86_64. #ifdef __amd64__ munmap(NULL, ((size_t)1 << 47) - 4096); #else #error "implement 'unmap everything'" #endif I hit the build failure while semi-automating the running of tests on internal infrastructure. I am not familiar with the issue being tested but after a bit of staring, it looks like there are two architecture dependent components to the tests - 1. TASK_SIZE / application memory layout - the test unmaps the entire the user virtual address space. For this, it needs to know the length to pass to munmap(). Although it's possible to add this per-architecture, I am not sure if there is a way to discover the length passed to munmap(). 2. How the vsyscall page (if implemented) is mapped - this influences the known good values used for comparison in the test. It doesn't look like vsyscall page is used on arm64 but I am not sure about the situation with other architectures. (Alexey, please add if I've missed anything) Thanks, Punit
Hi Shuah, Shuah Khan <skhan@linuxfoundation.org> writes: > On 11/9/22 15:11, 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. >> Mark proc-empty-vm as a test for x86_64 and customise 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> >> --- >> v1 -> v2 >> * Fixed missing compilation on x86_64 >> Previous version >> * https://lore.kernel.org/all/20221109110621.1791999-1-punit.agrawal@bytedance.com/ >> tools/testing/selftests/proc/Makefile | 10 ++++++++-- >> 1 file changed, 8 insertions(+), 2 deletions(-) >> diff --git a/tools/testing/selftests/proc/Makefile >> b/tools/testing/selftests/proc/Makefile >> index cd95369254c0..743aaa0cdd52 100644 >> --- a/tools/testing/selftests/proc/Makefile >> +++ b/tools/testing/selftests/proc/Makefile >> @@ -1,14 +1,16 @@ >> # 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 += 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 >> @@ -26,4 +28,8 @@ TEST_GEN_PROGS += thread-self >> TEST_GEN_PROGS += proc-multiple-procfs >> TEST_GEN_PROGS += proc-fsconfig-hidepid >> +TEST_GEN_PROGS_x86_64 += proc-empty-vm > > Why do you need this? You already have conditional compiles. > Conditionally add proc-empty-vm to TEST_GEN_PROGS like other > tests do. I copied this approach from KVM tests. Looks like we've got a few different ways of disabling compilation within selftests. I can respin to conditionally compile as suggested if that is the way forward. >> + >> +TEST_GEN_PROGS += $(TEST_GEN_PROGS_$(ARCH)) >> + >> include ../lib.mk > > Same question Andrews asked you. What does it take to get this > to work on other architectures. proc and vm tests should be > arch. agnostic as a rule unless it is absolutely necessary to > have them acrh. aware. Please see my reply elsewhere in the thread for an assessment of the architecture dependencies.
diff --git a/tools/testing/selftests/proc/Makefile b/tools/testing/selftests/proc/Makefile index cd95369254c0..743aaa0cdd52 100644 --- a/tools/testing/selftests/proc/Makefile +++ b/tools/testing/selftests/proc/Makefile @@ -1,14 +1,16 @@ # 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 += 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 @@ -26,4 +28,8 @@ TEST_GEN_PROGS += thread-self TEST_GEN_PROGS += proc-multiple-procfs TEST_GEN_PROGS += proc-fsconfig-hidepid +TEST_GEN_PROGS_x86_64 += proc-empty-vm + +TEST_GEN_PROGS += $(TEST_GEN_PROGS_$(ARCH)) + include ../lib.mk