1. 15 5月, 2012 4 次提交
    • J
      genirq: export handle_edge_irq() and irq_to_desc() · 3911ff30
      Jiri Kosina 提交于
      Export handle_edge_irq() and irq_to_desc() to modules to allow them to
      do things such as
      
      	__irq_set_handler_locked(...., handle_edge_irq);
      
      This fixes
      
      	ERROR: "handle_edge_irq" [drivers/gpio/gpio-pch.ko] undefined!
      	ERROR: "irq_to_desc" [drivers/gpio/gpio-pch.ko] undefined!
      
      when gpio-pch is being built as a module.
      
      This was introduced by commit df9541a6 ("gpio: pch9: Use proper flow
      type handlers") that added
      
      	__irq_set_handler_locked(d->irq, handle_edge_irq);
      
      but handle_edge_irq() was not exported for modules (and inlined
      __irq_set_handler_locked() requires irq_to_desc() exported as well)
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      3911ff30
    • P
      lockdep: fix oops in processing workqueue · 4d82a1de
      Peter Zijlstra 提交于
      Under memory load, on x86_64, with lockdep enabled, the workqueue's
      process_one_work() has been seen to oops in __lock_acquire(), barfing
      on a 0xffffffff00000000 pointer in the lockdep_map's class_cache[].
      
      Because it's permissible to free a work_struct from its callout function,
      the map used is an onstack copy of the map given in the work_struct: and
      that copy is made without any locking.
      
      Surprisingly, gcc (4.5.1 in Hugh's case) uses "rep movsl" rather than
      "rep movsq" for that structure copy: which might race with a workqueue
      user's wait_on_work() doing lock_map_acquire() on the source of the
      copy, putting a pointer into the class_cache[], but only in time for
      the top half of that pointer to be copied to the destination map.
      
      Boom when process_one_work() subsequently does lock_map_acquire()
      on its onstack copy of the lockdep_map.
      
      Fix this, and a similar instance in call_timer_fn(), with a
      lockdep_copy_map() function which additionally NULLs the class_cache[].
      
      Note: this oops was actually seen on 3.4-next, where flush_work() newly
      does the racing lock_map_acquire(); but Tejun points out that 3.4 and
      earlier are already vulnerable to the same through wait_on_work().
      
      * Patch orginally from Peter.  Hugh modified it a bit and wrote the
        description.
      Signed-off-by: NPeter Zijlstra <peterz@infradead.org>
      Reported-by: NHugh Dickins <hughd@google.com>
      LKML-Reference: <alpine.LSU.2.00.1205070951170.1544@eggly.anvils>
      Signed-off-by: NTejun Heo <tj@kernel.org>
      4d82a1de
    • T
      workqueue: skip nr_running sanity check in worker_enter_idle() if trustee is active · 544ecf31
      Tejun Heo 提交于
      worker_enter_idle() has WARN_ON_ONCE() which triggers if nr_running
      isn't zero when every worker is idle.  This can trigger spuriously
      while a cpu is going down due to the way trustee sets %WORKER_ROGUE
      and zaps nr_running.
      
      It first sets %WORKER_ROGUE on all workers without updating
      nr_running, releases gcwq->lock, schedules, regrabs gcwq->lock and
      then zaps nr_running.  If the last running worker enters idle
      inbetween, it would see stale nr_running which hasn't been zapped yet
      and trigger the WARN_ON_ONCE().
      
      Fix it by performing the sanity check iff the trustee is idle.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Reported-by: N"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
      Cc: stable@vger.kernel.org
      544ecf31
    • K
      printk() - isolate KERN_CONT users from ordinary complete lines · c313af14
      Kay Sievers 提交于
      Arrange the continuation printk() buffering to be fully separated from the
      ordinary full line users.
      
      Limit the exposure to races and wrong printk() line merges to users of
      continuation only. Ordinary full line users racing against continuation
      users will no longer affect each other.
      
      Multiple continuation users from different threads, racing against each
      other will not wrongly be merged into a single line, but printed as
      separate lines.
      
      Test output of a kernel module which starts two separate threads which
      race against each other, one of them printing a single full terminated
      line:
        printk("(AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA)\n");
      
      The other one printing the line, every character separate in a
      continuation loop:
        printk("(C");
        for (i = 0; i < 58; i++)
                printk(KERN_CONT "C");
        printk(KERN_CONT "C)\n");
      
      Behavior of single and non-thread-aware printk() buffer:
        # modprobe printk-race
        printk test init
        (CC(AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA)
        C(AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA)
        CC(AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA)
        C(AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA)
        CC(AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA)
        C(AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA)
        C(AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA)
        CC(AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA)
        C(AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA)
        C(AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA)
        CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC)
        (CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC)
      
      New behavior with separate and thread-aware continuation buffer:
        # modprobe printk-race
        printk test init
        (AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA)
        (AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA)
        (AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA)
        (CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC)
        (AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA)
        (AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA)
        (AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA)
        (AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA)
        (CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC)
        (CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC)
      
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Joe Perches <joe@perches.com>
      Cc: Ted Ts'o <tytso@mit.edu>
      Cc: Ingo Molnar  <mingo@kernel.org>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Sasha Levin <levinsasha928@gmail.com>
      Signed-off-by: NKay Sievers <kay@vrfy.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c313af14
  2. 14 5月, 2012 1 次提交
  3. 12 5月, 2012 1 次提交
  4. 11 5月, 2012 3 次提交
    • S
      printk: correctly align __log_buf · f8450fca
      Stephen Warren 提交于
      __log_buf must be aligned, because a 64-bit value is written directly
      to it as part of struct log. Alignment of the log entries is typically
      handled by log_store(), but this only triggers for subsequent entries,
      not the very first (or wrapped) entries.
      
      Cc: Kay Sievers <kay@vrfy.org>
      Signed-off-by: NStephen Warren <swarren@nvidia.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f8450fca
    • M
      namespaces, pid_ns: fix leakage on fork() failure · 5e2bf014
      Mike Galbraith 提交于
      Fork() failure post namespace creation for a child cloned with
      CLONE_NEWPID leaks pid_namespace/mnt_cache due to proc being mounted
      during creation, but not unmounted during cleanup.  Call
      pid_ns_release_proc() during cleanup.
      Signed-off-by: NMike Galbraith <efault@gmx.de>
      Acked-by: NOleg Nesterov <oleg@redhat.com>
      Reviewed-by: N"Eric W. Biederman" <ebiederm@xmission.com>
      Cc: Pavel Emelyanov <xemul@parallels.com>
      Cc: Cyrill Gorcunov <gorcunov@openvz.org>
      Cc: Louis Rilling <louis.rilling@kerlabs.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      5e2bf014
    • S
      tracing: Do not enable function event with enable · 9b63776f
      Steven Rostedt 提交于
      With the adding of function tracing event to perf, it caused a
      side effect that produces the following warning when enabling all
      events in ftrace:
      
       # echo 1 > /sys/kernel/debug/tracing/events/enable
      
      [console]
      event trace: Could not enable event function
      
      This is because when enabling all events via the debugfs system
      it ignores events that do not have a ->reg() function assigned.
      This was to skip over the ftrace internal events (as they are
      not TRACE_EVENTs). But as the ftrace function event now has
      a ->reg() function attached to it for use with perf, it is no
      longer ignored.
      
      Worse yet, this ->reg() function is being called when it should
      not be. It returns an error and causes the above warning to
      be printed.
      
      By adding a new event_call flag (TRACE_EVENT_FL_IGNORE_ENABLE)
      and have all ftrace internel event structures have it set,
      setting the events/enable will no longe try to incorrectly enable
      the function event and does not warn.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      9b63776f
  5. 10 5月, 2012 7 次提交
    • J
      compat: Fix RT signal mask corruption via sigprocmask · b7dafa0e
      Jan Kiszka 提交于
      compat_sys_sigprocmask reads a smaller signal mask from userspace than
      sigprogmask accepts for setting.  So the high word of blocked.sig[0]
      will be cleared, releasing any potentially blocked RT signal.
      
      This was discovered via userspace code that relies on get/setcontext.
      glibc's i386 versions of those functions use sigprogmask instead of
      rt_sigprogmask to save/restore signal mask and caused RT signal
      unblocking this way.
      
      As suggested by Linus, this replaces the sys_sigprocmask based compat
      version with one that open-codes the required logic, including the merge
      of the existing blocked set with the new one provided on SIG_SETMASK.
      Signed-off-by: NJan Kiszka <jan.kiszka@siemens.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      b7dafa0e
    • K
      printk() - restore timestamp printing at console output · 649e6ee3
      Kay Sievers 提交于
      The output of the timestamps got lost with the conversion of the
      kmsg buffer to records; restore the old behavior.
      
      Document, that CONFIG_PRINTK_TIME now only controls the output of
      the timestamps in the syslog() system call and on the console, and
      not the recording of the timestamps.
      
      Cc: Joe Perches <joe@perches.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Sasha Levin <levinsasha928@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Reported-by: NYinghai Lu <yinghai@kernel.org>
      Signed-off-by: NKay Sievers <kay@vrfy.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      649e6ee3
    • K
      printk() - do not merge continuation lines of different threads · 5c5d5ca5
      Kay Sievers 提交于
      This prevents the merging of printk() continuation lines of different
      threads, in the case they race against each other.
      
      It should properly isolate "atomic" single-line printk() users from
      continuation users, to make sure the single-line users will never be
      merged with the racy continuation ones.
      
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Sasha Levin <levinsasha928@gmail.com>
      Signed-off-by: NKay Sievers <kay@vrfy.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5c5d5ca5
    • K
      7f3a781d
    • P
      rcu: Make rcu_barrier() less disruptive · b1420f1c
      Paul E. McKenney 提交于
      The rcu_barrier() primitive interrupts each and every CPU, registering
      a callback on every CPU.  Once all of these callbacks have been invoked,
      rcu_barrier() knows that every callback that was registered before
      the call to rcu_barrier() has also been invoked.
      
      However, there is no point in registering a callback on a CPU that
      currently has no callbacks, most especially if that CPU is in a
      deep idle state.  This commit therefore makes rcu_barrier() avoid
      interrupting CPUs that have no callbacks.  Doing this requires reworking
      the handling of orphaned callbacks, otherwise callbacks could slip through
      rcu_barrier()'s net by being orphaned from a CPU that rcu_barrier() had
      not yet interrupted to a CPU that rcu_barrier() had already interrupted.
      This reworking was needed anyway to take a first step towards weaning
      RCU from the CPU_DYING notifier's use of stop_cpu().
      Signed-off-by: NPaul E. McKenney <paul.mckenney@linaro.org>
      Signed-off-by: NPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      b1420f1c
    • P
      rcu: Explicitly initialize RCU_FAST_NO_HZ per-CPU variables · 98248a0e
      Paul E. McKenney 提交于
      The current initialization of the RCU_FAST_NO_HZ per-CPU variables makes
      needless and fragile assumptions about the initial value of things like
      the jiffies counter.  This commit therefore explicitly initializes all of
      them that are better started with a non-zero value.  It also adds some
      comments describing the per-CPU state variables.
      Signed-off-by: NPaul E. McKenney <paul.mckenney@linaro.org>
      Signed-off-by: NPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      98248a0e
    • P
      rcu: Make RCU_FAST_NO_HZ handle timer migration · 21e52e15
      Paul E. McKenney 提交于
      The current RCU_FAST_NO_HZ assumes that timers do not migrate unless a
      CPU goes offline, in which case it assumes that the CPU will have to come
      out of dyntick-idle mode (cancelling the timer) in order to go offline.
      This is important because when RCU_FAST_NO_HZ permits a CPU to enter
      dyntick-idle mode despite having RCU callbacks pending, it posts a timer
      on that CPU to force a wakeup on that CPU.  This wakeup ensures that the
      CPU will eventually handle the end of the grace period, including invoking
      its RCU callbacks.
      
      However, Pascal Chapperon's test setup shows that the timer handler
      rcu_idle_gp_timer_func() really does get invoked in some cases.  This is
      problematic because this can cause the CPU that entered dyntick-idle
      mode despite still having RCU callbacks pending to remain in
      dyntick-idle mode indefinitely, which means that its RCU callbacks might
      never be invoked.  This situation can result in grace-period delays or
      even system hangs, which matches Pascal's observations of slow boot-up
      and shutdown (https://lkml.org/lkml/2012/4/5/142).  See also the bugzilla:
      
      	https://bugzilla.redhat.com/show_bug.cgi?id=806548
      
      This commit therefore causes the "should never be invoked" timer handler
      rcu_idle_gp_timer_func() to use smp_call_function_single() to wake up
      the CPU for which the timer was intended, allowing that CPU to invoke
      its RCU callbacks in a timely manner.
      Reported-by: NPascal Chapperon <pascal.chapperon@wanadoo.fr>
      Signed-off-by: NPaul E. McKenney <paul.mckenney@linaro.org>
      Signed-off-by: NPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      21e52e15
  6. 09 5月, 2012 1 次提交
  7. 08 5月, 2012 9 次提交
  8. 05 5月, 2012 5 次提交
    • T
      init_task: Create generic init_task instance · a4a2eb49
      Thomas Gleixner 提交于
      All archs define init_task in the same way (except ia64, but there is
      no particular reason why ia64 cannot use the common version). Create a
      generic instance so all archs can be converted over.
      
      The config switch is temporary and will be removed when all archs are
      converted over.
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Chen Liqin <liqin.chen@sunplusct.com>
      Cc: Chris Metcalf <cmetcalf@tilera.com>
      Cc: Chris Zankel <chris@zankel.net>
      Cc: David Howells <dhowells@redhat.com>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Guan Xuetao <gxt@mprc.pku.edu.cn>
      Cc: Haavard Skinnemoen <hskinnemoen@gmail.com>
      Cc: Hirokazu Takata <takata@linux-m32r.org>
      Cc: James E.J. Bottomley <jejb@parisc-linux.org>
      Cc: Jesper Nilsson <jesper.nilsson@axis.com>
      Cc: Jonas Bonn <jonas@southpole.se>
      Cc: Mark Salter <msalter@redhat.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Matt Turner <mattst88@gmail.com>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Mike Frysinger <vapier@gentoo.org>
      Cc: Paul Mundt <lethal@linux-sh.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Richard Kuo <rkuo@codeaurora.org>
      Cc: Richard Weinberger <richard@nod.at>
      Cc: Russell King <linux@arm.linux.org.uk>
      Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
      Link: http://lkml.kernel.org/r/20120503085034.092585287@linutronix.de
      a4a2eb49
    • J
      params: replace printk(KERN_<LVL>...) with pr_<lvl>(...) · b5f3abf9
      Jim Cromie 提交于
      I left 1 printk which uses __FILE__, __LINE__ explicitly, which should
      not be subject to generic preferences expressed via pr_fmt().
      
      + tweaks suggested by Joe Perches:
      - add doing to irq-enabled warning, like others.  It wont happen often..
      - change sysfs failure crit, not just err, make it 1 line in logs.
      - coalese 2 format fragments into 1 >80 char line
      
      cc: Joe Perches <joe@perches.com>
      Signed-off-by: NJim Cromie <jim.cromie@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b5f3abf9
    • J
      params.c: fix Smack complaint about parse_args · 1ef9eaf2
      Jim Cromie 提交于
      In commit 9fb48c74: "params: add 3rd arg to option handler callback
      signature", the if-guard added to the pr_debug was overzealous; no
      callers pass NULL, and existing code above and below the guard assumes
      as much.  Change the if-guard to match, and silence the Smack
      complaint.
      
      CC: Dan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: NJim Cromie <jim.cromie@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1ef9eaf2
    • T
      genirq: Do not consider disabled wakeup irqs · 9c6079aa
      Thomas Gleixner 提交于
      If an wakeup interrupt has been disabled before the suspend code
      disables all interrupts then we have to ignore the pending flag.
      
      Otherwise we would abort suspend over and over as nothing clears the
      pending flag because the interrupt is disabled.
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: NeilBrown <neilb@suse.de>
      9c6079aa
    • T
      genirq: Allow check_wakeup_irqs to notice level-triggered interrupts · d4dc0f90
      Thomas Gleixner 提交于
      Level triggered interrupts do not cause IRQS_PENDING to be set when
      they fire while "disabled" as the 'pending' state is always present in
      the level - they automatically refire where re-enabled.
      
      However the IRQS_PENDING flag is also used to abort a suspend cycle -
      if any 'is_wakeup_set' interrupt is PENDING, check_wakeup_irqs() will
      cause suspend to abort. Without IRQS_PENDING, suspend won't abort.
      
      Consequently, level-triggered interrupts that fire during the 'noirq'
      phase of suspend do not currently abort suspend.
      
      So set IRQS_PENDING even for level triggered interrupts, and make sure
      to clear the flag in check_irq_resend.
      
      [ Changelog by courtesy of Neil ]
      Tested-by: NNeilBrown <neilb@suse.de>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      d4dc0f90
  9. 04 5月, 2012 2 次提交
  10. 03 5月, 2012 2 次提交
  11. 01 5月, 2012 5 次提交
    • P
      rcu: Ensure that RCU_FAST_NO_HZ timers expire on correct CPU · f511fc62
      Paul E. McKenney 提交于
      Timers are subject to migration, which can lead to the following
      system-hang scenario when CONFIG_RCU_FAST_NO_HZ=y:
      
      1.	CPU 0 executes synchronize_rcu(), which posts an RCU callback.
      
      2.	CPU 0 then goes idle.  It cannot immediately invoke the callback,
      	but there is nothing RCU needs from ti, so it enters dyntick-idle
      	mode after posting a timer.
      
      3.	The timer gets migrated to CPU 1.
      
      4.	CPU 0 never wakes up, so the synchronize_rcu() never returns, so
      	the system hangs.
      
      This commit fixes this problem by using mod_timer_pinned(), as suggested
      by Peter Zijlstra, to ensure that the timer is actually posted on the
      running CPU.
      Reported-by: NDipankar Sarma <dipankar@in.ibm.com>
      Signed-off-by: NPaul E. McKenney <paul.mckenney@linaro.org>
      Signed-off-by: NPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      f511fc62
    • J
      dynamic_debug: make dynamic-debug work for module initialization · b48420c1
      Jim Cromie 提交于
      This introduces a fake module param $module.dyndbg.  Its based upon
      Thomas Renninger's $module.ddebug boot-time debugging patch from
      https://lkml.org/lkml/2010/9/15/397
      
      The 'fake' module parameter is provided for all modules, whether or
      not they need it.  It is not explicitly added to each module, but is
      implemented in callbacks invoked from parse_args.
      
      For builtin modules, dynamic_debug_init() now directly calls
      parse_args(..., &ddebug_dyndbg_boot_params_cb), to process the params
      undeclared in the modules, just after the ddebug tables are processed.
      
      While its slightly weird to reprocess the boot params, parse_args() is
      already called repeatedly by do_initcall_levels().  More importantly,
      the dyndbg queries (given in ddebug_query or dyndbg params) cannot be
      activated until after the ddebug tables are ready, and reusing
      parse_args is cleaner than doing an ad-hoc parse.  This reparse would
      break options like inc_verbosity, but they probably should be params,
      like verbosity=3.
      
      ddebug_dyndbg_boot_params_cb() handles both bare dyndbg (aka:
      ddebug_query) and module-prefixed dyndbg params, and ignores all other
      parameters.  For example, the following will enable pr_debug()s in 4
      builtin modules, in the order given:
      
        dyndbg="module params +p; module aio +p" module.dyndbg=+p pci.dyndbg
      
      For loadable modules, parse_args() in load_module() calls
      ddebug_dyndbg_module_params_cb().  This handles bare dyndbg params as
      passed from modprobe, and errors on other unknown params.
      
      Note that modprobe reads /proc/cmdline, so "modprobe foo" grabs all
      foo.params, strips the "foo.", and passes these to the kernel.
      ddebug_dyndbg_module_params_cb() is again called for the unknown
      params; it handles dyndbg, and errors on others.  The "doing" arg
      added previously contains the module name.
      
      For non CONFIG_DYNAMIC_DEBUG builds, the stub function accepts
      and ignores $module.dyndbg params, other unknowns get -ENOENT.
      
      If no param value is given (as in pci.dyndbg example above), "+p" is
      assumed, which enables all pr_debug callsites in the module.
      
      The dyndbg fake parameter is not shown in /sys/module/*/parameters,
      thus it does not use any resources.  Changes to it are made via the
      control file.
      
      Also change pr_info in ddebug_exec_queries to vpr_info,
      no need to see it all the time.
      Signed-off-by: NJim Cromie <jim.cromie@gmail.com>
      CC: Thomas Renninger <trenn@suse.de>
      CC: Rusty Russell <rusty@rustcorp.com.au>
      Acked-by: NJason Baron <jbaron@redhat.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b48420c1
    • J
      params: add 3rd arg to option handler callback signature · 9fb48c74
      Jim Cromie 提交于
      Add a 3rd arg, named "doing", to unknown-options callbacks invoked
      from parse_args(). The arg is passed as:
      
        "Booting kernel" from start_kernel(),
        initcall_level_names[i] from do_initcall_level(),
        mod->name from load_module(), via parse_args(), parse_one()
      
      parse_args() already has the "name" parameter, which is renamed to
      "doing" to better reflect current uses 1,2 above.  parse_args() passes
      it to an altered parse_one(), which now passes it down into the
      unknown option handler callbacks.
      
      The mod->name will be needed to handle dyndbg for loadable modules,
      since params passed by modprobe are not qualified (they do not have a
      "$modname." prefix), and by the time the unknown-param callback is
      called, the module name is not otherwise available.
      
      Minor tweaks:
      
      Add param-name to parse_one's pr_debug(), current message doesnt
      identify the param being handled, add it.
      
      Add a pr_info to print current level and level_name of the initcall,
      and number of registered initcalls at that level.  This adds 7 lines
      to dmesg output, like:
      
         initlevel:6=device, 172 registered initcalls
      
      Drop "parameters" from initcall_level_names[], its unhelpful in the
      pr_info() added above.  This array is passed into parse_args() by
      do_initcall_level().
      
      CC: Rusty Russell <rusty@rustcorp.com.au>
      Signed-off-by: NJim Cromie <jim.cromie@gmail.com>
      Acked-by: NJason Baron <jbaron@redhat.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9fb48c74
    • L
      rcu: Add rcutorture test for call_srcu() · 9059c940
      Lai Jiangshan 提交于
      Add srcu_torture_deferred_free() for srcu_ops so as to test the new
      call_srcu().  Rename the original srcu_ops to srcu_sync_ops.
      Signed-off-by: NLai Jiangshan <laijs@cn.fujitsu.com>
      Signed-off-by: NPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      9059c940
    • L
      rcu: Implement per-domain single-threaded call_srcu() state machine · 931ea9d1
      Lai Jiangshan 提交于
      This commit implements an SRCU state machine in support of call_srcu().
      The state machine is preemptible, light-weight, and single-threaded,
      minimizing synchronization overhead.  In particular, there is no longer
      any need for synchronize_srcu() to be guarded by a mutex.
      
      Expedited processing is handled, at least in the absence of concurrent
      grace-period operations on that same srcu_struct structure, by having
      the synchronize_srcu_expedited() thread take on the role of the
      workqueue thread for one iteration.
      
      There is a reasonable probability that a given SRCU callback will
      be invoked on the same CPU that registered it, however, there is no
      guarantee.  Concurrent SRCU grace-period primitives can cause callbacks
      to be executed elsewhere, even in absence of CPU-hotplug operations.
      
      Callbacks execute in process context, but under the influence of
      local_bh_disable(), so it is illegal to sleep in an SRCU callback
      function.
      Signed-off-by: NLai Jiangshan <laijs@cn.fujitsu.com>
      Acked-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Signed-off-by: NPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      931ea9d1