From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Stancek Date: Wed, 26 Jun 2019 05:59:37 -0400 (EDT) Subject: [LTP] [PATCH v4 2/2] pkey: add test for memory protection keys In-Reply-To: References: <20190626071538.29486-1-liwang@redhat.com> <20190626071538.29486-2-liwang@redhat.com> <285629943.30156546.1561537194409.JavaMail.zimbra@redhat.com> Message-ID: <1695359151.30173908.1561543177520.JavaMail.zimbra@redhat.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: ltp@lists.linux.it ----- Original Message ----- > On Wed, Jun 26, 2019 at 4:20 PM Jan Stancek wrote: > > > > > ----- Original Message ----- > > > + > > > +static void setup(void) > > > +{ > > > + int i, fd; > > > + > > > + if (access(PATH_VM_NRHPS, F_OK)) { > > > + tst_res(TINFO, "Huge page is not supported"); > > > + size = getpagesize(); > > > + no_hugepage = 1; > > > + } else { > > > + int val; > > > + > > > + SAFE_FILE_PRINTF(PATH_VM_NRHPS, "%d", 1); > > > > This is still SAFE write, which may trigger TBROK: > > > > # ./pkey01 > > tst_test.c:1100: INFO: Timeout per run is 0h 05m 00s > > safe_file_ops.c:301: BROK: Failed to close FILE > > '/proc/sys/vm/nr_hugepages' at pkey01.c:67: EOPNOTSUPP > > safe_macros.c:773: WARN: pkey01.c:91: umount(tmp_pkey) failed: ENOENT > > safe_macros.c:184: WARN: pkey01.c:92: rmdir(tmp_pkey) failed: ENOENT > > > > Er, sorry about still not working here. > > If a system(e.g PowerKVM guest) configured with NO huge page support, then > the file '/proc/sys/vm/nr_hugepages' exist but EOPNOTSUPP to read/write. In > this key01, perhaps I shouldn't use the "/proc/.../nr_hugepages" to detect > that at the beginning. > > Seems the correct way is to use "/sys/kernel/mm/hugepages/" for huge page > detecting and leave the SAFE_FILE_* still in setup(). Because we need to > catch the "/proc/.../nr_hugepages" open/close or read/write issue in > testing. That should work, I see we used that in some tests already. > > What do you think? Should we mask the EOPNOTSUPP as a TCONF skipping or > others? > > -- > Regards, > Li Wang >