All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH 0/3] syscalls/aio: Convert libaio wrapper function to kernel syscall
@ 2021-04-29 11:50 Xie Ziyao
  2021-04-29 11:50 ` [LTP] [PATCH 1/3] syscalls/io_destroy: " Xie Ziyao
                   ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: Xie Ziyao @ 2021-04-29 11:50 UTC (permalink / raw)
  To: ltp

Instead of using the libaio wrapper function, the system call is changed to be invoked via syscall(2).

Xie Ziyao (3):
  syscalls/io_destroy: Convert libaio wrapper function to kernel syscall
  syscalls/io_setup: Convert libaio wrapper function to kernel syscall
  syscalls/io_submit: Convert libaio wrapper function to kernel syscall

 .../kernel/syscalls/io_destroy/io_destroy01.c |  49 ++------
 .../kernel/syscalls/io_setup/io_setup01.c     |  94 +++++----------
 .../kernel/syscalls/io_submit/io_submit01.c   | 110 ++++++++----------
 3 files changed, 86 insertions(+), 167 deletions(-)

--
2.17.1


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [LTP] [PATCH 1/3] syscalls/io_destroy: Convert libaio wrapper function to kernel syscall
  2021-04-29 11:50 [LTP] [PATCH 0/3] syscalls/aio: Convert libaio wrapper function to kernel syscall Xie Ziyao
@ 2021-04-29 11:50 ` Xie Ziyao
  2021-04-29 11:50 ` [LTP] [PATCH 2/3] syscalls/io_setup: " Xie Ziyao
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 14+ messages in thread
From: Xie Ziyao @ 2021-04-29 11:50 UTC (permalink / raw)
  To: ltp

Instead of using the libaio wrapper function, the system call is changed to be invoked via syscall(2).

Signed-off-by: Xie Ziyao <xieziyao@huawei.com>
---
 .../kernel/syscalls/io_destroy/io_destroy01.c | 49 +++++--------------
 1 file changed, 12 insertions(+), 37 deletions(-)

diff --git a/testcases/kernel/syscalls/io_destroy/io_destroy01.c b/testcases/kernel/syscalls/io_destroy/io_destroy01.c
index bb89f61f5..6f14bb8e6 100644
--- a/testcases/kernel/syscalls/io_destroy/io_destroy01.c
+++ b/testcases/kernel/syscalls/io_destroy/io_destroy01.c
@@ -1,55 +1,30 @@
 // SPDX-License-Identifier: GPL-2.0-or-later
 /*
- *   Copyright (c) Crackerjack Project., 2007
- *   Copyright (c) 2011 Cyril Hrubis <chrubis@suse.cz>
- *   Copyright (c) 2017 Xiao Yang <yangx.jy@cn.fujitsu.com>
+ * Copyright (c) Crackerjack Project., 2007
+ * Ported from Crackerjack to LTP by Masatake YAMATO <yamato@redhat.com>
+ * Copyright (c) 2011 Cyril Hrubis <chrubis@suse.cz>
+ * Copyright (c) 2017 Xiao Yang <yangx.jy@cn.fujitsu.com>
  */

-/* Porting from Crackerjack to LTP is done
- * by Masatake YAMATO <yamato@redhat.com>
+/*\
+ * [Description]
  *
- * Description:
- * io_destroy(2) fails and returns -EINVAL if ctx is invalid.
+ * Call io_destroy with an invalid ctx and expects it to return EINVAL.
  */

-#include <errno.h>
-#include <string.h>
+#include <linux/aio_abi.h>
+
 #include "config.h"
 #include "tst_test.h"
-
-#ifdef HAVE_LIBAIO
-#include <libaio.h>
+#include "lapi/syscalls.h"

 static void verify_io_destroy(void)
 {
-	io_context_t ctx;
-
+	aio_context_t ctx;
 	memset(&ctx, 0xff, sizeof(ctx));
-	TEST(io_destroy(ctx));
-
-	if (TST_RET == 0) {
-		tst_res(TFAIL, "io_destroy() succeeded unexpectedly");
-		return;
-	}
-
-	if (TST_RET == -ENOSYS) {
-		tst_res(TCONF, "io_destroy() not supported");
-		return;
-	}
-
-	if (TST_RET == -EINVAL) {
-		tst_res(TPASS, "io_destroy() failed as expected, returned -EINVAL");
-		return;
-	}
-
-	tst_res(TFAIL, "io_destroy() failed unexpectedly, returned -%s expected -EINVAL",
-		tst_strerrno(-TST_RET));
+	TST_EXP_FAIL(tst_syscall(__NR_io_destroy, ctx), EINVAL);
 }

 static struct tst_test test = {
 	.test_all = verify_io_destroy,
 };
-
-#else
-	TST_TEST_TCONF("test requires libaio and it's development packages");
-#endif
--
2.17.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [LTP] [PATCH 2/3] syscalls/io_setup: Convert libaio wrapper function to kernel syscall
  2021-04-29 11:50 [LTP] [PATCH 0/3] syscalls/aio: Convert libaio wrapper function to kernel syscall Xie Ziyao
  2021-04-29 11:50 ` [LTP] [PATCH 1/3] syscalls/io_destroy: " Xie Ziyao
@ 2021-04-29 11:50 ` Xie Ziyao
  2021-04-29 11:50 ` [LTP] [PATCH 3/3] syscalls/io_submit: " Xie Ziyao
  2021-05-03 19:03 ` [LTP] [PATCH 0/3] syscalls/aio: " Petr Vorel
  3 siblings, 0 replies; 14+ messages in thread
From: Xie Ziyao @ 2021-04-29 11:50 UTC (permalink / raw)
  To: ltp

Instead of using the libaio wrapper function, the system call is changed to be invoked via syscall(2).

Signed-off-by: Xie Ziyao <xieziyao@huawei.com>
---
 .../kernel/syscalls/io_setup/io_setup01.c     | 94 +++++--------------
 1 file changed, 26 insertions(+), 68 deletions(-)

diff --git a/testcases/kernel/syscalls/io_setup/io_setup01.c b/testcases/kernel/syscalls/io_setup/io_setup01.c
index 28aee7831..6927aeafc 100644
--- a/testcases/kernel/syscalls/io_setup/io_setup01.c
+++ b/testcases/kernel/syscalls/io_setup/io_setup01.c
@@ -1,92 +1,50 @@
 // SPDX-License-Identifier: GPL-2.0-or-later
 /*
- *   Copyright (c) Crackerjack Project., 2007
- *   Copyright (c) 2011 Cyril Hrubis <chrubis@suse.cz>
- *   Copyright (c) 2017 Xiao Yang <yangx.jy@cn.fujitsu.com>
+ * Copyright (c) Crackerjack Project., 2007
+ * Ported from Crackerjack to LTP by Masatake YAMATO <yamato@redhat.com>
+ * Copyright (c) 2011 Cyril Hrubis <chrubis@suse.cz>
+ * Copyright (c) 2017 Xiao Yang <yangx.jy@cn.fujitsu.com>
  */

-/* Porting from Crackerjack to LTP is done
- * by Masatake YAMATO <yamato@redhat.com>
+/*\
+ * [Description]
  *
- * Description:
- * 1) io_setup(2) succeeds if both nr_events and ctxp are valid.
- * 2) io_setup(2) fails and returns -EINVAL if ctxp is not initialized to 0.
- * 3) io_setup(2) fails and returns -EINVAL if nr_events is invalid.
- * 4) io_setup(2) fails and returns -EFAULT if ctxp is NULL.
- * 5) io_setup(2) fails and returns -EAGAIN if nr_events exceeds the limit
- *    of available events.
+ * - io_setup(2) fails and returns -EFAULT if ctxp is NULL;
+ * - io_setup(2) fails and returns -EINVAL if ctxp is not initialized to 0;
+ * - io_setup(2) fails and returns -EINVAL if nr_events is -1;
+ * - io_setup(2) fails and returns -EAGAIN if nr_events exceeds the limit
+ *   of available events;
+ * - io_setup(2) succeeds if both nr_events and ctxp are valid;
  */

-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
+#include <linux/aio_abi.h>
+
 #include "config.h"
 #include "tst_test.h"
-
-#ifdef HAVE_LIBAIO
-#include <libaio.h>
-
-static void verify_failure(unsigned int nr, io_context_t *ctx, int init_val, long exp_err)
-{
-	if (ctx)
-		memset(ctx, init_val, sizeof(*ctx));
-
-	TEST(io_setup(nr, ctx));
-	if (TST_RET == 0) {
-		tst_res(TFAIL, "io_setup() passed unexpectedly");
-		io_destroy(*ctx);
-		return;
-	}
-
-	if (TST_RET == -exp_err) {
-		tst_res(TPASS, "io_setup() failed as expected, returned -%s",
-			tst_strerrno(exp_err));
-	} else {
-		tst_res(TFAIL, "io_setup() failed unexpectedly, returned -%s "
-			"expected -%s", tst_strerrno(-TST_RET),
-			tst_strerrno(exp_err));
-	}
-}
-
-static void verify_success(unsigned int nr, io_context_t *ctx, int init_val)
-{
-	memset(ctx, init_val, sizeof(*ctx));
-
-	TEST(io_setup(nr, ctx));
-	if (TST_RET == -ENOSYS)
-		tst_brk(TCONF | TRERRNO, "io_setup(): AIO not supported by kernel");
-	if (TST_RET != 0) {
-		tst_res(TFAIL, "io_setup() failed unexpectedly with %li (%s)",
-			TST_RET, tst_strerrno(-TST_RET));
-		return;
-	}
-
-	tst_res(TPASS, "io_setup() passed as expected");
-	io_destroy(*ctx);
-}
+#include "lapi/syscalls.h"

 static void verify_io_setup(void)
 {
-	io_context_t ctx;
-	unsigned int aio_max = 0;
+	aio_context_t ctx;
+	TST_EXP_FAIL(tst_syscall(__NR_io_setup, 1, NULL), EFAULT);

-	verify_success(1, &ctx, 0);
-	verify_failure(1, &ctx, 1, EINVAL);
-	verify_failure(-1, &ctx, 0, EINVAL);
-	verify_failure(1, NULL, 0, EFAULT);
+	memset(&ctx, 1, sizeof(ctx));
+	TST_EXP_FAIL(tst_syscall(__NR_io_setup, 1, &ctx), EINVAL);
+	memset(&ctx, 0, sizeof(ctx));
+	TST_EXP_FAIL(tst_syscall(__NR_io_setup, -1, &ctx), EINVAL);

+	unsigned aio_max = 0;
 	if (!access("/proc/sys/fs/aio-max-nr", F_OK)) {
 		SAFE_FILE_SCANF("/proc/sys/fs/aio-max-nr", "%u", &aio_max);
-		verify_failure(aio_max + 1, &ctx, 0, EAGAIN);
+		TST_EXP_FAIL(tst_syscall(__NR_io_setup, aio_max + 1, &ctx), EAGAIN);
 	} else {
 		tst_res(TCONF, "the aio-max-nr file did not exist");
 	}
+
+	TST_EXP_PASS(tst_syscall(__NR_io_setup, 1, &ctx));
+	TST_EXP_PASS(tst_syscall(__NR_io_destroy, ctx));
 }

 static struct tst_test test = {
 	.test_all = verify_io_setup,
 };
-
-#else
-	TST_TEST_TCONF("test requires libaio and it's development packages");
-#endif
--
2.17.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [LTP] [PATCH 3/3] syscalls/io_submit: Convert libaio wrapper function to kernel syscall
  2021-04-29 11:50 [LTP] [PATCH 0/3] syscalls/aio: Convert libaio wrapper function to kernel syscall Xie Ziyao
  2021-04-29 11:50 ` [LTP] [PATCH 1/3] syscalls/io_destroy: " Xie Ziyao
  2021-04-29 11:50 ` [LTP] [PATCH 2/3] syscalls/io_setup: " Xie Ziyao
@ 2021-04-29 11:50 ` Xie Ziyao
  2021-05-04 12:09   ` Cyril Hrubis
  2021-05-03 19:03 ` [LTP] [PATCH 0/3] syscalls/aio: " Petr Vorel
  3 siblings, 1 reply; 14+ messages in thread
From: Xie Ziyao @ 2021-04-29 11:50 UTC (permalink / raw)
  To: ltp

Instead of using the libaio wrapper function, the system call is changed to be invoked via syscall(2).

Signed-off-by: Xie Ziyao <xieziyao@huawei.com>
---
 .../kernel/syscalls/io_submit/io_submit01.c   | 110 ++++++++----------
 1 file changed, 48 insertions(+), 62 deletions(-)

diff --git a/testcases/kernel/syscalls/io_submit/io_submit01.c b/testcases/kernel/syscalls/io_submit/io_submit01.c
index bbbbc9101..702a7721b 100644
--- a/testcases/kernel/syscalls/io_submit/io_submit01.c
+++ b/testcases/kernel/syscalls/io_submit/io_submit01.c
@@ -1,24 +1,29 @@
 // SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) Crackerjack Project., 2007
+ * Ported from Crackerjack to LTP by Masatake YAMATO <yamato@redhat.com>
  * Copyright (c) 2011-2017 Cyril Hrubis <chrubis@suse.cz>
  */

-/* Porting from Crackerjack to LTP is done
-   by Masatake YAMATO <yamato@redhat.com> */
+/*\
+ * [Description]
+ *
+ * - io_submit(2) fails and returns EINVAL if ctx is invalid;
+ * - io_submit(2) fails and returns EINVAL if nr is invalid;
+ * - io_submit(2) fails and returns EFAULT if iocbpp pointer is invalid;
+ * - io_submit(2) fails and returns EBADF if fd is invalid;
+ * - io_submit(2) should work fine if no-op;
+ */

-#include <errno.h>
-#include <string.h>
-#include <fcntl.h>
+#include <linux/aio_abi.h>

 #include "config.h"
 #include "tst_test.h"
+#include "lapi/syscalls.h"

-#ifdef HAVE_LIBAIO
-#include <libaio.h>
-
-static io_context_t ctx;
-static io_context_t invalid_ctx;
+static aio_context_t ctx;
+static aio_context_t invalid_ctx;
+static char buf[100];

 static struct iocb iocb;
 static struct iocb *iocbs[] = {&iocb};
@@ -39,93 +44,74 @@ static struct iocb *zero_buf_iocbs[] = {&zero_buf_iocb};

 static struct iocb *zero_iocbs[1];

-static char buf[100];
-
 static struct tcase {
-	io_context_t *ctx;
+	aio_context_t *ctx;
 	long nr;
 	struct iocb **iocbs;
 	int exp_errno;
 	const char *desc;
-} tcases[] = {
+} tc[] = {
 	/* Invalid ctx */
-	{&invalid_ctx, 1, iocbs, -EINVAL, "invalid ctx"},
+	{&invalid_ctx, 1, iocbs, EINVAL, "invalid ctx"},
 	/* Invalid nr */
-	{&ctx, -1, iocbs, -EINVAL, "invalid nr"},
+	{&ctx, -1, iocbs, EINVAL, "invalid nr"},
 	/* Invalid pointer */
-	{&ctx, 1, (void*)-1, -EFAULT, "invalid iocbpp pointer"},
-	{&ctx, 1, zero_iocbs, -EFAULT, "NULL iocb pointers"},
+	{&ctx, 1, (void*)-1, EFAULT, "invalid iocbpp pointer"},
+	{&ctx, 1, zero_iocbs, EFAULT, "NULL iocb pointers"},
 	/* Invalid fd */
-	{&ctx, 1, inv_fd_iocbs, -EBADF, "invalid fd"},
-	{&ctx, 1, rdonly_fd_iocbs, -EBADF, "readonly fd for write"},
-	{&ctx, 1, wronly_fd_iocbs, -EBADF, "writeonly fd for read"},
+	{&ctx, 1, inv_fd_iocbs, EBADF, "invalid fd"},
+	{&ctx, 1, rdonly_fd_iocbs, EBADF, "readonly fd for write"},
+	{&ctx, 1, wronly_fd_iocbs, EBADF, "writeonly fd for read"},
 	/* No-op but should work fine */
-	{&ctx, 1, zero_buf_iocbs, 1, "zero buf size"},
+	{&ctx, 1, zero_buf_iocbs, 0, "zero buf size"},
 	{&ctx, 0, NULL, 0, "zero nr"},
 };

-static void setup(void)
+static inline void io_prep_option(struct iocb *cb, int fd, void *buf,
+			size_t count, long long offset, unsigned opcode)
 {
-	TEST(io_setup(1, &ctx));
-	if (TST_RET == -ENOSYS)
-		tst_brk(TCONF | TRERRNO, "io_setup(): AIO not supported by kernel");
-	else if (TST_RET)
-		tst_brk(TBROK | TRERRNO, "io_setup() failed");
+	memset(cb, 0, sizeof(*cb));
+	cb->aio_fildes = fd;
+	cb->aio_lio_opcode = opcode;
+	cb->aio_buf = (uint64_t)buf;
+	cb->aio_offset = offset;
+	cb->aio_nbytes = count;
+}

-	io_prep_pread(&inv_fd_iocb, -1, buf, sizeof(buf), 0);
+static void setup(void)
+{
+	TST_EXP_PASS(tst_syscall(__NR_io_setup, 1, &ctx));
+	io_prep_option(&inv_fd_iocb, -1, buf, sizeof(buf), 0, IOCB_CMD_PREAD);

 	rdonly_fd = SAFE_OPEN("rdonly_file", O_RDONLY | O_CREAT, 0777);
-	io_prep_pwrite(&rdonly_fd_iocb, rdonly_fd, buf, sizeof(buf), 0);
+	io_prep_option(&rdonly_fd_iocb, rdonly_fd, buf, sizeof(buf), 0, IOCB_CMD_PWRITE);

-	io_prep_pread(&zero_buf_iocb, rdonly_fd, buf, 0, 0);
+	io_prep_option(&zero_buf_iocb, rdonly_fd, buf, 0, 0, IOCB_CMD_PREAD);

 	wronly_fd = SAFE_OPEN("wronly_file", O_WRONLY | O_CREAT, 0777);
-	io_prep_pread(&wronly_fd_iocb, wronly_fd, buf, sizeof(buf), 0);
+	io_prep_option(&wronly_fd_iocb, wronly_fd, buf, sizeof(buf), 0, IOCB_CMD_PREAD);
 }

 static void cleanup(void)
 {
 	if (rdonly_fd > 0)
 		SAFE_CLOSE(rdonly_fd);
-
 	if (wronly_fd > 0)
 		SAFE_CLOSE(wronly_fd);
 }

-static const char *errno_name(int err)
+static void run(unsigned int i)
 {
-	if (err <= 0)
-		return tst_strerrno(-err);
-
-	return "SUCCESS";
-}
-
-static void verify_io_submit(unsigned int n)
-{
-	struct tcase *t = &tcases[n];
-	int ret;
-
-	ret = io_submit(*t->ctx, t->nr, t->iocbs);
-
-	if (ret == t->exp_errno) {
-		tst_res(TPASS, "io_submit() with %s failed with %s",
-			t->desc, errno_name(t->exp_errno));
-		return;
-	}
-
-	tst_res(TFAIL, "io_submit() returned %i(%s), expected %s(%i)",
-		ret, ret < 0 ? tst_strerrno(-ret) : "SUCCESS",
-		errno_name(t->exp_errno), t->exp_errno);
+	TEST(tst_syscall(__NR_io_submit, *tc[i].ctx, tc[i].nr, tc[i].iocbs));
+	tst_res(TST_ERR == tc[i].exp_errno ? TPASS : TFAIL,
+		"io_submit(2) with %s returns %s, expected %s",
+		tc[i].desc, tst_strerrno(TST_ERR), tst_strerrno(tc[i].exp_errno));
 }

 static struct tst_test test = {
 	.setup = setup,
 	.cleanup = cleanup,
-	.test = verify_io_submit,
-	.tcnt = ARRAY_SIZE(tcases),
+	.test = run,
+	.tcnt = ARRAY_SIZE(tc),
 	.needs_tmpdir = 1,
 };
-
-#else
-	TST_TEST_TCONF("test requires libaio and it's development packages");
-#endif
--
2.17.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [LTP] [PATCH 0/3] syscalls/aio: Convert libaio wrapper function to kernel syscall
  2021-04-29 11:50 [LTP] [PATCH 0/3] syscalls/aio: Convert libaio wrapper function to kernel syscall Xie Ziyao
                   ` (2 preceding siblings ...)
  2021-04-29 11:50 ` [LTP] [PATCH 3/3] syscalls/io_submit: " Xie Ziyao
@ 2021-05-03 19:03 ` Petr Vorel
  2021-05-04  4:08   ` Jan Stancek
  3 siblings, 1 reply; 14+ messages in thread
From: Petr Vorel @ 2021-05-03 19:03 UTC (permalink / raw)
  To: ltp

Hi Ziyao,

> Instead of using the libaio wrapper function, the system call is changed to be invoked via syscall(2).
Generally LGTM. Major thing for me is to replace <libaio.h> with <linux/aio_abi.h>.
Do you plan to transform other tests which now still use <libaio.h>
(testcases/kernel/io/aio/ and testcases/kernel/io/ltp-aiodio/, which are BTW
problematic on mainline kernel)? I guess it'd be good to keep some test using <libaio.h>.

FYI if you don't prefer put your copyright, I'll update it with LTP copyright.

You also mix more things in single commit: using kernel API instead of libaio
API (that you mentioned) with both code and comments cleanup. But commits are
quite compact thus LGTM.

Reviewed-by: Petr Vorel <pvorel@suse.cz>
For whole patchset.

Kind regards,
Petr

> Xie Ziyao (3):
>   syscalls/io_destroy: Convert libaio wrapper function to kernel syscall
>   syscalls/io_setup: Convert libaio wrapper function to kernel syscall
>   syscalls/io_submit: Convert libaio wrapper function to kernel syscall

>  .../kernel/syscalls/io_destroy/io_destroy01.c |  49 ++------
>  .../kernel/syscalls/io_setup/io_setup01.c     |  94 +++++----------
>  .../kernel/syscalls/io_submit/io_submit01.c   | 110 ++++++++----------
>  3 files changed, 86 insertions(+), 167 deletions(-)

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [LTP] [PATCH 0/3] syscalls/aio: Convert libaio wrapper function to kernel syscall
  2021-05-03 19:03 ` [LTP] [PATCH 0/3] syscalls/aio: " Petr Vorel
@ 2021-05-04  4:08   ` Jan Stancek
  2021-05-04  5:13     ` Petr Vorel
  0 siblings, 1 reply; 14+ messages in thread
From: Jan Stancek @ 2021-05-04  4:08 UTC (permalink / raw)
  To: ltp

On Mon, May 3, 2021 at 9:03 PM Petr Vorel <pvorel@suse.cz> wrote:

> Hi Ziyao,
>
> > Instead of using the libaio wrapper function, the system call is changed
> to be invoked via syscall(2).
>

I probably missed some discussion. Why are we replacing it with syscall?



> Generally LGTM. Major thing for me is to replace <libaio.h> with
> <linux/aio_abi.h>.
> Do you plan to transform other tests which now still use <libaio.h>
> (testcases/kernel/io/aio/ and testcases/kernel/io/ltp-aiodio/, which are
> BTW
> problematic on mainline kernel)? I guess it'd be good to keep some test
> using <libaio.h>.
>
> FYI if you don't prefer put your copyright, I'll update it with LTP
> copyright.
>
> You also mix more things in single commit: using kernel API instead of
> libaio
> API (that you mentioned) with both code and comments cleanup. But commits
> are
> quite compact thus LGTM.
>
> Reviewed-by: Petr Vorel <pvorel@suse.cz>
> For whole patchset.
>
> Kind regards,
> Petr
>
> > Xie Ziyao (3):
> >   syscalls/io_destroy: Convert libaio wrapper function to kernel syscall
> >   syscalls/io_setup: Convert libaio wrapper function to kernel syscall
> >   syscalls/io_submit: Convert libaio wrapper function to kernel syscall
>
> >  .../kernel/syscalls/io_destroy/io_destroy01.c |  49 ++------
> >  .../kernel/syscalls/io_setup/io_setup01.c     |  94 +++++----------
> >  .../kernel/syscalls/io_submit/io_submit01.c   | 110 ++++++++----------
> >  3 files changed, 86 insertions(+), 167 deletions(-)
>
> --
> Mailing list info: https://lists.linux.it/listinfo/ltp
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20210504/4eb588ee/attachment.htm>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [LTP] [PATCH 0/3] syscalls/aio: Convert libaio wrapper function to kernel syscall
  2021-05-04  4:08   ` Jan Stancek
@ 2021-05-04  5:13     ` Petr Vorel
  2021-05-04  6:19       ` xieziyao
  0 siblings, 1 reply; 14+ messages in thread
From: Petr Vorel @ 2021-05-04  5:13 UTC (permalink / raw)
  To: ltp

Hi Jan,

> On Mon, May 3, 2021 at 9:03 PM Petr Vorel <pvorel@suse.cz> wrote:

> > Hi Ziyao,

> > > Instead of using the libaio wrapper function, the system call is changed
> > to be invoked via syscall(2).


> I probably missed some discussion. Why are we replacing it with syscall?

you haven't missed anything. io_destroy(ctx) (libaio.h) is being replaced with
raw syscall (tst_syscall(__NR_io_destroy, ctx).

Kind regards,
Petr

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [LTP] [PATCH 0/3] syscalls/aio: Convert libaio wrapper function to kernel syscall
  2021-05-04  5:13     ` Petr Vorel
@ 2021-05-04  6:19       ` xieziyao
  0 siblings, 0 replies; 14+ messages in thread
From: xieziyao @ 2021-05-04  6:19 UTC (permalink / raw)
  To: ltp

Hi, Petr, Jan,

I am working on adapting the new API to the testsuite of syscalls/io_*.

At the same time, I prefer to replace libaio wrapper function with raw system call(tst_syscall(__NR_io_*)) just for the aio testcases of kernel/syscalls, since this method may be more straightforward, no need to rely on other libraries.

Glad to see your discussion and participation, thanks.

Kind regards,
Ziyao
From: Petr Vorel<pvorel@suse.cz<mailto:pvorel@suse.cz>>
To: Jan Stancek<jstancek@redhat.com<mailto:jstancek@redhat.com>>
Cc: xieziyao<xieziyao@huawei.com<mailto:xieziyao@huawei.com>>;ltp<ltp@lists.linux.it<mailto:ltp@lists.linux.it>>;Richard Palethorpe<rpalethorpe@suse.com<mailto:rpalethorpe@suse.com>>
Subject: Re: [LTP] [PATCH 0/3] syscalls/aio: Convert libaio wrapper function to kernel syscall
Time: 2021-05-04 13:13:53

Hi Jan,

> On Mon, May 3, 2021 at 9:03 PM Petr Vorel <pvorel@suse.cz> wrote:

> > Hi Ziyao,

> > > Instead of using the libaio wrapper function, the system call is changed
> > to be invoked via syscall(2).


> I probably missed some discussion. Why are we replacing it with syscall?

you haven't missed anything. io_destroy(ctx) (libaio.h) is being replaced with
raw syscall (tst_syscall(__NR_io_destroy, ctx).

Kind regards,
Petr
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20210504/f92c4e36/attachment-0001.htm>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [LTP] [PATCH 3/3] syscalls/io_submit: Convert libaio wrapper function to kernel syscall
  2021-04-29 11:50 ` [LTP] [PATCH 3/3] syscalls/io_submit: " Xie Ziyao
@ 2021-05-04 12:09   ` Cyril Hrubis
  2021-05-06 12:27     ` Xie Ziyao
  0 siblings, 1 reply; 14+ messages in thread
From: Cyril Hrubis @ 2021-05-04 12:09 UTC (permalink / raw)
  To: ltp

Hi!
> Instead of using the libaio wrapper function, the system call is
> changed to be invoked via syscall(2).

Ideally we should test _both_ syscall() and the library to maximize the
coverage. We can easily do that with .test_variants, have a look at
stime tests and testcases/kernel/syscalls/stime/stime_var.h how this is
done.

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [LTP] [PATCH 3/3] syscalls/io_submit: Convert libaio wrapper function to kernel syscall
  2021-05-04 12:09   ` Cyril Hrubis
@ 2021-05-06 12:27     ` Xie Ziyao
  2021-05-06 12:57       ` Petr Vorel
  0 siblings, 1 reply; 14+ messages in thread
From: Xie Ziyao @ 2021-05-06 12:27 UTC (permalink / raw)
  To: ltp

Hi, Cyril,

If we should test _both_ syscall() and the library, I would prefer to 
split libaio and native aio into two testcases in this testsuite, since 
<libaio.h> conflicts with <linux/aio_abi.h> during actual modification.

Excuse me, is there any other good way to solve this problem?

Thanks very much!

Kind Regards,
Ziyao

On 2021/5/4 20:09, Cyril Hrubis wrote:
> Hi!
>> Instead of using the libaio wrapper function, the system call is
>> changed to be invoked via syscall(2).
> 
> Ideally we should test _both_ syscall() and the library to maximize the
> coverage. We can easily do that with .test_variants, have a look at
> stime tests and testcases/kernel/syscalls/stime/stime_var.h how this is
> done.
> 

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [LTP] [PATCH 3/3] syscalls/io_submit: Convert libaio wrapper function to kernel syscall
  2021-05-06 12:27     ` Xie Ziyao
@ 2021-05-06 12:57       ` Petr Vorel
  2021-05-06 13:58         ` Cyril Hrubis
  0 siblings, 1 reply; 14+ messages in thread
From: Petr Vorel @ 2021-05-06 12:57 UTC (permalink / raw)
  To: ltp

Hi Ziyao,

> Hi, Cyril,

> If we should test _both_ syscall() and the library, I would prefer to split
> libaio and native aio into two testcases in this testsuite, since <libaio.h>
> conflicts with <linux/aio_abi.h> during actual modification.

> Excuse me, is there any other good way to solve this problem?
NOTE: if most of the test the same, with little help of #ifdef and maybe 1-2
macros we can have single source for both variants (compiling 2 binaries).
See setdomainname and sethostname tests (setdomainname.h).

Kind regards,
Petr

> Thanks very much!

> Kind Regards,
> Ziyao

> On 2021/5/4 20:09, Cyril Hrubis wrote:
> > Hi!
> > > Instead of using the libaio wrapper function, the system call is
> > > changed to be invoked via syscall(2).

> > Ideally we should test _both_ syscall() and the library to maximize the
> > coverage. We can easily do that with .test_variants, have a look at
> > stime tests and testcases/kernel/syscalls/stime/stime_var.h how this is
> > done.


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [LTP] [PATCH 3/3] syscalls/io_submit: Convert libaio wrapper function to kernel syscall
  2021-05-06 12:57       ` Petr Vorel
@ 2021-05-06 13:58         ` Cyril Hrubis
  2021-05-06 18:22           ` Petr Vorel
  0 siblings, 1 reply; 14+ messages in thread
From: Cyril Hrubis @ 2021-05-06 13:58 UTC (permalink / raw)
  To: ltp

Hi!
> > If we should test _both_ syscall() and the library, I would prefer to split
> > libaio and native aio into two testcases in this testsuite, since <libaio.h>
> > conflicts with <linux/aio_abi.h> during actual modification.
> 
> > Excuse me, is there any other good way to solve this problem?
> NOTE: if most of the test the same, with little help of #ifdef and maybe 1-2
> macros we can have single source for both variants (compiling 2 binaries).
> See setdomainname and sethostname tests (setdomainname.h).

Not sure that it's that easy here, since we cannot include libaio.h and
aio_abi.h in a single file without getting conflicts, they define
structures with the same name with possibly different layout, which
makes this very tricky.

I guess that having separate tests for different interface would
probably be easiest solution in this case.

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [LTP] [PATCH 3/3] syscalls/io_submit: Convert libaio wrapper function to kernel syscall
  2021-05-06 13:58         ` Cyril Hrubis
@ 2021-05-06 18:22           ` Petr Vorel
  2021-05-07  8:35             ` Xie Ziyao
  0 siblings, 1 reply; 14+ messages in thread
From: Petr Vorel @ 2021-05-06 18:22 UTC (permalink / raw)
  To: ltp

> Hi!
> > > If we should test _both_ syscall() and the library, I would prefer to split
> > > libaio and native aio into two testcases in this testsuite, since <libaio.h>
> > > conflicts with <linux/aio_abi.h> during actual modification.

> > > Excuse me, is there any other good way to solve this problem?
> > NOTE: if most of the test the same, with little help of #ifdef and maybe 1-2
> > macros we can have single source for both variants (compiling 2 binaries).
> > See setdomainname and sethostname tests (setdomainname.h).

> Not sure that it's that easy here, since we cannot include libaio.h and
> aio_abi.h in a single file without getting conflicts, they define
> structures with the same name with possibly different layout, which
> makes this very tricky.

> I guess that having separate tests for different interface would
> probably be easiest solution in this case.

Sounds reasonable, thanks for info.

Kind regards,
Petr

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [LTP] [PATCH 3/3] syscalls/io_submit: Convert libaio wrapper function to kernel syscall
  2021-05-06 18:22           ` Petr Vorel
@ 2021-05-07  8:35             ` Xie Ziyao
  0 siblings, 0 replies; 14+ messages in thread
From: Xie Ziyao @ 2021-05-07  8:35 UTC (permalink / raw)
  To: ltp

Hi,

Thanks a lot for your suggestions. I just submitted new testcases for 
native AIO.

Please see: https://patchwork.ozlabs.org/project/ltp/list/?series=242617

And if there are no questions, I'll continue with the following:
1. Convert the original libaio testcases to the new API;
2. Add native AIO testcases for other testsuites in kernel/syscalls.

Thanks very much!

Kind Regards,
Ziyao

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2021-05-07  8:35 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-29 11:50 [LTP] [PATCH 0/3] syscalls/aio: Convert libaio wrapper function to kernel syscall Xie Ziyao
2021-04-29 11:50 ` [LTP] [PATCH 1/3] syscalls/io_destroy: " Xie Ziyao
2021-04-29 11:50 ` [LTP] [PATCH 2/3] syscalls/io_setup: " Xie Ziyao
2021-04-29 11:50 ` [LTP] [PATCH 3/3] syscalls/io_submit: " Xie Ziyao
2021-05-04 12:09   ` Cyril Hrubis
2021-05-06 12:27     ` Xie Ziyao
2021-05-06 12:57       ` Petr Vorel
2021-05-06 13:58         ` Cyril Hrubis
2021-05-06 18:22           ` Petr Vorel
2021-05-07  8:35             ` Xie Ziyao
2021-05-03 19:03 ` [LTP] [PATCH 0/3] syscalls/aio: " Petr Vorel
2021-05-04  4:08   ` Jan Stancek
2021-05-04  5:13     ` Petr Vorel
2021-05-04  6:19       ` xieziyao

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.