1. 19 1月, 2014 6 次提交
    • J
      turbostat: Factor out common function to open file and exit on failure · 57a42a34
      Josh Triplett 提交于
      Several different functions in turbostat contain the same pattern of
      opening a file and exiting on failure.  Factor out a common fopen_or_die
      function for that.
      Signed-off-by: NJosh Triplett <josh@joshtriplett.org>
      Signed-off-by: NLen Brown <len.brown@intel.com>
      57a42a34
    • J
      turbostat: Add a helper to parse a single int out of a file · 95aebc44
      Josh Triplett 提交于
      Many different chunks of code in turbostat open a file, parse a single
      int out of it, and close it.  Factor that out into a common function.
      Signed-off-by: NJosh Triplett <josh@joshtriplett.org>
      Signed-off-by: NLen Brown <len.brown@intel.com>
      95aebc44
    • J
      turbostat: Check return value of fscanf · 74823419
      Josh Triplett 提交于
      Some systems declare fscanf with the warn_unused_result attribute.  On
      such systems, turbostat generates the following warnings:
      
      turbostat.c: In function 'get_core_id':
      turbostat.c:1203:8: warning: ignoring return value of 'fscanf', declared with attribute warn_unused_result [-Wunused-result]
      turbostat.c: In function 'get_physical_package_id':
      turbostat.c:1186:8: warning: ignoring return value of 'fscanf', declared with attribute warn_unused_result [-Wunused-result]
      turbostat.c: In function 'cpu_is_first_core_in_package':
      turbostat.c:1169:8: warning: ignoring return value of 'fscanf', declared with attribute warn_unused_result [-Wunused-result]
      turbostat.c: In function 'cpu_is_first_sibling_in_core':
      turbostat.c:1148:8: warning: ignoring return value of 'fscanf', declared with attribute warn_unused_result [-Wunused-result]
      
      Fix these by checking the return value of those four calls to fscanf.
      Signed-off-by: NJosh Triplett <josh@joshtriplett.org>
      Signed-off-by: NLen Brown <len.brown@intel.com>
      74823419
    • J
      turbostat: Use GCC's CPUID functions to support PIC · 2b92865e
      Josh Triplett 提交于
      turbostat uses inline assembly to call cpuid.  On 32-bit x86, on systems
      that have certain security features enabled by default that make -fPIC
      the default, this causes a build error:
      
      turbostat.c: In function ‘check_cpuid’:
      turbostat.c:1906:2: error: PIC register clobbered by ‘ebx’ in ‘asm’
        asm("cpuid" : "=a" (fms), "=c" (ecx), "=d" (edx) : "a" (1) : "ebx");
        ^
      
      GCC provides a header cpuid.h, containing a __get_cpuid function that
      works with both PIC and non-PIC.  (On PIC, it saves and restores ebx
      around the cpuid instruction.)  Use that instead.
      Signed-off-by: NJosh Triplett <josh@joshtriplett.org>
      Cc: stable@vger.kernel.org
      Signed-off-by: NLen Brown <len.brown@intel.com>
      2b92865e
    • J
      turbostat: Don't attempt to printf an off_t with %zx · 2e9c6bc7
      Josh Triplett 提交于
      turbostat uses the format %zx to print an off_t.  However, %zx wants a
      size_t, not an off_t.  On 32-bit targets, those refer to different
      types, potentially even with different sizes.  Use %llx and a cast
      instead, since printf does not have a length modifier for off_t.
      
      Without this patch, when compiling for a 32-bit target:
      
      turbostat.c: In function 'get_msr':
      turbostat.c:231:3: warning: format '%zx' expects argument of type 'size_t', but argument 4 has type 'off_t' [-Wformat]
      Signed-off-by: NJosh Triplett <josh@joshtriplett.org>
      Signed-off-by: NLen Brown <len.brown@intel.com>
      2e9c6bc7
    • J
      turbostat: Don't put unprocessed uapi headers in the include path · b731f311
      Josh Triplett 提交于
      turbostat's Makefile puts arch/x86/include/uapi/ in the include path, so
      that it can include <asm/msr.h> from it.  It isn't in general safe to
      include even uapi headers directly from the kernel tree without
      processing them through scripts/headers_install.sh, but asm/msr.h
      happens to work.
      
      However, that include path can break with some versions of system
      headers, by overriding some system headers with the unprocessed versions
      directly from the kernel source.  For instance:
      
      In file included from /build/x86-generic/usr/include/bits/sigcontext.h:28:0,
                       from /build/x86-generic/usr/include/signal.h:339,
                       from /build/x86-generic/usr/include/sys/wait.h:31,
                       from turbostat.c:27:
      ../../../../arch/x86/include/uapi/asm/sigcontext.h:4:28: fatal error: linux/compiler.h: No such file or directory
      
      This occurs because the system bits/sigcontext.h on that build system
      includes <asm/sigcontext.h>, and asm/sigcontext.h in the kernel source
      includes <linux/compiler.h>, which scripts/headers_install.sh would have
      filtered out.
      
      Since turbostat really only wants a single header, just include that one
      header rather than putting an entire directory of kernel headers on the
      include path.
      
      In the process, switch from msr.h to msr-index.h, since turbostat just
      wants the MSR numbers.
      Signed-off-by: NJosh Triplett <josh@joshtriplett.org>
      Cc: stable@vger.kernel.org
      Signed-off-by: NLen Brown <len.brown@intel.com>
      b731f311
  2. 18 12月, 2013 1 次提交
  3. 05 12月, 2013 1 次提交
    • H
      usb: tools: fix a regression issue that gcc can't link to pthread · cb292ce2
      Huang Rui 提交于
      Reproduce:
      ray@hr-bak:~/usb$ make -C tools/usb/
      make: Entering directory `/home/ray/usb/tools/usb'
      gcc -Wall -Wextra -g -lpthread -I../include -o testusb testusb.c
      /tmp/cc0EMxfy.o: In function `main':
      /home/ray/usb/tools/usb/testusb.c:508: undefined reference to `pthread_create'
      /home/ray/usb/tools/usb/testusb.c:531: undefined reference to `pthread_join'
      collect2: error: ld returned 1 exit status
      make: *** [testusb] Error 1
      make: Leaving directory `/home/ray/usb/tools/usb'
      
      Comments:
      In the latest version (4.7.3) of gcc compiler, it requres that
      libraries must follow the object or source files like below:
      
      "gcc hello.c -lpthread" instead of "gcc -lpthread hello.c"
      
      And it isn't encountered at gcc version 4.7.2.
      So this patch fix to move the pthread option after testusb.c.
      Signed-off-by: NHuang Rui <ray.huang@amd.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      cb292ce2
  4. 26 11月, 2013 2 次提交
  5. 20 11月, 2013 1 次提交
    • A
      tools lib traceevent: Fix conversion of pointer to integer of different size · 6b5fa0ba
      Arnaldo Carvalho de Melo 提交于
      gcc complaint on 32-bit system:
      
        /home/acme/git/linux/tools/lib/traceevent/event-parse.c: In function ‘eval_num_arg’:
        /home/acme/git/linux/tools/lib/traceevent/event-parse.c:3468:9: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
      
      This is because the eval_num_arg returns everything as an 'unsigned long long',
      so it converts a void pointer to a wider integer, fix it by converting the void
      pointer to an integer of the same size, 'unsigned long', before casting it to
      'unsigned long long'.
      Acked-by: NSteven Rostedt <rostedt@goodmis.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/n/tip-yllx4aqcg06v5n4vjpwiiuld@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      6b5fa0ba
  6. 19 11月, 2013 4 次提交
  7. 15 11月, 2013 11 次提交
  8. 14 11月, 2013 1 次提交
    • I
      tools/perf/build: Fix timerfd feature check · bb4c5500
      Ingo Molnar 提交于
      'feature_timerfd' is checked all the time and calculated explicitly,
      in a serial fashion. Add it to CORE_FEATURE_TESTS which causes it to
      be built in parallel, using the newfangled parallel build autodetection
      code.
      
      This shaves 137 msecs off the perf build time on my system, which
      speeds up the common case cached build by 43%:
      
      Before:
      
        comet:~/tip> perf stat --null --repeat 5 make -C tools/perf/
        [...]
               0,453771441 seconds time elapsed                                          ( +-  0,09% )
      
      After:
      
        comet:~/tip> perf stat --null --repeat 5 make -C tools/perf/
        [...]
               0,316290185 seconds time elapsed                                          ( +-  0,24% )
      
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Link: http://lkml.kernel.org/n/tip-bb92CmexihopoSyqnkqepvsy@git.kernel.orgSigned-off-by: NIngo Molnar <mingo@kernel.org>
      bb4c5500
  9. 13 11月, 2013 13 次提交