Merge tag 'linux-kselftest-fixes-5.10-rc1' of git://git.kernel.org/pub/scm/linux...
authorLinus Torvalds <torvalds@linux-foundation.org>
Wed, 14 Oct 2020 21:23:51 +0000 (14:23 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 14 Oct 2020 21:23:51 +0000 (14:23 -0700)
Pull kselftest updates from Shuah Khan:

 - a selftests harness fix to flush stdout before forking to avoid
   parent and child printing duplicates messages. This is evident when
   test output is redirected to a file.

 - a tools/ wide change to avoid comma separated statements from Joe
   Perches. This fix spans tools/lib, tools/power/cpupower, and
   selftests.

* tag 'linux-kselftest-fixes-5.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest:
  tools: Avoid comma separated statements
  selftests/harness: Flush stdout before forking

1  2 
tools/testing/selftests/vm/gup_benchmark.c

  #define PAGE_SIZE sysconf(_SC_PAGESIZE)
  
  #define GUP_FAST_BENCHMARK    _IOWR('g', 1, struct gup_benchmark)
 -#define GUP_LONGTERM_BENCHMARK        _IOWR('g', 2, struct gup_benchmark)
 -#define GUP_BENCHMARK         _IOWR('g', 3, struct gup_benchmark)
 +#define GUP_BENCHMARK         _IOWR('g', 2, struct gup_benchmark)
  
  /* Similar to above, but use FOLL_PIN instead of FOLL_GET. */
 -#define PIN_FAST_BENCHMARK    _IOWR('g', 4, struct gup_benchmark)
 -#define PIN_BENCHMARK         _IOWR('g', 5, struct gup_benchmark)
 +#define PIN_FAST_BENCHMARK    _IOWR('g', 3, struct gup_benchmark)
 +#define PIN_BENCHMARK         _IOWR('g', 4, struct gup_benchmark)
 +#define PIN_LONGTERM_BENCHMARK        _IOWR('g', 5, struct gup_benchmark)
  
  /* Just the flags we need, copied from mm.h: */
  #define FOLL_WRITE    0x01    /* check pte is writable */
@@@ -52,9 -52,6 +52,9 @@@ int main(int argc, char **argv
                case 'b':
                        cmd = PIN_BENCHMARK;
                        break;
 +              case 'L':
 +                      cmd = PIN_LONGTERM_BENCHMARK;
 +                      break;
                case 'm':
                        size = atoi(optarg) * MB;
                        break;
@@@ -70,6 -67,9 +70,6 @@@
                case 'T':
                        thp = 0;
                        break;
 -              case 'L':
 -                      cmd = GUP_LONGTERM_BENCHMARK;
 -                      break;
                case 'U':
                        cmd = GUP_BENCHMARK;
                        break;
                gup.flags |= FOLL_WRITE;
  
        fd = open("/sys/kernel/debug/gup_benchmark", O_RDWR);
-       if (fd == -1)
-               perror("open"), exit(1);
+       if (fd == -1) {
+               perror("open");
+               exit(1);
+       }
  
        p = mmap(NULL, size, PROT_READ | PROT_WRITE, flags, filed, 0);
-       if (p == MAP_FAILED)
-               perror("mmap"), exit(1);
+       if (p == MAP_FAILED) {
+               perror("mmap");
+               exit(1);
+       }
        gup.addr = (unsigned long)p;
  
        if (thp == 1)
  
        for (i = 0; i < repeats; i++) {
                gup.size = size;
-               if (ioctl(fd, cmd, &gup))
-                       perror("ioctl"), exit(1);
+               if (ioctl(fd, cmd, &gup)) {
+                       perror("ioctl");
+                       exit(1);
+               }
  
                printf("Time: get:%lld put:%lld us", gup.get_delta_usec,
                        gup.put_delta_usec);