1. 13 3月, 2012 1 次提交
    • P
      perf/x86: Fix local vs remote memory events for NHM/WSM · 87e24f4b
      Peter Zijlstra 提交于
      Verified using the below proglet.. before:
      
      [root@westmere ~]# perf stat -e node-stores -e node-store-misses ./numa 0
      remote write
      
       Performance counter stats for './numa 0':
      
               2,101,554 node-stores
               2,096,931 node-store-misses
      
             5.021546079 seconds time elapsed
      
      [root@westmere ~]# perf stat -e node-stores -e node-store-misses ./numa 1
      local write
      
       Performance counter stats for './numa 1':
      
                 501,137 node-stores
                     199 node-store-misses
      
             5.124451068 seconds time elapsed
      
      After:
      
      [root@westmere ~]# perf stat -e node-stores -e node-store-misses ./numa 0
      remote write
      
       Performance counter stats for './numa 0':
      
               2,107,516 node-stores
               2,097,187 node-store-misses
      
             5.012755149 seconds time elapsed
      
      [root@westmere ~]# perf stat -e node-stores -e node-store-misses ./numa 1
      local write
      
       Performance counter stats for './numa 1':
      
               2,063,355 node-stores
                     165 node-store-misses
      
             5.082091494 seconds time elapsed
      
      #define _GNU_SOURCE
      
      #include <sched.h>
      #include <stdio.h>
      #include <errno.h>
      #include <sys/mman.h>
      #include <sys/types.h>
      #include <dirent.h>
      #include <signal.h>
      #include <unistd.h>
      #include <numaif.h>
      #include <stdlib.h>
      
      #define SIZE (32*1024*1024)
      
      volatile int done;
      
      void sig_done(int sig)
      {
      	done = 1;
      }
      
      int main(int argc, char **argv)
      {
      	cpu_set_t *mask, *mask2;
      	size_t size;
      	int i, err, t;
      	int nrcpus = 1024;
      	char *mem;
      	unsigned long nodemask = 0x01; /* node 0 */
      	DIR *node;
      	struct dirent *de;
      	int read = 0;
      	int local = 0;
      
      	if (argc < 2) {
      		printf("usage: %s [0-3]\n", argv[0]);
      		printf("  bit0 - local/remote\n");
      		printf("  bit1 - read/write\n");
      		exit(0);
      	}
      
      	switch (atoi(argv[1])) {
      	case 0:
      		printf("remote write\n");
      		break;
      	case 1:
      		printf("local write\n");
      		local = 1;
      		break;
      	case 2:
      		printf("remote read\n");
      		read = 1;
      		break;
      	case 3:
      		printf("local read\n");
      		local = 1;
      		read = 1;
      		break;
      	}
      
      	mask = CPU_ALLOC(nrcpus);
      	size = CPU_ALLOC_SIZE(nrcpus);
      	CPU_ZERO_S(size, mask);
      
      	node = opendir("/sys/devices/system/node/node0/");
      	if (!node)
      		perror("opendir");
      	while ((de = readdir(node))) {
      		int cpu;
      
      		if (sscanf(de->d_name, "cpu%d", &cpu) == 1)
      			CPU_SET_S(cpu, size, mask);
      	}
      	closedir(node);
      
      	mask2 = CPU_ALLOC(nrcpus);
      	CPU_ZERO_S(size, mask2);
      	for (i = 0; i < size; i++)
      		CPU_SET_S(i, size, mask2);
      	CPU_XOR_S(size, mask2, mask2, mask); // invert
      
      	if (!local)
      		mask = mask2;
      
      	err = sched_setaffinity(0, size, mask);
      	if (err)
      		perror("sched_setaffinity");
      
      	mem = mmap(0, SIZE, PROT_READ|PROT_WRITE,
      			MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
      	err = mbind(mem, SIZE, MPOL_BIND, &nodemask, 8*sizeof(nodemask), MPOL_MF_MOVE);
      	if (err)
      		perror("mbind");
      
      	signal(SIGALRM, sig_done);
      	alarm(5);
      
      	if (!read) {
      		while (!done) {
      			for (i = 0; i < SIZE; i++)
      				mem[i] = 0x01;
      		}
      	} else {
      		while (!done) {
      			for (i = 0; i < SIZE; i++)
      				t += *(volatile char *)(mem + i);
      		}
      	}
      
      	return 0;
      }
      Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: <stable@kernel.org>
      Link: http://lkml.kernel.org/n/tip-tq73sxus35xmqpojf7ootxgs@git.kernel.orgSigned-off-by: NIngo Molnar <mingo@elte.hu>
      87e24f4b
  2. 10 3月, 2012 1 次提交
    • T
      x86: Derandom delay_tsc for 64 bit · a7f4255f
      Thomas Gleixner 提交于
      Commit f0fbf0ab ("x86: integrate delay functions") converted
      delay_tsc() into a random delay generator for 64 bit.  The reason is
      that it merged the mostly identical versions of delay_32.c and
      delay_64.c.  Though the subtle difference of the result was:
      
       static void delay_tsc(unsigned long loops)
       {
      -	unsigned bclock, now;
      +	unsigned long bclock, now;
      
      Now the function uses rdtscl() which returns the lower 32bit of the
      TSC. On 32bit that's not problematic as unsigned long is 32bit. On 64
      bit this fails when the lower 32bit are close to wrap around when
      bclock is read, because the following check
      
             if ((now - bclock) >= loops)
             	  	break;
      
      evaluated to true on 64bit for e.g. bclock = 0xffffffff and now = 0
      because the unsigned long (now - bclock) of these values results in
      0xffffffff00000001 which is definitely larger than the loops
      value. That explains Tvortkos observation:
      
      "Because I am seeing udelay(500) (_occasionally_) being short, and
       that by delaying for some duration between 0us (yep) and 491us."
      
      Make those variables explicitely u32 again, so this works for both 32
      and 64 bit.
      Reported-by: NTvrtko Ursulin <tvrtko.ursulin@onelan.co.uk>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: stable@vger.kernel.org # >= 2.6.27
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      a7f4255f
  3. 09 3月, 2012 1 次提交
  4. 08 3月, 2012 1 次提交
    • M
      C6X: fix KSTK_EIP and KSTK_ESP macros · 4cd7c0a0
      Mark Salter 提交于
      There was a latent typo in the C6X KSTK_EIP and KSTK_ESP macros which
      caused a problem with a new patch which used them. The broken definitions
      were of the form:
      
        #define KSTK_FOO(tsk) (task_pt_regs(task)->foo)
      
      Note the use of task vs tsk. This actually worked before because the
      only place in the kernel which used these macros passed in a local
      pointer named task.
      Signed-off-by: NMark Salter <msalter@redhat.com>
      4cd7c0a0
  5. 07 3月, 2012 7 次提交
  6. 06 3月, 2012 12 次提交
    • H
      ARM: ep93xx: convert vision_ep9307 to MULTI_IRQ_HANDLER · 1dbd02ec
      H Hartley Sweeten 提交于
      As done for the other ep93xx machines in:
      
      commit 9a6879bd
      ARM: ep93xx: convert to MULTI_IRQ_HANDLER
      
      Now that there is a generic IRQ handler for multiple VIC devices use it
      for vision_ep9307 to help building multi platform kernels.
      Signed-off-by: NHartley Sweeten <hsweeten@visionengravers.com>
      Acked-by: NRyan Mallon <rmallon@gmail.com>
      Reviewed-by: NJamie Iles <jamie@jamieiles.com>
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      1dbd02ec
    • B
      63f32b38
    • M
      x86/kprobes: Split out optprobe related code to kprobes-opt.c · 3f33ab1c
      Masami Hiramatsu 提交于
      Split out optprobe related code to arch/x86/kernel/kprobes-opt.c
      for maintenanceability.
      Signed-off-by: NMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Suggested-by: NIngo Molnar <mingo@elte.hu>
      Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
      Cc: yrl.pp-manager.tt@hitachi.com
      Cc: systemtap@sourceware.org
      Cc: anderson@redhat.com
      Link: http://lkml.kernel.org/r/20120305133222.5982.54794.stgit@localhost.localdomain
      [ Tidied up the code a tiny bit ]
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      3f33ab1c
    • M
      x86/kprobes: Fix a bug which can modify kernel code permanently · 46484688
      Masami Hiramatsu 提交于
      Fix a bug in kprobes which can modify kernel code
      permanently at run-time. In the result, kernel can
      crash when it executes the modified code.
      
      This bug can happen when we put two probes enough near
      and the first probe is optimized. When the second probe
      is set up, it copies a byte which is already modified
      by the first probe, and executes it when the probe is hit.
      Even worse, the first probe and the second probe are removed
      respectively, the second probe writes back the copied
      (modified) instruction.
      
      To fix this bug, kprobes always recovers the original
      code and copies the first byte from recovered instruction.
      Signed-off-by: NMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
      Cc: yrl.pp-manager.tt@hitachi.com
      Cc: systemtap@sourceware.org
      Cc: anderson@redhat.com
      Link: http://lkml.kernel.org/r/20120305133215.5982.31991.stgit@localhost.localdomainSigned-off-by: NIngo Molnar <mingo@elte.hu>
      46484688
    • M
      x86/kprobes: Fix instruction recovery on optimized path · 86b4ce31
      Masami Hiramatsu 提交于
      Current probed-instruction recovery expects that only breakpoint
      instruction modifies instruction. However, since kprobes jump
      optimization can replace original instructions with a jump,
      that expectation is not enough. And it may cause instruction
      decoding failure on the function where an optimized probe
      already exists.
      
      This bug can reproduce easily as below:
      
      1) find a target function address (any kprobe-able function is OK)
      
       $ grep __secure_computing /proc/kallsyms
         ffffffff810c19d0 T __secure_computing
      
      2) decode the function
         $ objdump -d vmlinux --start-address=0xffffffff810c19d0 --stop-address=0xffffffff810c19eb
      
        vmlinux:     file format elf64-x86-64
      
      Disassembly of section .text:
      
      ffffffff810c19d0 <__secure_computing>:
      ffffffff810c19d0:       55                      push   %rbp
      ffffffff810c19d1:       48 89 e5                mov    %rsp,%rbp
      ffffffff810c19d4:       e8 67 8f 72 00          callq
      ffffffff817ea940 <mcount>
      ffffffff810c19d9:       65 48 8b 04 25 40 b8    mov    %gs:0xb840,%rax
      ffffffff810c19e0:       00 00
      ffffffff810c19e2:       83 b8 88 05 00 00 01    cmpl $0x1,0x588(%rax)
      ffffffff810c19e9:       74 05                   je     ffffffff810c19f0 <__secure_computing+0x20>
      
      3) put a kprobe-event at an optimize-able place, where no
       call/jump places within the 5 bytes.
       $ su -
       # cd /sys/kernel/debug/tracing
       # echo p __secure_computing+0x9 > kprobe_events
      
      4) enable it and check it is optimized.
       # echo 1 > events/kprobes/p___secure_computing_9/enable
       # cat ../kprobes/list
       ffffffff810c19d9  k  __secure_computing+0x9    [OPTIMIZED]
      
      5) put another kprobe on an instruction after previous probe in
        the same function.
       # echo p __secure_computing+0x12 >> kprobe_events
       bash: echo: write error: Invalid argument
       # dmesg | tail -n 1
       [ 1666.500016] Probing address(0xffffffff810c19e2) is not an instruction boundary.
      
      6) however, if the kprobes optimization is disabled, it works.
       # echo 0 > /proc/sys/debug/kprobes-optimization
       # cat ../kprobes/list
       ffffffff810c19d9  k  __secure_computing+0x9
       # echo p __secure_computing+0x12 >> kprobe_events
       (no error)
      
      This is because kprobes doesn't recover the instruction
      which is overwritten with a relative jump by another kprobe
      when finding instruction boundary.
      It only recovers the breakpoint instruction.
      
      This patch fixes kprobes to recover such instructions.
      
      With this fix:
      
       # echo p __secure_computing+0x9 > kprobe_events
       # echo 1 > events/kprobes/p___secure_computing_9/enable
       # cat ../kprobes/list
       ffffffff810c1aa9  k  __secure_computing+0x9    [OPTIMIZED]
       # echo p __secure_computing+0x12 >> kprobe_events
       # cat ../kprobes/list
       ffffffff810c1aa9  k  __secure_computing+0x9    [OPTIMIZED]
       ffffffff810c1ab2  k  __secure_computing+0x12    [DISABLED]
      
      Changes in v4:
       - Fix a bug to ensure optimized probe is really optimized
         by jump.
       - Remove kprobe_optready() dependency.
       - Cleanup code for preparing optprobe separation.
      
      Changes in v3:
       - Fix a build error when CONFIG_OPTPROBE=n. (Thanks, Ingo!)
         To fix the error, split optprobe instruction recovering
         path from kprobes path.
       - Cleanup comments/styles.
      
      Changes in v2:
       - Fix a bug to recover original instruction address in
         RIP-relative instruction fixup.
       - Moved on tip/master.
      Signed-off-by: NMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
      Cc: yrl.pp-manager.tt@hitachi.com
      Cc: systemtap@sourceware.org
      Cc: anderson@redhat.com
      Link: http://lkml.kernel.org/r/20120305133209.5982.36568.stgit@localhost.localdomainSigned-off-by: NIngo Molnar <mingo@elte.hu>
      86b4ce31
    • H
      ARM: pxa: fix invalid mfp pin issue · af829310
      Haojian Zhuang 提交于
      Failure is reported on hx4700 with kernel v3.3-rc1.
      
      __mfp_validate: GPIO20 is invalid pin
      __mfp_validate: GPIO21 is invalid pin
      __mfp_validate: GPIO15 is invalid pin
      __mfp_validate: GPIO78 is invalid pin
      __mfp_validate: GPIO79 is invalid pin
      __mfp_validate: GPIO80 is invalid pin
      __mfp_validate: GPIO33 is invalid pin
      __mfp_validate: GPIO48 is invalid pin
      __mfp_validate: GPIO49 is invalid pin
      __mfp_validate: GPIO50 is invalid pin
      
      Since pxa_last_gpio is used in mfp-pxa2xx driver. But it's only
      updated in pxa-gpio driver that run after mfp-pxa2xx driver.
      
      So update the pxa_last_gpio first in mfp-pxa2xx driver.
      Reported-by: NPaul Parsons <lost.distance@yahoo.com>
      Signed-off-by: NHaojian Zhuang <haojian.zhuang@gmail.com>
      af829310
    • H
      ARM: pxa: remove duplicated registeration on pxa-gpio · 0c7de34b
      Haojian Zhuang 提交于
      Both reboot (via reboot(RB_AUTOBOOT)) and suspend freeze on hx4700.
      
      Registration of pxa_gpio_syscore_ops is moved into pxa-gpio driver,
      but it still exists in arch-pxa directory. It resulsts failure on
      reboot and suspend.
      
      Now remove the registration code in arch-pxa.
      Reported-by: NPaul Parsons <lost.distance@yahoo.com>
      Signed-off-by: NHaojian Zhuang <haojian.zhuang@gmail.com>
      0c7de34b
    • H
      ARM: pxa: add dummy clock for pxa25x and pxa27x · bbdc818b
      Haojian Zhuang 提交于
      gpio-pxa driver is shared among arch-pxa and arch-mmp. Clock is the
      essential component on pxa3xx/pxa95x and arch-mmp. So we need to
      define dummy clock in pxa25x/pxa27x instead.
      
      This regression was introduced by the commit "ARM: pxa: add dummy
      clock for sa1100-rtc", id a55b5ada.
      Reported-by: NJonathan Cameron <jic23@cam.ac.uk>
      Signed-off-by: NPaul Parsons <lost.distance@yahoo.com>
      Tested-by: NRobert Jarzmik <robert.jarzmik@free.fr>
      Signed-off-by: NHaojian Zhuang <haojian.zhuang@marvell.com>
      bbdc818b
    • A
      alpha: fix 32/64-bit bug in futex support · 62aca403
      Andrew Morton 提交于
      Michael Cree said:
      
      : : I have noticed some user space problems (pulseaudio crashes in pthread
      : : code, glibc/nptl test suite failures, java compiler freezes on SMP alpha
      : : systems) that arise when using a 2.6.39 or later kernel on Alpha.
      : : Bisecting between 2.6.38 and 2.6.39 (using glibc/nptl test suite as
      : : criterion for good/bad kernel) eventually leads to:
      : :
      : : 8d7718aa is the first bad commit
      : : commit 8d7718aa
      : : Author: Michel Lespinasse <walken@google.com>
      : : Date:   Thu Mar 10 18:50:58 2011 -0800
      : :
      : :     futex: Sanitize futex ops argument types
      : :
      : :     Change futex_atomic_op_inuser and futex_atomic_cmpxchg_inatomic
      : :     prototypes to use u32 types for the futex as this is the data type the
      : :     futex core code uses all over the place.
      : :
      : : Looking at the commit I see there is a change of the uaddr argument in
      : : the Alpha architecture specific code for futexes from int to u32, but I
      : : don't see why this should cause a problem.
      
      Richard Henderson said:
      
      : futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr,
      :                               u32 oldval, u32 newval)
      : ...
      :         :       "r"(uaddr), "r"((long)oldval), "r"(newval)
      :
      :
      : There is no 32-bit compare instruction.  These are implemented by
      : consistently extending the values to a 64-bit type.  Since the
      : load instruction sign-extends, we want to sign-extend the other
      : quantity as well (despite the fact it's logically unsigned).
      :
      : So:
      :
      : -        :       "r"(uaddr), "r"((long)oldval), "r"(newval)
      : +        :       "r"(uaddr), "r"((long)(int)oldval), "r"(newval)
      :
      : should do the trick.
      
      Michael said:
      
      : This fixes the glibc test suite failures and the pulseaudio related
      : crashes, but it does not fix the java compiiler lockups that I was (and
      : are still) observing.  That is some other problem.
      Reported-by: NMichael Cree <mcree@orcon.net.nz>
      Tested-by: NMichael Cree <mcree@orcon.net.nz>
      Acked-by: NPhil Carmody <ext-phil.2.carmody@nokia.com>
      Cc: Richard Henderson <rth@twiddle.net>
      Cc: Michel Lespinasse <walken@google.com>
      Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
      Reviewed-by: NMatt Turner <mattst88@gmail.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      62aca403
    • R
      ARM: ecard: ensure fake vma vm_flags is setup · 81caaf25
      Russell King 提交于
      Our TLB ops want to check the vma vm_flags to find out whether the
      mapping is executable.  However, we leave this uninitialized in
      ecard.c.  Initialize it with an appropriate value.
      Reported-by: NAl Viro <viro@ftp.linux.org.uk>
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      81caaf25
    • R
      ARM: OMAP2+: Fix module build errors with CONFIG_OMAP4_ERRATA_I688 · cc4ad907
      R Sricharan 提交于
      While building modules with randconfig the below errors are observed.
      
      ERROR: "omap_bus_sync" [drivers/watchdog/sp805_wdt.ko] undefined!
      ERROR: "omap_bus_sync" [drivers/watchdog/dw_wdt.ko] undefined!
      ERROR: "omap_bus_sync" [drivers/virtio/virtio_ring.ko] undefined!
      ERROR: "omap_bus_sync" [drivers/video/sm501fb.ko] undefined!
      ERROR: "omap_bus_sync" [drivers/usb/mon/usbmon.ko] undefined!
      ERROR: "omap_bus_sync" [drivers/usb/host/sl811-hcd.ko] undefined!
      ERROR: "omap_bus_sync" [drivers/usb/host/ohci-hcd.ko] undefined!
      ERROR: "omap_bus_sync" [drivers/usb/host/isp1760.ko] undefined!
      ERROR: "omap_bus_sync" [drivers/usb/host/isp1362-hcd.ko] undefined!
      ERROR: "omap_bus_sync" [drivers/usb/host/isp116x-hcd.ko] undefined!
      ERROR: "omap_bus_sync" [drivers/usb/core/usbcore.ko] undefined!
      ERROR: "omap_bus_sync" [drivers/tty/serial/altera_uart.ko] undefined!
      ERROR: "omap_bus_sync" [drivers/tty/serial/altera_jtaguart.ko] undefined!
      ERROR: "omap_bus_sync" [drivers/tty/serial/8250/8250_dw.ko] undefined!
      ERROR: "omap_bus_sync" [drivers/ssb/ssb.ko] undefined!
      ERROR: "omap_bus_sync" [drivers/rtc/rtc-cmos.ko] undefined!
      ERROR: "omap_bus_sync" [drivers/rtc/rtc-bq4802.ko] undefined!
      ERROR: "omap_bus_sync" [drivers/mtd/nand/tmio_nand.ko] undefined!
      ERROR: "omap_bus_sync" [drivers/mtd/nand/omap2.ko] undefined!
      Signed-off-by: NR Sricharan <r.sricharan@ti.com>
      Signed-off-by: NTony Lindgren <tony@atomide.com>
      cc4ad907
    • A
  7. 05 3月, 2012 1 次提交
  8. 03 3月, 2012 1 次提交
  9. 02 3月, 2012 2 次提交
  10. 01 3月, 2012 5 次提交
  11. 29 2月, 2012 3 次提交
  12. 28 2月, 2012 5 次提交