mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-11 19:19:42 +00:00
userfaultfd: selftest: return an error if BOUNCE_VERIFY fails
This will report the error in the exit code, in addition of the fprintf. Signed-off-by: Andrea Arcangeli <aarcange@redhat.com> Cc: Dr. David Alan Gilbert <dgilbert@redhat.com> Cc: Michael Ellerman <mpe@ellerman.id.au> Cc: Shuah Khan <shuahkh@osg.samsung.com> Cc: Thierry Reding <treding@nvidia.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
1f5fee2cf2
commit
a5932bf573
1 changed files with 6 additions and 3 deletions
|
@ -422,7 +422,7 @@ static int userfaultfd_stress(void)
|
||||||
struct uffdio_register uffdio_register;
|
struct uffdio_register uffdio_register;
|
||||||
struct uffdio_api uffdio_api;
|
struct uffdio_api uffdio_api;
|
||||||
unsigned long cpu;
|
unsigned long cpu;
|
||||||
int uffd_flags;
|
int uffd_flags, err;
|
||||||
unsigned long userfaults[nr_cpus];
|
unsigned long userfaults[nr_cpus];
|
||||||
|
|
||||||
if (posix_memalign(&area, page_size, nr_pages * page_size)) {
|
if (posix_memalign(&area, page_size, nr_pages * page_size)) {
|
||||||
|
@ -499,6 +499,7 @@ static int userfaultfd_stress(void)
|
||||||
pthread_attr_init(&attr);
|
pthread_attr_init(&attr);
|
||||||
pthread_attr_setstacksize(&attr, 16*1024*1024);
|
pthread_attr_setstacksize(&attr, 16*1024*1024);
|
||||||
|
|
||||||
|
err = 0;
|
||||||
while (bounces--) {
|
while (bounces--) {
|
||||||
unsigned long expected_ioctls;
|
unsigned long expected_ioctls;
|
||||||
|
|
||||||
|
@ -583,8 +584,9 @@ static int userfaultfd_stress(void)
|
||||||
area_dst + nr * page_size,
|
area_dst + nr * page_size,
|
||||||
sizeof(pthread_mutex_t))) {
|
sizeof(pthread_mutex_t))) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"error mutex 2 %lu\n",
|
"error mutex %lu\n",
|
||||||
nr);
|
nr);
|
||||||
|
err = 1;
|
||||||
bounces = 0;
|
bounces = 0;
|
||||||
}
|
}
|
||||||
if (*area_count(area_dst, nr) != count_verify[nr]) {
|
if (*area_count(area_dst, nr) != count_verify[nr]) {
|
||||||
|
@ -593,6 +595,7 @@ static int userfaultfd_stress(void)
|
||||||
*area_count(area_src, nr),
|
*area_count(area_src, nr),
|
||||||
count_verify[nr],
|
count_verify[nr],
|
||||||
nr);
|
nr);
|
||||||
|
err = 1;
|
||||||
bounces = 0;
|
bounces = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -609,7 +612,7 @@ static int userfaultfd_stress(void)
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
|
|
Loading…
Reference in a new issue