1. 08 3月, 2017 11 次提交
  2. 07 3月, 2017 1 次提交
    • J
      objtool: Fix another GCC jump table detection issue · 5c51f4ae
      Josh Poimboeuf 提交于
      Arnd Bergmann reported a (false positive) objtool warning:
      
        drivers/infiniband/sw/rxe/rxe_resp.o: warning: objtool: rxe_responder()+0xfe: sibling call from callable instruction with changed frame pointer
      
      The issue is in find_switch_table().  It tries to find a switch
      statement's jump table by walking backwards from an indirect jump
      instruction, looking for a relocation to the .rodata section.  In this
      case it stopped walking prematurely: the first .rodata relocation it
      encountered was for a variable (resp_state_name) instead of a jump
      table, so it just assumed there wasn't a jump table.
      
      The fix is to ignore any .rodata relocation which refers to an ELF
      object symbol.  This works because the jump tables are anonymous and
      have no symbols associated with them.
      Reported-by: NArnd Bergmann <arnd@arndb.de>
      Tested-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NJosh Poimboeuf <jpoimboe@redhat.com>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Fixes: 3732710f ("objtool: Improve rare switch jump table pattern detection")
      Link: http://lkml.kernel.org/r/20170302225723.3ndbsnl4hkqbne7a@trebleSigned-off-by: NIngo Molnar <mingo@kernel.org>
      5c51f4ae
  3. 03 3月, 2017 2 次提交
    • S
      selftest/powerpc: Fix false failures for skipped tests · a6d8a215
      Sachin Sant 提交于
      Tests under alignment subdirectory are skipped when executed on previous
      generation hardware, but harness still marks them as failed.
      
        test: test_copy_unaligned
        tags: git_version:unknown
        [SKIP] Test skipped on line 26
        skip: test_copy_unaligned
        selftests: copy_unaligned [FAIL]
      
      The MAGIC_SKIP_RETURN_VALUE value assigned to rc variable is retained till
      the program exit which causes the test to be marked as failed.
      
      This patch resets the value before returning to the main() routine.
      With this patch the test o/p is as follows:
      
        test: test_copy_unaligned
        tags: git_version:unknown
        [SKIP] Test skipped on line 26
        skip: test_copy_unaligned
        selftests: copy_unaligned [PASS]
      Signed-off-by: NSachin Sant <sachinp@linux.vnet.ibm.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      a6d8a215
    • L
      give up on gcc ilog2() constant optimizations · 474c9015
      Linus Torvalds 提交于
      gcc-7 has an "optimization" pass that completely screws up, and
      generates the code expansion for the (impossible) case of calling
      ilog2() with a zero constant, even when the code gcc compiles does not
      actually have a zero constant.
      
      And we try to generate a compile-time error for anybody doing ilog2() on
      a constant where that doesn't make sense (be it zero or negative).  So
      now gcc7 will fail the build due to our sanity checking, because it
      created that constant-zero case that didn't actually exist in the source
      code.
      
      There's a whole long discussion on the kernel mailing about how to work
      around this gcc bug.  The gcc people themselevs have discussed their
      "feature" in
      
         https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72785
      
      but it's all water under the bridge, because while it looked at one
      point like it would be solved by the time gcc7 was released, that was
      not to be.
      
      So now we have to deal with this compiler braindamage.
      
      And the only simple approach seems to be to just delete the code that
      tries to warn about bad uses of ilog2().
      
      So now "ilog2()" will just return 0 not just for the value 1, but for
      any non-positive value too.
      
      It's not like I can recall anybody having ever actually tried to use
      this function on any invalid value, but maybe the sanity check just
      meant that such code never made it out in public.
      Reported-by: NLaura Abbott <labbott@redhat.com>
      Cc: John Stultz <john.stultz@linaro.org>,
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      474c9015
  4. 02 3月, 2017 3 次提交
    • S
      selftests: lib.mk Fix individual test builds · e53aff45
      Shuah Khan 提交于
      In commit a8ba798b ("selftests: enable O and KBUILD_OUTPUT"), added
      support to generate compile targets in a user specified directory. OUTPUT
      variable controls the location which is undefined when tests are built in
      the test directory or with "make -C tools/testing/selftests/x86".
      
      make -C tools/testing/selftests/x86/
      make: Entering directory '/lkml/linux_4.11/tools/testing/selftests/x86'
      Makefile:44: warning: overriding recipe for target 'clean'
      ../lib.mk:51: warning: ignoring old recipe for target 'clean'
      gcc -m64 -o /single_step_syscall_64 -O2 -g -std=gnu99 -pthread -Wall  single_step_syscall.c -lrt -ldl
      /usr/bin/ld: cannot open output file /single_step_syscall_64: Permission denied
      collect2: error: ld returned 1 exit status
      Makefile:50: recipe for target '/single_step_syscall_64' failed
      make: *** [/single_step_syscall_64] Error 1
      make: Leaving directory '/lkml/linux_4.11/tools/testing/selftests/x86'
      
      Same failure with "cd tools/testing/selftests/x86/;make" run.
      
      Fix this with a change to lib.mk to define OUTPUT to be the pwd when
      MAKELEVEL is 0. This covers both cases mentioned above.
      Reported-by: NIngo Molnar <mingo@kernel.org>
      Signed-off-by: NShuah Khan <shuahkh@osg.samsung.com>
      e53aff45
    • J
      objtool, modules: Discard objtool annotation sections for modules · e390f9a9
      Josh Poimboeuf 提交于
      The '__unreachable' and '__func_stack_frame_non_standard' sections are
      only used at compile time.  They're discarded for vmlinux but they
      should also be discarded for modules.
      
      Since this is a recurring pattern, prefix the section names with
      ".discard.".  It's a nice convention and vmlinux.lds.h already discards
      such sections.
      
      Also remove the 'a' (allocatable) flag from the __unreachable section
      since it doesn't make sense for a discarded section.
      Suggested-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NJosh Poimboeuf <jpoimboe@redhat.com>
      Cc: Jessica Yu <jeyu@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Fixes: d1091c7f ("objtool: Improve detection of BUG() and other dead ends")
      Link: http://lkml.kernel.org/r/20170301180444.lhd53c5tibc4ns77@trebleSigned-off-by: NIngo Molnar <mingo@kernel.org>
      e390f9a9
    • A
      selftests/x86: Add a basic selftest for ioperm · 0eb1d0fa
      Andy Lutomirski 提交于
      This doesn't fully exercise the interaction between KVM and ioperm(),
      but it does test basic functionality.
      Signed-off-by: NAndy Lutomirski <luto@kernel.org>
      Signed-off-by: NRadim Krčmář <rkrcmar@redhat.com>
      0eb1d0fa
  5. 01 3月, 2017 23 次提交
    • B
      x86/events: Remove last remnants of old filenames · 940b2f2f
      Borislav Petkov 提交于
      Update to the new file paths, remove them from introductory comments.
      Signed-off-by: NBorislav Petkov <bp@suse.de>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/20170218113140.8051-1-bp@alien8.deSigned-off-by: NThomas Gleixner <tglx@linutronix.de>
      940b2f2f
    • D
      x86/selftests: Add clobbers for int80 on x86_64 · 2a4d0c62
      Dmitry Safonov 提交于
      Kernel erases R8..R11 registers prior returning to userspace
      from int80:
      
        https://lkml.org/lkml/2009/10/1/164
      
      GCC can reuse these registers and doesn't expect them to change
      during syscall invocation. I met this kind of bug in CRIU once
      GCC 6.1 and CLANG stored local variables in those registers
      and the kernel zerofied them during syscall:
      
        https://github.com/xemul/criu/commit/990d33f1a1cdd17bca6c2eb059ab3be2564f7fa2
      
      By that reason I suggest to add those registers to clobbers
      in selftests.  Also, as noted by Andy - removed unneeded clobber
      for flags in INT $0x80 inline asm.
      Signed-off-by: NDmitry Safonov <dsafonov@virtuozzo.com>
      Acked-by: NAndy Lutomirski <luto@kernel.org>
      Cc: 0x7f454c46@gmail.com
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Josh Poimboeuf <jpoimboe@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Shuah Khan <shuah@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-kselftest@vger.kernel.org
      Link: http://lkml.kernel.org/r/20170213101336.20486-1-dsafonov@virtuozzo.comSigned-off-by: NIngo Molnar <mingo@kernel.org>
      2a4d0c62
    • D
      tools/testing/nvdimm: make iset cookie predictable · df06a2d5
      Dan Williams 提交于
      For testing changes to the iset cookie algorithm we need a value that is
      constant from run-to-run.
      
      Stop including dynamic data in the emulated region_offset values. Also,
      pick values that sort in a different order depending on whether the
      comparison is a memcmp() of two 8-byte arrays or subtraction of two
      64-bit values.
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      df06a2d5
    • L
      tools/power turbostat: version 17.02.24 · e3942ed8
      Len Brown 提交于
      The turbostat before this last set of changes is obsolete.
      This new version can do a lot more, but it also has
      some different defaults, that might catch some off-guard.
      So it seems a good time to give a new version number.
      Signed-off-by: NLen Brown <len.brown@intel.com>
      e3942ed8
    • L
      tools/power turbostat: bugfix: --add u32 was printed as u64 · 5f3aea57
      Len Brown 提交于
      When the "u32" keyword is used with --add, it means that
      the output should be truncated to 32-bits.  This was not
      happening and all 64-bits were printed.
      
      Also, when no column name was used for an added MSR,
      The default column name was in deximal, eg. MSR16.
      Users report that they tend to use hex MSR numbers,
      so print them in hex.  To always fit into the columns,
      use the syntax M0x10.  Note that the user can always
      supply any column header that they want.
      
      eg --add msr0x10,MY_TSC
      Signed-off-by: NLen Brown <len.brown@intel.com>
      5f3aea57
    • L
      tools/power turbostat: show error on exec · 0815a3d0
      Len Brown 提交于
      When turbostat is run in one-shot command mode,
      the parent takes the 'before' counter snapshot,
      fork/exec/wait for the child to exit,
      takes the 'after' counter snapshot,
      and prints the results.
      
      however, if the child fails to exec the command,
      it immediately returns, without indicating that
      anythign was wrong.
      
      Add an error message showing that exec failed:
      
      sudo turbostat sleeeep 4
      ...
      turbostat: exec sleeeep: No such file or directory
      ...
      
      Note that the parent will still print out the statistics,
      because it can't tell the difference between the failed
      exec and a command that is purposefully returning
      the same status.  Unfortunately, this may obscure the
      error message.  However, if the --out parameter is used,
      the error message is evident on stderr.
      Reported-by: NWendy Wang <wendy.wang@intel.com>
      Signed-off-by: NLen Brown <len.brown@intel.com>
      0815a3d0
    • L
      tools/power turbostat: dump p-state software config · 7293fccd
      Len Brown 提交于
      cpu1: cpufreq driver: acpi-cpufreq
      cpu1: cpufreq governor: ondemand
      cpufreq boost: 1
      
      or
      
      cpu0: cpufreq driver: intel_pstate
      cpu0: cpufreq governor: powersave
      cpufreq intel_pstate no_turbo: 0
      Signed-off-by: NLen Brown <len.brown@intel.com>
      7293fccd
    • L
      tools/power turbostat: show package number, even without --debug · 7da6e3e2
      Len Brown 提交于
      On multi-package systems, the "Package" column was being displayed
      only if --debug was used.  Show it always.
      Signed-off-by: NLen Brown <len.brown@intel.com>
      7da6e3e2
    • L
      tools/power turbostat: support "--hide C1" etc. · dd778a5e
      Len Brown 提交于
      Originally, the only way to hide the sysfs C-state statistics columns
      was with "--hide sysfs".  This was because we process "--hide" before
      we probe for those columns.
      
      hack --hide to remember deferred hide requests, and apply
      them when sysfs is probed.
      
      "--hide sysfs" is still available as short-hand to refer to
      the entire group of counters.
      
      The down-side of this change is that we no longer error check for
      bogus --hide column names.  But the user will quickly figure that
      out if a column they mean to hide is still there...
      Signed-off-by: NLen Brown <len.brown@intel.com>
      dd778a5e
    • L
      tools/power turbostat: move --Package and --processor into the --cpu option · 4e4e1e7c
      Len Brown 提交于
      --Package is now "--cpu package",
      which will display just the 1st CPU in each package
      
      --processor is not "--cpu core"
      which will display just the 1st CPU in each core
      Signed-off-by: NLen Brown <len.brown@intel.com>
      4e4e1e7c
    • L
      tools/power turbostat: turbostat.8 update · da67e2b9
      Len Brown 提交于
      update examples to show recently updated features.
      In particular
      --add
      --show
      --hide
      --cpu
      --list
      Signed-off-by: NLen Brown <len.brown@intel.com>
      da67e2b9
    • L
      tools/power turbostat: update --list feature · 6168c2e0
      Len Brown 提交于
      Make it possible to take the entire un-edited output
      from `turbostat --list` and feed it to "turbostat --show"
      or "turbostat --hide".
      
      To do this, the leading comma was removed
      (no mater what columns are active)
      and also they dynamic C-state "C1, C2, C3" etc are replaced
      by the string "sysfs", which refers to them as a group.
      Signed-off-by: NLen Brown <len.brown@intel.com>
      6168c2e0
    • L
      tools/power turbostat: use wide columns to display large numbers · 0de6c0df
      Len Brown 提交于
      When a counter overlfows 7 columns, it shifts the remaining
      columns to the right, so they no longer line up under
      their column header.
      
      Update turbostat to dectect when it is handling large
      numbers, and switch to wider columns where, necessary.
      Reported-by: NArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
      Signed-off-by: NLen Brown <len.brown@intel.com>
      0de6c0df
    • L
      tools/power turbostat: Add --list option to show available header names · c8ade361
      Len Brown 提交于
      It is handy to know the list of column header names,
      so that they can be used with --add and --skip
      
      The new --list option shows them:
      
      sudo ./turbostat --list --hide sysfs
      ,Core,CPU,Avg_MHz,Busy%,Bzy_MHz,TSC_MHz,IRQ,SMI,CPU%c1,CPU%c3,CPU%c6,CPU%c7,CoreTmp,PkgTmp,GFX%rc6,GFXMHz,PkgWatt,CorWatt,GFXWatt
      Signed-off-by: NLen Brown <len.brown@intel.com>
      c8ade361
    • L
      tools/power turbostat: fix zero IRQ count shown in one-shot command mode · 218f0e8d
      Len Brown 提交于
      The IRQ column has been working for periodic mode,
      but not in one-shot command mode, it shows only 0.
      
      until now.
      Signed-off-by: NLen Brown <len.brown@intel.com>
      218f0e8d
    • L
      tools/power turbostat: add --cpu parameter · 1ef7d21a
      Len Brown 提交于
      With the --cpu parameter, turbostat prints only lines
      for the specified set of CPUs:
      
      sudo ./turbostat --quiet --show Core,CPU --cpu 0,1,3..5,6-7
      	Core	CPU
      	-	-
      	0	0
      	0	4
      	1	1
      	1	5
      	2	6
      	3	3
      	3	7
      Signed-off-by: NLen Brown <len.brown@intel.com>
      1ef7d21a
    • L
      tools/power turbostat: print sysfs C-state stats · 41618e63
      Len Brown 提交于
      When turbostat shows % of time in a CPU idle power state,
      it has always been showing information from underlying
      hardware residency counters.
      
      While this reflects what the hardware is doing, and is thus
      useful for understanding the hardware,
      it doesn't directly tell us what Linux requested --
      which is useful for tuning Linux itself.
      
      Here we add columns to turbostat to show the
      Linux cpuidle sub-system statistics:
      /sys/devices/system/cpu/cpu*/cpuidle/state*/*
      
      The first group of columns are the "usage", which is the
      number of times software requested that C-state in the
      measurement interval. eg C1 below.
      
      The second group of columns are the "time", which is the percentage
      of the measurement interval time that software has requested
      the specified C-state. eg C1% below.
      
      These software counters can be compared to the underlying
      hardware residency counters (eg CPU%c1	CPU%c3	CPU%c6	CPU%c7)
      to compare what sofware requested to what the hardware delivered.
      
      These sysfs attributes are discovered when turbostat starts,
      rather than being "built in".  So the --show and --hide
      parameters do not know about these dynamic column names.
      However "--show sysfs" and "--hide sysfs" act on the
      entire group of columns:
      
      turbostat --show sysfs
      ...
      cpu4: POLL: CPUIDLE CORE POLL IDLE
      cpu4: C1: MWAIT 0x00
      cpu4: C1E: MWAIT 0x01
      cpu4: C3: MWAIT 0x10
      cpu4: C6: MWAIT 0x20
      cpu4: C7s: MWAIT 0x32
      ...
      C1 	C1E	C3 	C6 	C7s	C1% 	C1E%	C3%	C6% 	C7s%
      3	6	5	1	188	0.00	0.02	0.00	0.00	99.93
      0	6	5	0	58	0.00	0.16	0.02	0.00	99.70
      0	0	0	0	9	0.00	0.00	0.00	0.00	99.96
      0	0	0	1	24	0.00	0.00	0.00	0.02	99.93
      0	0	0	0	9	0.00	0.00	0.00	0.00	99.97
      0	0	0	0	32	0.00	0.00	0.00	0.00	99.96
      0	0	0	0	7	0.00	0.00	0.00	0.00	99.98
      2	0	0	0	36	0.00	0.00	0.00	0.00	99.97
      1	0	0	0	13	0.00	0.00	0.00	0.00	99.98
      Signed-off-by: NLen Brown <len.brown@intel.com>
      41618e63
    • L
      tools/power turbostat: extend --add option to accept /sys path · 495c7654
      Len Brown 提交于
      Previously, the --add option could specify only an MSR.
      
      Here is is extended so an arbitrary /sys attribute,
      as specified by an absolute file path name.
      
      sudo ./turbostat --add /sys/devices/system/cpu/cpu0/cpuidle/state5/usage
      Signed-off-by: NLen Brown <len.brown@intel.com>
      495c7654
    • L
      tools/power turbostat: skip unused counters on BDX · ade0ebac
      Len Brown 提交于
      Skip these two counters on BDX, as they are always zero:
      cc7, pc7
      Signed-off-by: NLen Brown <len.brown@intel.com>
      ade0ebac
    • L
      tools/power turbostat: fix decoding for GLM, DNV, SKX turbo-ratio limits · 31e07522
      Len Brown 提交于
      Newer processors do not hard-code the the number of cpus in each bin
      to {1, 2, 3, 4, 5, 6, 7, 8}  Rather, they can specify any number
      of CPUS in each of the 8 bins:
      
      eg.
      
      ...
      37 * 100.0 = 3600.0 MHz max turbo 4 active cores
      38 * 100.0 = 3700.0 MHz max turbo 3 active cores
      39 * 100.0 = 3800.0 MHz max turbo 2 active cores
      39 * 100.0 = 3900.0 MHz max turbo 1 active cores
      
      could now look something like this:
      
      ...
      37 * 100.0 = 3600.0 MHz max turbo 16 active cores
      38 * 100.0 = 3700.0 MHz max turbo 8 active cores
      39 * 100.0 = 3800.0 MHz max turbo 4 active cores
      39 * 100.0 = 3900.0 MHz max turbo 2 active cores
      Signed-off-by: NLen Brown <len.brown@intel.com>
      31e07522
    • L
      tools/power turbostat: skip unused counters on SKX · 34c76197
      Len Brown 提交于
      Skip these four counters on SKX, as they are always zero:
      cc3, pc3
      cc7, pc7
      Signed-off-by: NLen Brown <len.brown@intel.com>
      34c76197
    • L
      tools/power turbostat: Denverton: use HW CC1 counter, skip C3, C7 · 7170a374
      Len Brown 提交于
      The CC1 column in tubostat can be computed by subtracting
      the core c-state residency countes from the total Cx residency.
      
      CC1 = (Idle_time_as_measured by MPERF) - (all core C-states with
      residency counters)
      
      However, as the underlying counter reads are not atomic,
      error can be noticed in this calculations, especially
      when the numbers are small.
      
      Denverton has a hardware CC1 residency counter
      to improve the accuracy of the cc1 statistic -- use it.
      
      At the same time, Denverton has no concept of CC3, PC3, CC7, PC7,
      so skip collecting and printing those columns.
      
      Finally, a note of clarification.
      Turbostat prints the standard PC2 residency counter,
      but on Denverton hardware, that actually means PC1E.
      Turbostat prints the standard PC6 residency counter,
      but on Denverton hardware, that actually means PC2.
      
      At this point, we document that differnce in this commit message,
      rather than adding a quirk to the software.
      Signed-off-by: NLen Brown <len.brown@intel.com>
      7170a374
    • L
      tools/power turbostat: initial Gemini Lake SOC support · ac01ac13
      Len Brown 提交于
      Gemini Lake is similar to Apollo Lake (Broxton/Goldmont)
      Signed-off-by: NLen Brown <len.brown@intel.com>
      ac01ac13