1. 11 11月, 2010 4 次提交
    • S
      tracing: Force arch_local_irq_* notrace for paravirt · b5908548
      Steven Rostedt 提交于
      When running ktest.pl randconfig tests, I would sometimes trigger
      a lockdep annotation bug (possible reason: unannotated irqs-on).
      
      This triggering happened right after function tracer self test was
      executed. After doing a config bisect I found that this was caused with
      having function tracer, paravirt guest, prove locking, and rcu torture
      all enabled.
      
      The rcu torture just enhanced the likelyhood of triggering the bug.
      Prove locking was needed, since it was the thing that was bugging.
      Function tracer would trace and disable interrupts in all sorts
      of funny places.
      paravirt guest would turn arch_local_irq_* into functions that would
      be traced.
      
      Besides the fact that tracing arch_local_irq_* is just a bad idea,
      this is what is happening.
      
      The bug happened simply in the local_irq_restore() code:
      
      		if (raw_irqs_disabled_flags(flags)) {	\
      			raw_local_irq_restore(flags);	\
      			trace_hardirqs_off();		\
      		} else {				\
      			trace_hardirqs_on();		\
      			raw_local_irq_restore(flags);	\
      		}					\
      
      The raw_local_irq_restore() was defined as arch_local_irq_restore().
      
      Now imagine, we are about to enable interrupts. We go into the else
      case and call trace_hardirqs_on() which tells lockdep that we are enabling
      interrupts, so it sets the current->hardirqs_enabled = 1.
      
      Then we call raw_local_irq_restore() which calls arch_local_irq_restore()
      which gets traced!
      
      Now in the function tracer we disable interrupts with local_irq_save().
      This is fine, but flags is stored that we have interrupts disabled.
      
      When the function tracer calls local_irq_restore() it does it, but this
      time with flags set as disabled, so we go into the if () path.
      This keeps interrupts disabled and calls trace_hardirqs_off() which
      sets current->hardirqs_enabled = 0.
      
      When the tracer is finished and proceeds with the original code,
      we enable interrupts but leave current->hardirqs_enabled as 0. Which
      now breaks lockdeps internal processing.
      
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      b5908548
    • S
      tracing: Fix module use of trace_bprintk() · 13b9b6e7
      Steven Rostedt 提交于
      On use of trace_printk() there's a macro that determines if the format
      is static or a variable. If it is static, it defaults to __trace_bprintk()
      otherwise it uses __trace_printk().
      
      A while ago, Lai Jiangshan added __trace_bprintk(). In that patch, we
      discussed a way to allow modules to use it. The difference between
      __trace_bprintk() and __trace_printk() is that for faster processing,
      just the format and args are stored in the trace instead of running
      it through a sprintf function. In order to do this, the format used
      by the __trace_bprintk() had to be persistent.
      
      See commit 1ba28e02
      
      The problem comes with trace_bprintk() where the module is unloaded.
      The pointer left in the buffer is still pointing to the format.
      
      To solve this issue, the formats in the module were copied into kernel
      core. If the same format was used, they would use the same copy (to prevent
      memory leak). This all worked well until we tried to merge everything.
      
      At the time this was written, Lai Jiangshan, Frederic Weisbecker,
      Ingo Molnar and myself were all touching the same code. When this was
      merged, we lost the part of it that was in module.c. This kept out the
      copying of the formats and unloading the module could cause bad pointers
      left in the ring buffer.
      
      This patch adds back (with updates required for current kernel) the
      module code that sets up the necessary pointers.
      
      Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      13b9b6e7
    • P
      perf, amd: Use kmalloc_node(,__GFP_ZERO) for northbridge structure allocation · 034c6efa
      Peter Zijlstra 提交于
      Jasper suggested we use the zeroing capability of the allocators
      instead of calling memset ourselves. Add node affinity while we're at
      it.
      Reported-by: NJesper Juhl <jj@chaosbits.net>
      Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      034c6efa
    • S
      perf_events: Fix time tracking in samples · eed01528
      Stephane Eranian 提交于
      This patch corrects time tracking in samples. Without this patch
      both time_enabled and time_running are bogus when user asks for
      PERF_SAMPLE_READ.
      
      One uses PERF_SAMPLE_READ to sample the values of other counters
      in each sample. Because of multiplexing, it is necessary to know
      both time_enabled, time_running to be able to scale counts correctly.
      
      In this second version of the patch, we maintain a shadow
      copy of ctx->time which allows us to compute ctx->time without
      calling update_context_time() from NMI context. We avoid the
      issue that update_context_time() must always be called with
      ctx->lock held.
      
      We do not keep shadow copies of the other event timings
      because if the lead event is overflowing then it is active
      and thus it's been scheduled in via event_sched_in() in
      which case neither tstamp_stopped, tstamp_running can be modified.
      
      This timing logic only applies to samples when PERF_SAMPLE_READ
      is used.
      
      Note that this patch does not address timing issues related
      to sampling inheritance between tasks. This will be addressed
      in a future patch.
      
      With this patch, the libpfm4 example task_smpl now reports
      correct counts (shown on 2.4GHz Core 2):
      
      $ task_smpl -p 2400000000 -e unhalted_core_cycles:u,instructions_retired:u,baclears  noploop 5
      noploop for 5 seconds
      IIP:0x000000004006d6 PID:5596 TID:5596 TIME:466,210,211,430 STREAM_ID:33 PERIOD:2,400,000,000 ENA=1,010,157,814 RUN=1,010,157,814 NR=3
      	2,400,000,254 unhalted_core_cycles:u (33)
      	2,399,273,744 instructions_retired:u (34)
      	53,340 baclears (35)
      Signed-off-by: NStephane Eranian <eranian@google.com>
      Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      LKML-Reference: <4cc6e14b.1e07e30a.256e.5190@mx.google.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      eed01528
  2. 10 11月, 2010 11 次提交
  3. 09 11月, 2010 15 次提交
  4. 08 11月, 2010 5 次提交
  5. 07 11月, 2010 1 次提交
  6. 06 11月, 2010 4 次提交
    • V
      floppy: fix another use-after-free · d017bf6b
      Vivek Goyal 提交于
      While scanning the floopy code due to c093ee4f ("floppy: fix
      use-after-free in module load failure path"), I found one more instance
      of trying to access disk->queue pointer after doing put_disk() on
      gendisk.  For some reason , floppy moule still loads/unloads fine.  The
      object is probably still around with right pointer values.
      
       o There seems to be one more instance of trying to cleanup the request
         queue after we have called put_disk() on associated gendisk.
      
       o This fix is more out of code inspection.  Even without this fix for
         some reason I am able to load/unload floppy module without any
         issues.
      
       o Floppy module loads/unloads fine after the fix.
      Signed-off-by: NVivek Goyal <vgoyal@redhat.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      d017bf6b
    • G
      TTY: move .gitignore from drivers/char/ to drivers/tty/vt/ · 1db01135
      Greg Kroah-Hartman 提交于
      The autogenerated files (consolemap_deftbl.c and defkeymap.c) need to
      be ignored by git, so move the .gitignore file that was doing it to the
      properly location now that the files have moved as well.
      
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Jiri Slaby <jslaby@suse.cz>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      1db01135
    • L
      ipw2x00: remove the right /proc/net entry · 151f52f0
      Linus Torvalds 提交于
      Commit 27ae60f8 ("ipw2x00: replace "ieee80211" with "libipw" where
      appropriate") changed DRV_NAME to be "libipw", but didn't properly fix
      up the places where it was used to specify the name for the /proc/net/
      directory.
      
      For backwards compatibility reasons, that directory name remained
      "ieee80211", but due to the DRV_NAME change, the error case printouts
      and the cleanup functions now used "libipw" instead.  Which made it all
      fail badly.
      
      For example, on module unload as reported by Randy:
      
        WARNING: at fs/proc/generic.c:816 remove_proc_entry+0x156/0x35e()
        name 'libipw'
      
      because it's trying to unregister a /proc directory that obviously
      doesn't even exist.
      
      Clean it all up to use DRV_PROCNAME for the actual /proc directory name.
      Reported-and-tested-by: NRandy Dunlap <randy.dunlap@oracle.com>
      Cc: Pavel Roskin <proski@gnu.org>
      Cc: John W. Linville <linville@tuxdriver.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      151f52f0
    • L
      Merge branch 'kvm-updates/2.6.37' of git://git.kernel.org/pub/scm/virt/kvm/kvm · d4285bd6
      Linus Torvalds 提交于
      * 'kvm-updates/2.6.37' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
        KVM: PPC: BookE: Load the lower half of MSR
        KVM: PPC: BookE: fix sleep with interrupts disabled
        KVM: PPC: e500: Call kvm_vcpu_uninit() before kvmppc_e500_tlb_uninit().
        PPC: KVM: Book E doesn't have __end_interrupts.
        KVM: x86: Issue smp_call_function_many with preemption disabled
        KVM: x86: fix information leak to userland
        KVM: PPC: fix information leak to userland
        KVM: MMU: fix rmap_remove on non present sptes
        KVM: Write protect memory after slot swap
      d4285bd6