1. 17 Jan, 2018 33 commits
  2. 10 Jan, 2018 7 commits
    • Greg Kroah-Hartman's avatar
      Linux 4.4.111 · c5ae3a6a
      Greg Kroah-Hartman authored
      c5ae3a6a
    • Greg Kroah-Hartman's avatar
      Fix build error in vma.c · 516fa79e
      Greg Kroah-Hartman authored
      This fixes the following much-reported build issue:
      
      arch/x86/entry/vdso/vma.c: In function ‘map_vdso’:
      arch/x86/entry/vdso/vma.c:175:9: error:
              implicit declaration of function ‘pvclock_pvti_cpu0_va’
      
      on some arches and configurations.
      
      Thanks to Guenter for being persistent enough to get it fixed :)
      Reported-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      516fa79e
    • Borislav Petkov's avatar
      Map the vsyscall page with _PAGE_USER · 6dcf5491
      Borislav Petkov authored
      This needs to happen early in kaiser_pagetable_walk(), before the
      hierarchy is established so that _PAGE_USER permission can be really
      set.
      
      A proper fix would be to teach kaiser_pagetable_walk() to update those
      permissions but the vsyscall page is the only exception here so ...
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Acked-by: default avatarHugh Dickins <hughd@google.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6dcf5491
    • Alexey Dobriyan's avatar
      proc: much faster /proc/vmstat · 90191f71
      Alexey Dobriyan authored
      commit 68ba0326 upstream.
      
      Every current KDE system has process named ksysguardd polling files
      below once in several seconds:
      
      	$ strace -e trace=open -p $(pidof ksysguardd)
      	Process 1812 attached
      	open("/etc/mtab", O_RDONLY|O_CLOEXEC)   = 8
      	open("/etc/mtab", O_RDONLY|O_CLOEXEC)   = 8
      	open("/proc/net/dev", O_RDONLY)         = 8
      	open("/proc/net/wireless", O_RDONLY)    = -1 ENOENT (No such file or directory)
      	open("/proc/stat", O_RDONLY)            = 8
      	open("/proc/vmstat", O_RDONLY)          = 8
      
      Hell knows what it is doing but speed up reading /proc/vmstat by 33%!
      
      Benchmark is open+read+close 1.000.000 times.
      
      			BEFORE
      $ perf stat -r 10 taskset -c 3 ./proc-vmstat
      
       Performance counter stats for 'taskset -c 3 ./proc-vmstat' (10 runs):
      
            13146.768464      task-clock (msec)         #    0.960 CPUs utilized            ( +-  0.60% )
                      15      context-switches          #    0.001 K/sec                    ( +-  1.41% )
                       1      cpu-migrations            #    0.000 K/sec                    ( +- 11.11% )
                     104      page-faults               #    0.008 K/sec                    ( +-  0.57% )
          45,489,799,349      cycles                    #    3.460 GHz                      ( +-  0.03% )
           9,970,175,743      stalled-cycles-frontend   #   21.92% frontend cycles idle     ( +-  0.10% )
           2,800,298,015      stalled-cycles-backend    #   6.16% backend cycles idle       ( +-  0.32% )
          79,241,190,850      instructions              #    1.74  insn per cycle
                                                        #    0.13  stalled cycles per insn  ( +-  0.00% )
          17,616,096,146      branches                  # 1339.956 M/sec                    ( +-  0.00% )
             176,106,232      branch-misses             #    1.00% of all branches          ( +-  0.18% )
      
            13.691078109 seconds time elapsed                                          ( +-  0.03% )
            ^^^^^^^^^^^^
      
      			AFTER
      $ perf stat -r 10 taskset -c 3 ./proc-vmstat
      
       Performance counter stats for 'taskset -c 3 ./proc-vmstat' (10 runs):
      
             8688.353749      task-clock (msec)         #    0.950 CPUs utilized            ( +-  1.25% )
                      10      context-switches          #    0.001 K/sec                    ( +-  2.13% )
                       1      cpu-migrations            #    0.000 K/sec
                     104      page-faults               #    0.012 K/sec                    ( +-  0.56% )
          30,384,010,730      cycles                    #    3.497 GHz                      ( +-  0.07% )
          12,296,259,407      stalled-cycles-frontend   #   40.47% frontend cycles idle     ( +-  0.13% )
           3,370,668,651      stalled-cycles-backend    #  11.09% backend cycles idle       ( +-  0.69% )
          28,969,052,879      instructions              #    0.95  insn per cycle
                                                        #    0.42  stalled cycles per insn  ( +-  0.01% )
           6,308,245,891      branches                  #  726.058 M/sec                    ( +-  0.00% )
             214,685,502      branch-misses             #    3.40% of all branches          ( +-  0.26% )
      
             9.146081052 seconds time elapsed                                          ( +-  0.07% )
             ^^^^^^^^^^^
      
      vsnprintf() is slow because:
      
      1. format_decode() is busy looking for format specifier: 2 branches
         per character (not in this case, but in others)
      
      2. approximately million branches while parsing format mini language
         and everywhere
      
      3.  just look at what string() does /proc/vmstat is good case because
         most of its content are strings
      
      Link: http://lkml.kernel.org/r/20160806125455.GA1187@p183.telecom.bySigned-off-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
      Cc: Joe Perches <joe@perches.com>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarMel Gorman <mgorman@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      90191f71
    • Libor Pechacek's avatar
      module: Issue warnings when tainting kernel · c819a67f
      Libor Pechacek authored
      commit 3205c36c upstream.
      
      While most of the locations where a kernel taint bit is set are accompanied
      with a warning message, there are two which set their bits silently.  If
      the tainting module gets unloaded later on, it is almost impossible to tell
      what was the reason for setting the flag.
      Signed-off-by: default avatarLibor Pechacek <lpechacek@suse.com>
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c819a67f
    • Miroslav Benes's avatar
      module: keep percpu symbols in module's symtab · 7e35bc65
      Miroslav Benes authored
      commit e0224418 upstream.
      
      Currently, percpu symbols from .data..percpu ELF section of a module are
      not copied over and stored in final symtab array of struct module.
      Consequently such symbol cannot be returned via kallsyms API (for
      example kallsyms_lookup_name). This can be especially confusing when the
      percpu symbol is exported. Only its __ksymtab et al. are present in its
      symtab.
      
      The culprit is in layout_and_allocate() function where SHF_ALLOC flag is
      dropped for .data..percpu section. There is in fact no need to copy the
      section to final struct module, because kernel module loader allocates
      extra percpu section by itself. Unfortunately only symbols from
      SHF_ALLOC sections are copied due to a check in is_core_symbol().
      
      The patch changes is_core_symbol() function to copy over also percpu
      symbols (their st_shndx points to .data..percpu ELF section). We do it
      only if CONFIG_KALLSYMS_ALL is set to be consistent with the rest of the
      function (ELF section is SHF_ALLOC but !SHF_EXECINSTR). Finally
      elf_type() returns type 'a' for a percpu symbol because its address is
      absolute.
      Signed-off-by: default avatarMiroslav Benes <mbenes@suse.cz>
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7e35bc65
    • Michal Marek's avatar
      genksyms: Handle string literals with spaces in reference files · 104fd57d
      Michal Marek authored
      commit a78f70e8 upstream.
      
      The reference files use spaces to separate tokens, however, we must
      preserve spaces inside string literals. Currently the only case in the
      tree is struct edac_raw_error_desc in <linux/edac.h>:
      
      $ KBUILD_SYMTYPES=1 make -s drivers/edac/amd64_edac.symtypes
      $ mv drivers/edac/amd64_edac.{symtypes,symref}
      $ KBUILD_SYMTYPES=1 make -s drivers/edac/amd64_edac.symtypes
      drivers/edac/amd64_edac.c:527: warning: amd64_get_dram_hole_info: modversion changed because of changes in struct edac_raw_error_desc
      Signed-off-by: default avatarMichal Marek <mmarek@suse.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      104fd57d