Re: [LTP] [PATCH] Simple tests for cross memory attach (process_vm_[readv|writev] syscalls)

Jan Stancek
2012-05-15T14:56:32Z

----- Original Message -----
> From: "Caspar Zhang" <caspar@casparzhang.com>
> To: "Christopher Yeoh" <cyeoh@au1.ibm.com>
> Cc: ltp-list@lists.sourceforge.net, "Jan Stancek" <jstancek@redhat.com>
> Sent: Wednesday, 9 May, 2012 3:00:51 PM
> Subject: Re: [LTP] [PATCH] Simple tests for cross memory attach (process_vm_[readv|writev] syscalls)
> Hi Chris, thanks very much for the patch, I tried to backport your
> testcases in http://ozlabs.org/~cyeoh/cma/ to LTP and composed an
> unfinished version, then I was busy for other things. I'm happy to
> see
> you can backport it by yourself :) There are some more new cma
> patches
> (aims on testing retcode and errnos) sent by Jan Stancek (cc-ed) [1],
> I
> think we need to discuss the testcase organization..
>
> And I will review the testcases when I get more free time.

Hi,

I looked at testcases sent by Chris. Good news is, they
do not overlap (in terms of functionality) with mine :-).

The patch need some polishing to match the style guide:
- indentation
- I think output should be TINFO, rather than plain printf
- single statement if without { }
- I would split some code to more functions, for example process_vm_writev01.c
main function seems complex

As for test organization, I think we need to decide 2 issues:
1. directory structure
a)
testcases/kernel/syscalls/cma/
testcases/kernel/syscalls/cma/process_vm_readv
testcases/kernel/syscalls/cma/process_vm_writev
b)
testcases/kernel/syscalls/process_vm_readv
testcases/kernel/syscalls/process_vm_writev

I'm preferring a) as these 2 syscalls are closely related,
and we already have need to share code.

2. how to invoke new syscalls
a)
Patch from Chris is defining new syscall numbers in test and
using syscall(2).

b)
My patch adds configure check for glibc wrappers process_vm_readv/writev
and if those does not exists it checks for __NR_process_vm_readv.

I think we should not define syscall numbers in tests directly,
but I'm relying on LTP maintainers to provide guidance here.
In any case, if you run it on older kernel it should end with TCONF.

I would go with using Chris' process_vm.h, but remove syscall number
defines and use names that wont conflict with glibc wrappers:
test_process_vm_readv
test_process_vm_writev

These could be function pointers, that would get initialized with
function using glibc wrapper
function using syscall(__NR_process_vm_readv,..)
or NULL

each testcase could check in setup for NULL, and end with TCONF,
if there is no way invoke that syscall.

There was question from Caspar, if we should check for both glibc wrapper
and syscall number (http://thread.gmane.org/gmane.linux.ltp/16055).
I think we should, as we use glibc wrappers by default.

Any thoughts?

Regards,
Jan

>
> Thanks,
> Caspar
>
> [1]
> http://thread.gmane.org/gmane.linux.ltp/16052
> http://thread.gmane.org/gmane.linux.ltp/16053
> http://thread.gmane.org/gmane.linux.ltp/16054
> http://thread.gmane.org/gmane.linux.ltp/16055