1. 26 Jun, 2006 1 commit
  2. 08 Apr, 2006 1 commit
  3. 27 Mar, 2006 1 commit
    • Alan Stern's avatar
      [PATCH] Notifier chain update: API changes · e041c683
      Alan Stern authored
      The kernel's implementation of notifier chains is unsafe.  There is no
      protection against entries being added to or removed from a chain while the
      chain is in use.  The issues were discussed in this thread:
      We noticed that notifier chains in the kernel fall into two basic usage
      	"Blocking" chains are always called from a process context
      	and the callout routines are allowed to sleep;
      	"Atomic" chains can be called from an atomic context and
      	the callout routines are not allowed to sleep.
      We decided to codify this distinction and make it part of the API.  Therefore
      this set of patches introduces three new, parallel APIs: one for blocking
      notifiers, one for atomic notifiers, and one for "raw" notifiers (which is
      really just the old API under a new name).  New kinds of data structures are
      used for the heads of the chains, and new routines are defined for
      registration, unregistration, and calling a chain.  The three APIs are
      explained in include/linux/notifier.h and their implementation is in
      With atomic and blocking chains, the implementation guarantees that the chain
      links will not be corrupted and that chain callers will not get messed up by
      entries being added or removed.  For raw chains the implementation provides no
      guarantees at all; users of this API must provide their own protections.  (The
      idea was that situations may come up where the assumptions of the atomic and
      blocking APIs are not appropriate, so it should be possible for users to
      handle these things in their own way.)
      There are some limitations, which should not be too hard to live with.  For
      atomic/blocking chains, registration and unregistration must always be done in
      a process context since the chain is protected by a mutex/rwsem.  Also, a
      callout routine for a non-raw chain must not try to register or unregister
      entries on its own chain.  (This did happen in a couple of places and the code
      had to be changed to avoid it.)
      Since atomic chains may be called from within an NMI handler, they cannot use
      spinlocks for synchronization.  Instead we use RCU.  The overhead falls almost
      entirely in the unregister routine, which is okay since unregistration is much
      less frequent that calling a chain.
      Here is the list of chains that we adjusted and their classifications.  None
      of them use the raw API, so for the moment it is only a placeholder.
      arch/i386/kernel/traps.c:		i386die_chain
      arch/ia64/kernel/traps.c:		ia64die_chain
      arch/powerpc/kernel/traps.c:		powerpc_die_chain
      arch/sparc64/kernel/traps.c:		sparc64die_chain
      arch/x86_64/kernel/traps.c:		die_chain
      drivers/char/ipmi/ipmi_si_intf.c:	xaction_notifier_list
      kernel/panic.c:				panic_notifier_list
      kernel/profile.c:			task_free_notifier
      net/bluetooth/hci_core.c:		hci_notifier
      net/ipv4/netfilter/ip_conntrack_core.c:	ip_conntrack_chain
      net/ipv4/netfilter/ip_conntrack_core.c:	ip_conntrack_expect_chain
      net/ipv6/addrconf.c:			inet6addr_chain
      net/netfilter/nf_conntrack_core.c:	nf_conntrack_chain
      net/netfilter/nf_conntrack_core.c:	nf_conntrack_expect_chain
      net/netlink/af_netlink.c:		netlink_chain
      arch/powerpc/platforms/pseries/reconfig.c:	pSeries_reconfig_chain
      arch/s390/kernel/process.c:		idle_chain
      arch/x86_64/kernel/process.c		idle_notifier
      drivers/base/memory.c:			memory_chain
      drivers/cpufreq/cpufreq.c		cpufreq_policy_notifier_list
      drivers/cpufreq/cpufreq.c		cpufreq_transition_notifier_list
      drivers/macintosh/adb.c:		adb_client_list
      drivers/macintosh/via-pmu.c		sleep_notifier_list
      drivers/macintosh/via-pmu68k.c		sleep_notifier_list
      drivers/macintosh/windfarm_core.c	wf_client_list
      drivers/usb/core/notify.c		usb_notifier_list
      drivers/video/fbmem.c			fb_notifier_list
      kernel/cpu.c				cpu_chain
      kernel/module.c				module_notify_list
      kernel/profile.c			munmap_notifier
      kernel/profile.c			task_exit_notifier
      kernel/sys.c				reboot_notifier_list
      net/core/dev.c				netdev_chain
      net/decnet/dn_dev.c:			dnaddr_chain
      net/ipv4/devinet.c:			inetaddr_chain
      It's possible that some of these classifications are wrong.  If they are,
      please let us know or submit a patch to fix them.  Note that any chain that
      gets called very frequently should be atomic, because the rwsem read-locking
      used for blocking chains is very likely to incur cache misses on SMP systems.
      (However, if the chain's callout routines may sleep then the chain cannot be
      The patch set was written by Alan Stern and Chandra Seetharaman, incorporating
      material written by Keith Owens and suggestions from Paul McKenney and Andrew
      [jes@sgi.com: restructure the notifier chain initialization macros]
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarChandra Seetharaman <sekharan@us.ibm.com>
      Signed-off-by: default avatarJes Sorensen <jes@sgi.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
  4. 07 Nov, 2005 1 commit
    • Keith Owens's avatar
      [IA64] Extend notify_die() hooks for IA64 · 9138d581
      Keith Owens authored
      notify_die() added for MCA_{MONARCH,SLAVE,RENDEZVOUS}_{ENTER,PROCESS,LEAVE} and
      notification points for these events because they can take many seconds
      to run which has nasty effects on the behaviour of the rest of the
      DIE_SS replaced by a generic DIE_FAULT which checks the vector number,
      to allow interception of faults other than SS.
      DIE_MACHINE_{HALT,RESTART} added to allow last minute close down
      processing, especially when the halt/restart routines are called from
      error handlers.
      DIE_OOPS added.
      The check for kprobe's break numbers has been moved from traps.c to
      kprobes.c, allowing DIE_BREAK to be used for any additional break
      numbers, i.e. it is no longer kprobes specific.
      Hooks for kernel debuggers and kernel dumpers added, ENTER and LEAVE.
      Both of these disable the system for long periods which impact on
      watchdogs and heartbeat systems in general.  More patches to come that
      use these events to reset watchdogs and heartbeats.
      unregister_die_notifier() added and both routines exported.  Requested
      by Dean Nelson.
      Lock removed from {un,}register_die_notifier.  notifier_chain_register()
      already takes a lock.  Also the generic notifier chain locking is being
      reworked to distinguish between callbacks that can block and those that
      cannot, the lock in {un,}register_die_notifier would interfere with
      that change.  http://marc.theaimsgroup.com/?l=linux-kernel&m=113018709002036&w=2
      Leading white space removed from arch/ia64/kernel/kprobes.c.
      Typo in mca.c in original version of this patch found & fixed by Dean
      Signed-off-by: default avatarKeith Owens <kaos@sgi.com>
      Acked-by: default avatarDean Nelson <dcn@sgi.com>
      Acked-by: default avatarAnil Keshavamurthy <anil.s.keshavamurthy@intel.com>
      Signed-off-by: default avatarTony Luck <tony.luck@intel.com>
  5. 23 Jun, 2005 1 commit
    • Anil S Keshavamurthy's avatar
      [PATCH] Kprobes/IA64: kdebug die notification mechanism · 7213b252
      Anil S Keshavamurthy authored
      As many of you know that kprobes exist in the main line kernel for various
      architecture including i386, x86_64, ppc64 and sparc64.  Attached patches
      following this mail are a port of Kprobes and Jprobes for IA64.
      I have tesed this patches for kprobes and Jprobes and this seems to work fine.
       I have tested this patch by inserting kprobes on various slots and various
      templates including various types of branch instructions.
      I have also tested this patch using the tool
       and the
      kprobes for IA64 works great.
      Here is list of TODO things and pathes for the same will appear soon.
      1) Support kprobes on "mov r1=ip" type of instruction
      2) Support Kprobes and Jprobes to exist on the same address
      3) Support Return probes
      3) Architecture independent cleanup of kprobes
      This patch adds the kdebug die notification mechanism needed by Kprobes.
      For break instruction on Branch type slot, imm21 is ignored and value
      zero is placed in IIM register, hence we need to handle kprobes
      for switch case zero.
      Signed-off-by: default avatarAnil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
      Signed-off-by: default avatarRusty Lynch <Rusty.lynch@intel.com>
      From: Rusty Lynch <rusty.lynch@intel.com>
      At the point in traps.c where we recieve a break with a zero value, we can
      not say if the break was a result of a kprobe or some other debug facility.
      This simple patch changes the informational string to a more correct "break
      0" value, and applies to the 2.6.12-rc2-mm2 tree with all the kprobes
      patches that were just recently included for the next mm cut.
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>