From mboxrd@z Thu Jan 1 00:00:00 1970 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 picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EA94FC4332F for ; Wed, 16 Nov 2022 11:27:11 +0000 (UTC) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 7C07C3CD04D for ; Wed, 16 Nov 2022 12:27:10 +0100 (CET) Received: from in-2.smtp.seeweb.it (in-2.smtp.seeweb.it [IPv6:2001:4b78:1:20::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id D05E53CD039 for ; Wed, 16 Nov 2022 12:26:30 +0100 (CET) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by in-2.smtp.seeweb.it (Postfix) with ESMTPS id D475B600858 for ; Wed, 16 Nov 2022 12:26:29 +0100 (CET) Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2AGAqpQx019690; Wed, 16 Nov 2022 11:26:28 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=apJblzrnSjzSUKt9DaZ/XyfCn77rKnDIzBssBY3NdOE=; b=DT0F5AHoCeKSYCAR4slpIQGCnjsLlRwojwRZUFv0eWPQR8xsH4vNxhssyUPRipWSV5V8 2BBgcKmmCa+z3PQCNdIRJeim6+GBh09aBbcUJlj4kkOI+VywINv+nt+dVthc1673T3P0 1wogTNF12O1r+zMT0sl9dBC8OhzBzER1DgZpNGU/qFfs1pKScYGpIYlouk3rkXfzVT71 WncWh30o64b++XPlfMim5oVGuKKQa7tG4M3o1lfspOxkSiE0qv6yUjRBHA/GLmIK4OwJ CGplJBxPUUT/5B+00MXZZcjD12dHxE5+zQmx7p2dCJzg7g2Qi5INvkC3nwhMyU1Q4fhF zg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3kvxgggtx6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 16 Nov 2022 11:26:27 +0000 Received: from m0098416.ppops.net (m0098416.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 2AGArYQn022244; Wed, 16 Nov 2022 11:26:27 GMT Received: from ppma03fra.de.ibm.com (6b.4a.5195.ip4.static.sl-reverse.com [149.81.74.107]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3kvxgggtwp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 16 Nov 2022 11:26:27 +0000 Received: from pps.filterd (ppma03fra.de.ibm.com [127.0.0.1]) by ppma03fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 2AGBKuKB016928; Wed, 16 Nov 2022 11:26:25 GMT Received: from b06avi18626390.portsmouth.uk.ibm.com (b06avi18626390.portsmouth.uk.ibm.com [9.149.26.192]) by ppma03fra.de.ibm.com with ESMTP id 3kt348vb5v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 16 Nov 2022 11:26:25 +0000 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 2AGBKMlO49611244 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 16 Nov 2022 11:20:22 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0E94942042; Wed, 16 Nov 2022 11:26:22 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C38764203F; Wed, 16 Nov 2022 11:26:19 +0000 (GMT) Received: from tarunpc.in.ibm.com (unknown [9.199.157.25]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 16 Nov 2022 11:26:19 +0000 (GMT) From: Tarun Sahu To: ltp@lists.linux.it Date: Wed, 16 Nov 2022 16:55:12 +0530 Message-Id: <20221116112516.261535-4-tsahu@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20221116112516.261535-1-tsahu@linux.ibm.com> References: <20221116112516.261535-1-tsahu@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: YavMdoXvnI2-qAM2B7V1tYS32TUWGViu X-Proofpoint-ORIG-GUID: 31dBArmQ2zaUSRUy0z7qUtuH41UyC5mG X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-16_02,2022-11-16_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 suspectscore=0 phishscore=0 mlxscore=0 priorityscore=1501 spamscore=0 bulkscore=0 mlxlogscore=999 malwarescore=0 clxscore=1015 adultscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211160074 X-Virus-Scanned: clamav-milter 0.102.4 at in-2.smtp.seeweb.it X-Virus-Status: Clean Subject: [LTP] [PATCH v4 3/7] Hugetlb: Migrating libhugetlbfs directio X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: geetika@linux.ibm.com, sbhat@linux.ibm.com, aneesh.kumar@linux.ibm.com, vaibhav@linux.ibm.com, mike.kravetz@oracle.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ltp-bounces+ltp=archiver.kernel.org@lists.linux.it Sender: "ltp" Migrating the libhugetlbfs/testcases/direct.c test Test Description: This Test perform Direct Write/Read from/To hugetlbfs file which is mapped to process address space. The test is checking if it succeeds and data written or read is not corrupted. Signed-off-by: Tarun Sahu --- runtest/hugetlb | 1 + testcases/kernel/mem/.gitignore | 1 + .../kernel/mem/hugetlb/hugemmap/hugemmap11.c | 87 +++++++++++++++++++ 3 files changed, 89 insertions(+) create mode 100644 testcases/kernel/mem/hugetlb/hugemmap/hugemmap11.c diff --git a/runtest/hugetlb b/runtest/hugetlb index 8a56d52a3..b9ee7227d 100644 --- a/runtest/hugetlb +++ b/runtest/hugetlb @@ -7,6 +7,7 @@ hugemmap07 hugemmap07 hugemmap08 hugemmap08 hugemmap09 hugemmap09 hugemmap10 hugemmap10 +hugemmap11 hugemmap11 hugemmap05_1 hugemmap05 -m hugemmap05_2 hugemmap05 -s hugemmap05_3 hugemmap05 -s -m diff --git a/testcases/kernel/mem/.gitignore b/testcases/kernel/mem/.gitignore index e7def68cb..3e64b67be 100644 --- a/testcases/kernel/mem/.gitignore +++ b/testcases/kernel/mem/.gitignore @@ -8,6 +8,7 @@ /hugetlb/hugemmap/hugemmap08 /hugetlb/hugemmap/hugemmap09 /hugetlb/hugemmap/hugemmap10 +/hugetlb/hugemmap/hugemmap11 /hugetlb/hugeshmat/hugeshmat01 /hugetlb/hugeshmat/hugeshmat02 /hugetlb/hugeshmat/hugeshmat03 diff --git a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap11.c b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap11.c new file mode 100644 index 000000000..48ecfe9d8 --- /dev/null +++ b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap11.c @@ -0,0 +1,87 @@ +// SPDX-License-Identifier: LGPL-2.1-or-later +/* + * Copyright (C) 2005-2006 IBM Corporation. + * Author: David Gibson & Adam Litke + */ + +/*\ + * [Description] + * + * This Test perform Direct Write/Read from/To hugetlbfs file + * which is mapped to process address space. The test is checking if it + * succeeds and data written or read is not corrupted. + * + */ + +#define _GNU_SOURCE +#include +#include +#include +#include +#include + +#include "hugetlb.h" + +#define P0 "ffffffff" +#define IOSZ 4096 +#define NORMAL_PATH "" +#define MNTPOINT "hugetlbfs/" + +static long hpage_size; +static int fd = -1, nfd = -1; + +static void run_test(void) +{ + void *p; + char buf[IOSZ] __attribute__((aligned(IOSZ))); + + fd = tst_creat_unlinked(MNTPOINT, 0); + nfd = tst_creat_unlinked(NORMAL_PATH, O_DIRECT); + p = SAFE_MMAP(NULL, hpage_size, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0); + memcpy(p, P0, 8); + + SAFE_WRITE(1, nfd, p, IOSZ); + SAFE_LSEEK(nfd, 0, SEEK_SET); + + SAFE_READ(1, nfd, buf, IOSZ); + if (memcmp(P0, buf, 8)) { + tst_res(TFAIL, "Memory mismatch after Direct-IO write"); + goto cleanup; + } + SAFE_LSEEK(nfd, 0, SEEK_SET); + + memset(p, 0, IOSZ); + SAFE_READ(1, nfd, p, IOSZ); + + if (memcmp(p, P0, 8)) + tst_res(TFAIL, "Memory mismatch after Direct-IO read"); + else + tst_res(TPASS, "Direct-IO write and read from/to hugepages is successful"); +cleanup: + SAFE_MUNMAP(p, hpage_size); + SAFE_CLOSE(fd); + SAFE_CLOSE(nfd); +} + +static void setup(void) +{ + hpage_size = SAFE_READ_MEMINFO(MEMINFO_HPAGE_SIZE)*1024; +} + +static void cleanup(void) +{ + if (fd > 0) + SAFE_CLOSE(fd); + if (nfd > 0) + SAFE_CLOSE(nfd); +} + +static struct tst_test test = { + .needs_root = 1, + .mntpoint = MNTPOINT, + .needs_hugetlbfs = 1, + .setup = setup, + .cleanup = cleanup, + .test_all = run_test, + .hugepages = {1, TST_NEEDS}, +}; -- 2.31.1 -- Mailing list info: https://lists.linux.it/listinfo/ltp