From patchwork Mon Aug 19 13:06:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinjiang Tu X-Patchwork-Id: 13768341 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 3BB07C3DA4A for ; Mon, 19 Aug 2024 13:06:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C65366B0092; Mon, 19 Aug 2024 09:06:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C15786B0093; Mon, 19 Aug 2024 09:06:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AB69F6B0095; Mon, 19 Aug 2024 09:06:33 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 8F22E6B0092 for ; Mon, 19 Aug 2024 09:06:33 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 1E7B7410CF for ; Mon, 19 Aug 2024 13:06:33 +0000 (UTC) X-FDA: 82469019066.20.0582808 Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) by imf10.hostedemail.com (Postfix) with ESMTP id CF8ECC002C for ; Mon, 19 Aug 2024 13:06:28 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=none; spf=pass (imf10.hostedemail.com: domain of tujinjiang@huawei.com designates 45.249.212.191 as permitted sender) smtp.mailfrom=tujinjiang@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724072729; 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; bh=tHHRocQiYHbJShT7RyBB2Ctqr5SiTuS2o74iYiWUYc8=; b=yKoBTqIFGWPOLdfQnWlnilYXqMFjpoYz0/tuMQeJP6fB/Gp+ruyoO3qQCVl3VPhzhucXAG WkfjgxIHNFzN3c+zKHMVh7Bu0476UuiFW5B5/N39Ic2zbu7xzmwZLUiGJdt+F81XgHScdL B2JbHjiWO1JQAoqq5w9zGT+vtHHG7qQ= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=none; spf=pass (imf10.hostedemail.com: domain of tujinjiang@huawei.com designates 45.249.212.191 as permitted sender) smtp.mailfrom=tujinjiang@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724072729; a=rsa-sha256; cv=none; b=os2pE8FmXxemPy5mP/l0J2hzeEbtuG77vsCvvbLJG+MeC+NPFm4K82nMxvOclXPFyuhwHZ Ocraug+SxORDjYF3/nTm6NyUSIdO5z/vfcKCLX6yT2LG63nvMcBtlzwPlX4xyE27xbT4PD 6bQJL4sbcNCJ6HYeeu3sRR74RgAEtvc= Received: from mail.maildlp.com (unknown [172.19.88.214]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4WnXp85RVQz1HGqD; Mon, 19 Aug 2024 21:03:12 +0800 (CST) Received: from dggpeml500011.china.huawei.com (unknown [7.185.36.84]) by mail.maildlp.com (Postfix) with ESMTPS id B79551A016C; Mon, 19 Aug 2024 21:06:22 +0800 (CST) Received: from huawei.com (10.175.113.32) by dggpeml500011.china.huawei.com (7.185.36.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Mon, 19 Aug 2024 21:06:22 +0800 From: Jinjiang Tu To: , CC: , , , Subject: [PATCH] selftests/mm: remove unnecessary ia64 code and comment Date: Mon, 19 Aug 2024 21:06:09 +0800 Message-ID: <20240819130609.3386195-1-tujinjiang@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [10.175.113.32] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpeml500011.china.huawei.com (7.185.36.84) X-Stat-Signature: db776xnddrkwyf6ug3hgfuwiju37r3o9 X-Rspam-User: X-Rspamd-Queue-Id: CF8ECC002C X-Rspamd-Server: rspam02 X-HE-Tag: 1724072788-512184 X-HE-Meta: U2FsdGVkX1/Ralg6I2mM1sJ3RDHQii22+5SLK+cWUjwZNXzoG93E8W3QXoXckyYpukyprglJ+MegVBX6mI9rxTcTM1OALLOdJKeiiN494bBD+QtWc6pvbCI3hI6xDU1Mpe80AzebDWfC8jEnpuUEX7GmQi9OFU396hJVgpWstAeGQX6qrmsdH46EybIyggLhHvCWAhxNe5Uvz2lGAyRelBPTI4fA1KSNWCAuw8q8u/13qAfvrhJed44EWdvOoVtbYN66CGUFO6Vl5d3fFleGS1rStU7KAjtzp9QeDFIFGX01dZ41OplHQz5WTl6Xb3MPwLo3m2N3IE8gQn0BSy9Ipisl1D4VoaEWg9wFikD8m+B00edV04ibl1FDcVOUrFdSh7eTdjDhQFsXo9QLavaZMWdu0CFDL6X0f5jvdSfWwcvlpei3BARIBsWsX8IK1OVDXmqRBemHIr7bya+NELTTTjGxFdtqWRQyuIQHxYdev6/IkBF1eP0DnadMfalb0yUvbL7X12BSvX17bC89i+szs5yaS14SxHrp8JA1TBGLHhc/Xqb5yN0h7Kdku1EicQ/rVXb+1rS92yYyvV5Swi7DlnrlAX3tgYzCNbfUd0Gigd9hvuuiiKc4vxA9RqDeSf0yA/Iitg6ESuNDm4E2ItaN8HOGmBnfM69YullKEgFQKpTRMk0eByqOhzu+0tnaHv970Cisb/P8x8eMHNYYayC/OQL17GmlvyZfT++D5Lq/T/6sy6RSYVtg//cHdwF8IgL444NmuZvJT21wVU4pJOq57qT5FnZF8ev4FJDmbJXWp9RpTjzuDvJnMdko1/B1DV9nbaraeZccDtfla7E2zvEfW+L/kSHYe69YxI/7PIZH16cHIfwy/LvPapdApEPvIxuQStt3Sl0UuAmxnckQ+StDF593xG3XfEfVoLiaEMaFvtR7SMBACB13GevJQBw/ws5gSK9sGMyYKqVhcFMTFRt 6ny8WmB4 gefuZl3ibHnXChlsa1czHI8m5fQABWVhCYvbtzWif4TOQK5aEvNV+vhs2GU6El5lRMVJfT8wv9eNAygP2abKXJPzC4uq3Cjp5ZDtKSAYyaCWoVLp+2C44lpAo/sM5yr95L6bRl8M0m59GUf4= 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: List-Subscribe: List-Unsubscribe: IA64 has gone with commit cf8e8658100d ("arch: Remove Itanium (IA-64) architecture"), so remove unnecessary ia64 special mm code and comment in selftests too. Signed-off-by: Jinjiang Tu --- tools/testing/selftests/mm/Makefile | 2 +- tools/testing/selftests/mm/hugepage-mmap.c | 18 +----------------- tools/testing/selftests/mm/hugepage-shm.c | 18 +----------------- tools/testing/selftests/mm/hugepage-vmemmap.c | 17 ++--------------- tools/testing/selftests/mm/map_hugetlb.c | 18 ++---------------- tools/testing/selftests/mm/run_vmtests.sh | 2 +- 6 files changed, 8 insertions(+), 67 deletions(-) diff --git a/tools/testing/selftests/mm/Makefile b/tools/testing/selftests/mm/Makefile index 4ea188be0588..f194042a54ae 100644 --- a/tools/testing/selftests/mm/Makefile +++ b/tools/testing/selftests/mm/Makefile @@ -113,7 +113,7 @@ endif endif -ifneq (,$(filter $(ARCH),arm64 ia64 mips64 parisc64 powerpc riscv64 s390x sparc64 x86_64 s390)) +ifneq (,$(filter $(ARCH),arm64 mips64 parisc64 powerpc riscv64 s390x sparc64 x86_64 s390)) TEST_GEN_FILES += va_high_addr_switch TEST_GEN_FILES += virtual_address_range TEST_GEN_FILES += write_to_hugetlbfs diff --git a/tools/testing/selftests/mm/hugepage-mmap.c b/tools/testing/selftests/mm/hugepage-mmap.c index 267eea2e0e0b..3b1b532f1cbb 100644 --- a/tools/testing/selftests/mm/hugepage-mmap.c +++ b/tools/testing/selftests/mm/hugepage-mmap.c @@ -8,13 +8,6 @@ * like /mnt) using the command mount -t hugetlbfs nodev /mnt. In this * example, the app is requesting memory of size 256MB that is backed by * huge pages. - * - * For the ia64 architecture, the Linux kernel reserves Region number 4 for - * huge pages. That means that if one requires a fixed address, a huge page - * aligned address starting with 0x800000... will be required. If a fixed - * address is not required, the kernel will select an address in the proper - * range. - * Other architectures, such as ppc64, i386 or x86_64 are not so constrained. */ #define _GNU_SOURCE #include @@ -27,15 +20,6 @@ #define LENGTH (256UL*1024*1024) #define PROTECTION (PROT_READ | PROT_WRITE) -/* Only ia64 requires this */ -#ifdef __ia64__ -#define ADDR (void *)(0x8000000000000000UL) -#define FLAGS (MAP_SHARED | MAP_FIXED) -#else -#define ADDR (void *)(0x0UL) -#define FLAGS (MAP_SHARED) -#endif - static void check_bytes(char *addr) { ksft_print_msg("First hex is %x\n", *((unsigned int *)addr)); @@ -74,7 +58,7 @@ int main(void) if (fd < 0) ksft_exit_fail_msg("memfd_create() failed: %s\n", strerror(errno)); - addr = mmap(ADDR, LENGTH, PROTECTION, FLAGS, fd, 0); + addr = mmap(NULL, LENGTH, PROTECTION, MAP_SHARED, fd, 0); if (addr == MAP_FAILED) { close(fd); ksft_exit_fail_msg("mmap(): %s\n", strerror(errno)); diff --git a/tools/testing/selftests/mm/hugepage-shm.c b/tools/testing/selftests/mm/hugepage-shm.c index 478bb1e989e9..ef06260802b5 100644 --- a/tools/testing/selftests/mm/hugepage-shm.c +++ b/tools/testing/selftests/mm/hugepage-shm.c @@ -8,13 +8,6 @@ * SHM_HUGETLB in the shmget system call to inform the kernel that it is * requesting huge pages. * - * For the ia64 architecture, the Linux kernel reserves Region number 4 for - * huge pages. That means that if one requires a fixed address, a huge page - * aligned address starting with 0x800000... will be required. If a fixed - * address is not required, the kernel will select an address in the proper - * range. - * Other architectures, such as ppc64, i386 or x86_64 are not so constrained. - * * Note: The default shared memory limit is quite low on many kernels, * you may need to increase it via: * @@ -39,15 +32,6 @@ #define dprintf(x) printf(x) -/* Only ia64 requires this */ -#ifdef __ia64__ -#define ADDR (void *)(0x8000000000000000UL) -#define SHMAT_FLAGS (SHM_RND) -#else -#define ADDR (void *)(0x0UL) -#define SHMAT_FLAGS (0) -#endif - int main(void) { int shmid; @@ -61,7 +45,7 @@ int main(void) } printf("shmid: 0x%x\n", shmid); - shmaddr = shmat(shmid, ADDR, SHMAT_FLAGS); + shmaddr = shmat(shmid, NULL, 0); if (shmaddr == (char *)-1) { perror("Shared memory attach failure"); shmctl(shmid, IPC_RMID, NULL); diff --git a/tools/testing/selftests/mm/hugepage-vmemmap.c b/tools/testing/selftests/mm/hugepage-vmemmap.c index 894d28c3dd47..df366a4d1b92 100644 --- a/tools/testing/selftests/mm/hugepage-vmemmap.c +++ b/tools/testing/selftests/mm/hugepage-vmemmap.c @@ -22,20 +22,6 @@ #define PM_PFRAME_BITS 55 #define PM_PFRAME_MASK ~((1UL << PM_PFRAME_BITS) - 1) -/* - * For ia64 architecture, Linux kernel reserves Region number 4 for hugepages. - * That means the addresses starting with 0x800000... will need to be - * specified. Specifying a fixed address is not required on ppc64, i386 - * or x86_64. - */ -#ifdef __ia64__ -#define MAP_ADDR (void *)(0x8000000000000000UL) -#define MAP_FLAGS (MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB | MAP_FIXED) -#else -#define MAP_ADDR NULL -#define MAP_FLAGS (MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB) -#endif - static size_t pagesize; static size_t maplength; @@ -113,7 +99,8 @@ int main(int argc, char **argv) exit(1); } - addr = mmap(MAP_ADDR, maplength, PROT_READ | PROT_WRITE, MAP_FLAGS, -1, 0); + addr = mmap(NULL, maplength, PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB, -1, 0); if (addr == MAP_FAILED) { perror("mmap"); exit(1); diff --git a/tools/testing/selftests/mm/map_hugetlb.c b/tools/testing/selftests/mm/map_hugetlb.c index a1f005a90a4f..b47399feab53 100644 --- a/tools/testing/selftests/mm/map_hugetlb.c +++ b/tools/testing/selftests/mm/map_hugetlb.c @@ -4,11 +4,6 @@ * system call with MAP_HUGETLB flag. Before running this program make * sure the administrator has allocated enough default sized huge pages * to cover the 256 MB allocation. - * - * For ia64 architecture, Linux kernel reserves Region number 4 for hugepages. - * That means the addresses starting with 0x800000... will need to be - * specified. Specifying a fixed address is not required on ppc64, i386 - * or x86_64. */ #include #include @@ -21,15 +16,6 @@ #define LENGTH (256UL*1024*1024) #define PROTECTION (PROT_READ | PROT_WRITE) -/* Only ia64 requires this */ -#ifdef __ia64__ -#define ADDR (void *)(0x8000000000000000UL) -#define FLAGS (MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB | MAP_FIXED) -#else -#define ADDR (void *)(0x0UL) -#define FLAGS (MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB) -#endif - static void check_bytes(char *addr) { ksft_print_msg("First hex is %x\n", *((unsigned int *)addr)); @@ -60,7 +46,7 @@ int main(int argc, char **argv) void *addr; size_t hugepage_size; size_t length = LENGTH; - int flags = FLAGS; + int flags = MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB; int shift = 0; hugepage_size = default_huge_page_size(); @@ -85,7 +71,7 @@ int main(int argc, char **argv) ksft_print_msg("Default size hugepages\n"); ksft_print_msg("Mapping %lu Mbytes\n", (unsigned long)length >> 20); - addr = mmap(ADDR, length, PROTECTION, flags, -1, 0); + addr = mmap(NULL, length, PROTECTION, flags, -1, 0); if (addr == MAP_FAILED) ksft_exit_fail_msg("mmap: %s\n", strerror(errno)); diff --git a/tools/testing/selftests/mm/run_vmtests.sh b/tools/testing/selftests/mm/run_vmtests.sh index 36045edb10de..c5797ad1d37b 100755 --- a/tools/testing/selftests/mm/run_vmtests.sh +++ b/tools/testing/selftests/mm/run_vmtests.sh @@ -189,7 +189,7 @@ else fi # filter 64bit architectures -ARCH64STR="arm64 ia64 mips64 parisc64 ppc64 ppc64le riscv64 s390x sparc64 x86_64" +ARCH64STR="arm64 mips64 parisc64 ppc64 ppc64le riscv64 s390x sparc64 x86_64" if [ -z "$ARCH" ]; then ARCH=$(uname -m 2>/dev/null | sed -e 's/aarch64.*/arm64/') fi