1. 28 Jun, 2006 40 commits
    • Peter Williams's avatar
      [PATCH] sched: modify move_tasks() to improve load balancing outcomes · 50ddd969
      Peter Williams authored
      Problem:
      
      The move_tasks() function is designed to move UP TO the amount of load it
      is asked to move and in doing this it skips over tasks looking for ones
      whose load weights are less than or equal to the remaining load to be
      moved.  This is (in general) a good thing but it has the unfortunate result
      of breaking one of the original load balancer's good points: namely, that
      (within the limits imposed by the active/expired array model and the fact
      the expired is processed first) it moves high priority tasks before low
      priority ones and this means there's a good chance (see active/expired
      problem for why it's only a chance) that the highest priority task on the
      queue but not actually on the CPU will be moved to the other CPU where (as
      a high priority task) it may preempt the current task.
      
      Solution:
      
      Modify move_tasks() so that high priority tasks are not skipped when moving
      them will make them the highest priority task on their new run queue.
      Signed-off-by: default avatarPeter Williams <pwil3058@bigpond.com.au>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: "Siddha, Suresh B" <suresh.b.siddha@intel.com>
      Cc: "Chen, Kenneth W" <kenneth.w.chen@intel.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      50ddd969
    • Peter Williams's avatar
      [PATCH] sched: implement smpnice · 2dd73a4f
      Peter Williams authored
      Problem:
      
      The introduction of separate run queues per CPU has brought with it "nice"
      enforcement problems that are best described by a simple example.
      
      For the sake of argument suppose that on a single CPU machine with a
      nice==19 hard spinner and a nice==0 hard spinner running that the nice==0
      task gets 95% of the CPU and the nice==19 task gets 5% of the CPU.  Now
      suppose that there is a system with 2 CPUs and 2 nice==19 hard spinners and
      2 nice==0 hard spinners running.  The user of this system would be entitled
      to expect that the nice==0 tasks each get 95% of a CPU and the nice==19
      tasks only get 5% each.  However, whether this expectation is met is pretty
      much down to luck as there are four equally likely distributions of the
      tasks to the CPUs that the load balancing code will consider to be balanced
      with loads of 2.0 for each CPU.  Two of these distributions involve one
      nice==0 and one nice==19 task per CPU and in these circumstances the users
      expectations will be met.  The other two distributions both involve both
      nice==0 tasks being on one CPU and both nice==19 being on the other CPU and
      each task will get 50% of a CPU and the user's expectations will not be
      met.
      
      Solution:
      
      The solution to this problem that is implemented in the attached patch is
      to use weighted loads when determining if the system is balanced and, when
      an imbalance is detected, to move an amount of weighted load between run
      queues (as opposed to a number of tasks) to restore the balance.  Once
      again, the easiest way to explain why both of these measures are necessary
      is to use a simple example.  Suppose that (in a slight variation of the
      above example) that we have a two CPU system with 4 nice==0 and 4 nice=19
      hard spinning tasks running and that the 4 nice==0 tasks are on one CPU and
      the 4 nice==19 tasks are on the other CPU.  The weighted loads for the two
      CPUs would be 4.0 and 0.2 respectively and the load balancing code would
      move 2 tasks resulting in one CPU with a load of 2.0 and the other with
      load of 2.2.  If this was considered to be a big enough imbalance to
      justify moving a task and that task was moved using the current
      move_tasks() then it would move the highest priority task that it found and
      this would result in one CPU with a load of 3.0 and the other with a load
      of 1.2 which would result in the movement of a task in the opposite
      direction and so on -- infinite loop.  If, on the other hand, an amount of
      load to be moved is calculated from the imbalance (in this case 0.1) and
      move_tasks() skips tasks until it find ones whose contributions to the
      weighted load are less than this amount it would move two of the nice==19
      tasks resulting in a system with 2 nice==0 and 2 nice=19 on each CPU with
      loads of 2.1 for each CPU.
      
      One of the advantages of this mechanism is that on a system where all tasks
      have nice==0 the load balancing calculations would be mathematically
      identical to the current load balancing code.
      
      Notes:
      
      struct task_struct:
      
      has a new field load_weight which (in a trade off of space for speed)
      stores the contribution that this task makes to a CPU's weighted load when
      it is runnable.
      
      struct runqueue:
      
      has a new field raw_weighted_load which is the sum of the load_weight
      values for the currently runnable tasks on this run queue.  This field
      always needs to be updated when nr_running is updated so two new inline
      functions inc_nr_running() and dec_nr_running() have been created to make
      sure that this happens.  This also offers a convenient way to optimize away
      this part of the smpnice mechanism when CONFIG_SMP is not defined.
      
      int try_to_wake_up():
      
      in this function the value SCHED_LOAD_BALANCE is used to represent the load
      contribution of a single task in various calculations in the code that
      decides which CPU to put the waking task on.  While this would be a valid
      on a system where the nice values for the runnable tasks were distributed
      evenly around zero it will lead to anomalous load balancing if the
      distribution is skewed in either direction.  To overcome this problem
      SCHED_LOAD_SCALE has been replaced by the load_weight for the relevant task
      or by the average load_weight per task for the queue in question (as
      appropriate).
      
      int move_tasks():
      
      The modifications to this function were complicated by the fact that
      active_load_balance() uses it to move exactly one task without checking
      whether an imbalance actually exists.  This precluded the simple
      overloading of max_nr_move with max_load_move and necessitated the addition
      of the latter as an extra argument to the function.  The internal
      implementation is then modified to move up to max_nr_move tasks and
      max_load_move of weighted load.  This slightly complicates the code where
      move_tasks() is called and if ever active_load_balance() is changed to not
      use move_tasks() the implementation of move_tasks() should be simplified
      accordingly.
      
      struct sched_group *find_busiest_group():
      
      Similar to try_to_wake_up(), there are places in this function where
      SCHED_LOAD_SCALE is used to represent the load contribution of a single
      task and the same issues are created.  A similar solution is adopted except
      that it is now the average per task contribution to a group's load (as
      opposed to a run queue) that is required.  As this value is not directly
      available from the group it is calculated on the fly as the queues in the
      groups are visited when determining the busiest group.
      
      A key change to this function is that it is no longer to scale down
      *imbalance on exit as move_tasks() uses the load in its scaled form.
      
      void set_user_nice():
      
      has been modified to update the task's load_weight field when it's nice
      value and also to ensure that its run queue's raw_weighted_load field is
      updated if it was runnable.
      
      From: "Siddha, Suresh B" <suresh.b.siddha@intel.com>
      
      With smpnice, sched groups with highest priority tasks can mask the imbalance
      between the other sched groups with in the same domain.  This patch fixes some
      of the listed down scenarios by not considering the sched groups which are
      lightly loaded.
      
      a) on a simple 4-way MP system, if we have one high priority and 4 normal
         priority tasks, with smpnice we would like to see the high priority task
         scheduled on one cpu, two other cpus getting one normal task each and the
         fourth cpu getting the remaining two normal tasks.  but with current
         smpnice extra normal priority task keeps jumping from one cpu to another
         cpu having the normal priority task.  This is because of the
         busiest_has_loaded_cpus, nr_loaded_cpus logic..  We are not including the
         cpu with high priority task in max_load calculations but including that in
         total and avg_load calcuations..  leading to max_load < avg_load and load
         balance between cpus running normal priority tasks(2 Vs 1) will always show
         imbalanace as one normal priority and the extra normal priority task will
         keep moving from one cpu to another cpu having normal priority task..
      
      b) 4-way system with HT (8 logical processors).  Package-P0 T0 has a
         highest priority task, T1 is idle.  Package-P1 Both T0 and T1 have 1 normal
         priority task each..  P2 and P3 are idle.  With this patch, one of the
         normal priority tasks on P1 will be moved to P2 or P3..
      
      c) With the current weighted smp nice calculations, it doesn't always make
         sense to look at the highest weighted runqueue in the busy group..
         Consider a load balance scenario on a DP with HT system, with Package-0
         containing one high priority and one low priority, Package-1 containing one
         low priority(with other thread being idle)..  Package-1 thinks that it need
         to take the low priority thread from Package-0.  And find_busiest_queue()
         returns the cpu thread with highest priority task..  And ultimately(with
         help of active load balance) we move high priority task to Package-1.  And
         same continues with Package-0 now, moving high priority task from package-1
         to package-0..  Even without the presence of active load balance, load
         balance will fail to balance the above scenario..  Fix find_busiest_queue
         to use "imbalance" when it is lightly loaded.
      
      [kernel@kolivas.org: sched: store weighted load on up]
      [kernel@kolivas.org: sched: add discrete weighted cpu load function]
      [suresh.b.siddha@intel.com: sched: remove dead code]
      Signed-off-by: default avatarPeter Williams <pwil3058@bigpond.com.au>
      Cc: "Siddha, Suresh B" <suresh.b.siddha@intel.com>
      Cc: "Chen, Kenneth W" <kenneth.w.chen@intel.com>
      Acked-by: default avatarIngo Molnar <mingo@elte.hu>
      Cc: Nick Piggin <nickpiggin@yahoo.com.au>
      Signed-off-by: default avatarCon Kolivas <kernel@kolivas.org>
      Cc: John Hawkes <hawkes@sgi.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      2dd73a4f
    • Kirill Korotaev's avatar
      [PATCH] sched: CPU hotplug race vs. set_cpus_allowed() · efc30814
      Kirill Korotaev authored
      There is a race between set_cpus_allowed() and move_task_off_dead_cpu().
      __migrate_task() doesn't report any err code, so task can be left on its
      runqueue if its cpus_allowed mask changed so that dest_cpu is not longer a
      possible target.  Also, chaning cpus_allowed mask requires rq->lock being
      held.
      Signed-off-by: default avatarKirill Korotaev <dev@openvz.org>
      Acked-By: default avatarIngo Molnar <mingo@elte.hu>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      efc30814
    • Steven Rostedt's avatar
      [PATCH] unnecessary long index i in sched · cc94abfc
      Steven Rostedt authored
      Unless we expect to have more than 2G CPUs, there's no reason to have 'i'
      as a long long here.
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      cc94abfc
    • Con Kolivas's avatar
      [PATCH] sched: fix interactive ceiling code · 72d2854d
      Con Kolivas authored
      The relationship between INTERACTIVE_SLEEP and the ceiling is not perfect
      and not explicit enough.  The sleep boost is not supposed to be any larger
      than without this code and the comment is not clear enough about what
      exactly it does, just the reason it does it.  Fix it.
      
      There is a ceiling to the priority beyond which tasks that only ever sleep
      for very long periods cannot surpass.  Fix it.
      
      Prevent the on-runqueue bonus logic from defeating the idle sleep logic.
      
      Opportunity to micro-optimise.
      Signed-off-by: default avatarCon Kolivas <kernel@kolivas.org>
      Signed-off-by: default avatarMike Galbraith <efault@gmx.de>
      Acked-by: default avatarIngo Molnar <mingo@elte.hu>
      Signed-off-by: default avatarKen Chen <kenneth.w.chen@intel.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      72d2854d
    • Steven Rostedt's avatar
      d444886e
    • Chen, Kenneth W's avatar
      [PATCH] sched: fix smt nice lock contention and optimization · c96d145e
      Chen, Kenneth W authored
      Initial report and lock contention fix from Chris Mason:
      
      Recent benchmarks showed some performance regressions between 2.6.16 and
      2.6.5.  We tracked down one of the regressions to lock contention in
      schedule heavy workloads (~70,000 context switches per second)
      
      kernel/sched.c:dependent_sleeper() was responsible for most of the lock
      contention, hammering on the run queue locks.  The patch below is more of a
      discussion point than a suggested fix (although it does reduce lock
      contention significantly).  The dependent_sleeper code looks very expensive
      to me, especially for using a spinlock to bounce control between two
      different siblings in the same cpu.
      
      It is further optimized:
      
      * perform dependent_sleeper check after next task is determined
      * convert wake_sleeping_dependent to use trylock
      * skip smt runqueue check if trylock fails
      * optimize double_rq_lock now that smt nice is converted to trylock
      * early exit in searching first SD_SHARE_CPUPOWER domain
      * speedup fast path of dependent_sleeper
      
      [akpm@osdl.org: cleanup]
      Signed-off-by: default avatarKen Chen <kenneth.w.chen@intel.com>
      Acked-by: default avatarIngo Molnar <mingo@elte.hu>
      Acked-by: default avatarCon Kolivas <kernel@kolivas.org>
      Signed-off-by: default avatarNick Piggin <npiggin@suse.de>
      Acked-by: default avatarChris Mason <mason@suse.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      c96d145e
    • Jim Cromie's avatar
      [PATCH] chardev: GPIO for SCx200 & PC-8736x: add proper Kconfig, Makefile entries · 7a8e2a5e
      Jim Cromie authored
      Replace the temp makefile hacks with proper CONFIG entries, which are also
      added to Kconfig.
      Signed-off-by: default avatarJim Cromie <jim.cromie@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      7a8e2a5e
    • Jim Cromie's avatar
      [PATCH] chardev: GPIO for SCx200 & PC-8736x: display pin values in/out in gpio_dump · 23916a8e
      Jim Cromie authored
      Add current pin settings to gpio_dump() output.  This adds the last 'word' to
      the syslog lines, which displays the input and output values that the pin is
      set to.
      
        pc8736x_gpio.0: io00: 0x0044 TS OD PUE  EDGE LO DEBOUNCE        io:1/1
      
      The 2 values may differ for a number of reasons:
      1- the pin output circuitry is diaabled, (as the above 'TS' indicates)
      2- it needs a pullup resistor to drive the attached circuit,
      3- the external circuit needs a pullup so the open-drain has something
         to pull-down
      4- the pin is wired to Vcc or Ground
      
      It might be appropriate to add a WARN for 2,3,4, since they could
      damage the chip and/or circuit, esp if misconfig goes unnoticed.
      Signed-off-by: default avatarJim Cromie <jim.cromie@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      23916a8e
    • Jim Cromie's avatar
      [PATCH] gpio-patchset-fixups: include linux/io.h · ec312310
      Jim Cromie authored
      Hmm.  Im somewhat ambivalent about this patch, since with it, driver wont
      build for vanilla 17 or older.
      
      Its also only 1/2 of your suggestion - when I tried it, I was building against
      vanilla 17, and asm/uaccess.h cause compilation failure.  Looking back, Im
      perplexed as to why linux/io.h didnt cause same failure ?!?
      
      use linux/io.h rather than asm/io.h
      Signed-off-by: default avatarJim Cromie <jim.cromie@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      ec312310
    • Jim Cromie's avatar
      [PATCH] chardev: GPIO for SCx200 & PC-8736x: replace spinlocks w mutexes · 8bcf6135
      Jim Cromie authored
      Replace spinlocks guarding gpio config ops with mutexes.  This is a me-too
      patch, and is justifiable insofar as mutexes have stricter semantics and
      better debugging support, so are preferred where they are applicable.
      Signed-off-by: default avatarJim Cromie <jim.cromie@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      8bcf6135
    • Jim Cromie's avatar
      [PATCH] chardev: GPIO for SCx200 & PC-8736x: fix gpio_current, use shadow regs · 6cad56fd
      Jim Cromie authored
      Add a working gpio_current() to pc8736x_gpio.c (the previous implementation
      just threw a dev_warn), and fix gpio_change() to use gpio_current() rather
      than the incorrect (and temporary) gpio_get().  Initialize shadow-regs so this
      all works.
      Signed-off-by: default avatarJim Cromie <jim.cromie@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      6cad56fd
    • Jim Cromie's avatar
      [PATCH] chardev: GPIO for SCx200 & PC-8736x: use dev_dbg in common module · f31000e5
      Jim Cromie authored
      Use of dev_dbg() and friends is considered good practice.  dev_dbg() needs a
      struct device *devp, but nsc_gpio is only a helper module, so it doesnt
      have/need its own.  To provide devp to the user-modules (scx200 & pc8736x
      _gpio), we add it to the vtable, and set it during init.
      
      Also squeeze nsc_gpio_dump()'s format a little.
      
      [  199.259879]  pc8736x_gpio.0: io09: 0x0044 TS OD PUE  EDGE LO DEBOUNCE
      Signed-off-by: default avatarJim Cromie <jim.cromie@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      f31000e5
    • Jim Cromie's avatar
      [PATCH] chardev: GPIO for SCx200 & PC-8736x: add platform_device for use w dev_dbg · 58b087cd
      Jim Cromie authored
      Adds platform-device to (just introduced) driver, and uses it to replace many
      printks with dev_dbg() etc.  This could trivially be merged into previous
      patch, but this way matches better with the corresponding patch that does the
      same change to scx200_gpio.
      Signed-off-by: default avatarJim Cromie <jim.cromie@gmail.com>
      Cc: Greg KH <greg@kroah.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      58b087cd
    • Jim Cromie's avatar
      [PATCH] chardev: GPIO for SCx200 & PC-8736x: add new pc8736x_gpio module · 681a3e7d
      Jim Cromie authored
      Add the brand new pc8736x_gpio driver.  This is mostly based upon
      scx200_gpio.c, but the platform_dev is treated separately, since its fairly
      big too.
      Signed-off-by: default avatarJim Cromie <jim.cromie@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      681a3e7d
    • Jim Cromie's avatar
      [PATCH] chardev: GPIO for SCx200 & PC-8736x: migrate gpio_dump to common module · 0e41ef3c
      Jim Cromie authored
      Since the meaning of config-bits is the same for scx200 and pc8736x _gpios, we
      can share a function to deliver this to user.  Since it is called via the
      vtable, its also completely replaceable.  For now, we keep using printk...
      Signed-off-by: default avatarJim Cromie <jim.cromie@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      0e41ef3c
    • Jim Cromie's avatar
      [PATCH] chardev: GPIO for SCx200 & PC-8736x: migrate file-ops to common module · 1a66fdf0
      Jim Cromie authored
      Now that the read(), write() file-ops are dispatching gpio-ops via the vtable,
      they are generic, and can be moved 'verbatim' to the nsc_gpio common-support
      module.  After the move, various symbols are renamed to update 'scx200_' to
      'nsc_', and headers are adjusted accordingly.
      Signed-off-by: default avatarJim Cromie <jim.cromie@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      1a66fdf0
    • Jim Cromie's avatar
      [PATCH] chardev: GPIO for SCx200 & PC-8736x: add empty common-module · 1ca5df0a
      Jim Cromie authored
      Add the nsc_gpio common-support module as an empty shell.  Next patch starts
      the migration of the common gpio support routines.
      Signed-off-by: default avatarJim Cromie <jim.cromie@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      1ca5df0a
    • Jim Cromie's avatar
      [PATCH] chardev: GPIO for SCx200 & PC-8736x: dispatch via vtable · c3dc8071
      Jim Cromie authored
      Now actually call the gpio operations thru the vtable.
      Signed-off-by: default avatarJim Cromie <jim.cromie@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      c3dc8071
    • Jim Cromie's avatar
      [PATCH] chardev: GPIO for SCx200 & PC-8736x: add gpio-ops vtable · fe3a168a
      Jim Cromie authored
      Abstract the gpio operations into a new nsc_gpio_ops vtable.
      Signed-off-by: default avatarJim Cromie <jim.cromie@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      fe3a168a
    • Jim Cromie's avatar
      [PATCH] chardev: GPIO for SCx200 & PC-8736x: refactor scx200_probe to better... · 9b170b8f
      Jim Cromie authored
      [PATCH] chardev: GPIO for SCx200 & PC-8736x: refactor scx200_probe to better segregate _gpio initialization
      
      Pull shadow-reg initialization into separate function now, rather than doing
      it 2x later (scx200, pc8736x).  When we revisit 2nd drvr below, it will be to
      reimplement an init function, rather than another refactor.
      Signed-off-by: default avatarJim Cromie <jim.cromie@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      9b170b8f
    • Jim Cromie's avatar
      [PATCH] chardev: GPIO for SCx200 & PC-8736x: add 'v' command to device-file · 9550a339
      Jim Cromie authored
      Add a new driver command: 'v' which calls gpio_dump() on the pin.  The output
      goes to the log, like all other INFO messages in the original driver.  Giving
      the user control over the feedback they 'need' is construed to be a
      user-friendly feature, and allows us (later) to dial down many INFO messages
      to DEBUG log-level.
      Signed-off-by: default avatarJim Cromie <jim.cromie@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      9550a339
    • Jim Cromie's avatar
      [PATCH] chardev: GPIO for SCx200 & PC-8736x: put gpio_dump on a diet · d424aa87
      Jim Cromie authored
      Shrink scx200_gpio_dump() to a single printk with ternary ops.  The function
      is still ifdef'd out, this is corrected in next patch, when it is actually
      used.
      
      The patch 'inadvertently' changed loglevel from DEBUG to INFO.  This is Good,
      because in next patch, its wired to a 'command' which the user can invoke when
      they want.  When they do so, its because they want INFO to support their
      developement effort, and we want to give it to them without compiling a DEBUG
      version of the driver.
      Signed-off-by: default avatarJim Cromie <jim.cromie@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      d424aa87
    • Jim Cromie's avatar
      [PATCH] chardev: GPIO for SCx200 & PC-8736x: device minor numbers are unsigned ints · 55b8c045
      Jim Cromie authored
      Per kernel headers, device minor numbers are unsigned ints.  Do the same in
      this driver.
      Signed-off-by: default avatarJim Cromie <jim.cromie@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      55b8c045
    • Jim Cromie's avatar
      [PATCH] chardev: GPIO for SCx200 & PC-8736x: add platforn_device for use w dev_dbg · 979b5ec3
      Jim Cromie authored
      Add a platform-device to scx200_gpio, and use its struct device dev member
      (ie: devp) in dev_dbg() once.
      
      There are 2 alternatives here (Im soliciting guidance/commentary):
      
      - use isa_device, if/when its added to the kernel.
      
      - alter scx200.c to EXPORT_GPL its private devp so that both scx200_gpio,
        and the (to be added) nsc_gpio module can use it.  Since the available devp
        is in 'grandparent', this seems like too much 'action at a distance'.
      Signed-off-by: default avatarJim Cromie <jim.cromie@gmail.com>
      Cc: Greg KH <greg@kroah.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      979b5ec3
    • Jim Cromie's avatar
      [PATCH] chardev: GPIO for SCx200 & PC-8736x: modernize driver init to 2.6 api · 7d7f2126
      Jim Cromie authored
      Adopt many modern 2.6 coding practices, ala LDD3, chapter 3.  Changes are
      limited to initialization calls from module init, ie: cdev_init, cdev_add,
      *_chrdev_region, mkdev.
      Signed-off-by: default avatarJim Cromie <jim.cromie@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      7d7f2126
    • Jim Cromie's avatar
      [PATCH] chardev: GPIO for SCx200 & PC-8736x: whitespace pre-clean · 62c83cde
      Jim Cromie authored
      GPIO SUPPORT FOR SCx200 & PC8736x
      
      The patch-set reworks the 2.4 vintage scx200_gpio driver for modern 2.6, and
      refactors GPIO support to reuse it in a new driver for the GPIO on PC-8736x
      chips.  Its handy for the Soekris.com net-4801, which has both chips.
      
      These patches have been seen recently on Kernel-Mentors, and then
      Kernel-Newbies ML, where Jesper Juhl kindly reviewed it.  His feedback has
      been incorporated.  Thanks Jesper !
      
      Its also gone to soekris-tech@soekris.com for possible testing by linux folks,
      I've gotten 1 promise so far.  Theyre mostly BSD folk over there, but we'll
      see..
      
      Device-file & Sysfs
      
      The driver preserves the existing device-file interface, including the
      write/cmd set, but adds v to 'view' the pin-settings & configs by inducing,
      via gpio_dump(), a dev_info() call.  Its a fairly crappy way to get status,
      but it sticks to the syslog approach, conservatively.
      
      Allowing users to voluntarily trigger logging is good, it gives them a
      familiar way to confirm their app's control & use of the pins, and I've thus
      reduced the pin-mode-updates from dev_info to dev_dbg.
      
      I've recently bolted on a proto sysfs interface for both new drivers.  Im not
      including those patches here; they (the patch + doc-pre-patch) are still quite
      raw (and unreviewed on KNML), and since they 'invent' a convention for GPIO, a
      proper vetting is needed.  Since this patchset is much bigger than my previous
      ones, Id like to keep things simpler, and address it 1st, before bolting on
      more stuff.
      
      The driver-split
      
      The Geode CPU and the PC-87366 Super-IO chip have GPIO units which share a
      common pin-architecture (same pin features, with same bits controlling), but
      with different addressing mechanics and port organizations.
      
      The vintage driver expresses the pin capabilities with pin-mode commands
      [OoPpTt],etc that change the pin configurations, and since the 2 chips share
      pin-arch, we can reuse the read(), write() commands, once the implementation
      is suitably adjusted.
      
      The patchset adds a vtable: struct nsc_gpio_ops, to abstract the existing gpio
      operations, then adjusts fileops.write() code to invoke operations via that
      vtable.  Driver specific open()s set private_data to the vtable so its
      available for use by write().
      
      The vtable gets the gpio_dump() too, since its user-friendly, and (could be
      construed as) part of the current device-file interface.  To support use of
      dev_dbg() in write() & _dump(), the vtable gets a dev ptr too, set by both
      scx200 & pc8736x _gpio drivers.
      
      heres how the pins are presented in syslog:
      
      [ 1890.176223]  scx200_gpio.0: io00: 0x0044 TS OD PUE  EDGE LO DEBOUNCE
      [ 1890.287223]  scx200_gpio.0: io01: 0x0003 OE PP PUD  EDGE LO
      
      nsc_gpio.c: new file is new home of several file-ops methods, which are
      modified to get their vtable from filp->private_data, and use it where needed.
      
      scx200_gpio.c: keeps some of its existing gpio routines, but now wires them up
      via the vtable (they're invoked by nsc_gpio.c:nsc_gpio_write() thru this
      vtable).  A driver-spcific open() initializes filp->private_data with the
      vtable.
      
      Once the split is clean, and the scx200_gpio driver is working, we copy and
      modify the function and variable names, and rework the access-method bodies
      for the different addressing scheme.
      
      Heres a working overview of the patchset:
      
      # series file for GPIO
      
      # Spring Cleaning
      gpio-scx/patch.preclean        # scripts/Lindent fixes, editor-ctrl comments
      
      # API Modernization
      
      gpio-scx/patch.api26        # what I learned from LDD3
      gpio-scx/patch.platform-dev-2    # get pdev, support for dev_dbg()
      gpio-scx/patch.unsigned-minor    # fix to match std practice
      
      # Debuggability
      
      gpio-scx/patch.dump-diet    # shrink gpio_dump()
      gpio-scx/patch.viewpins        # add new 'command' to call dump()
      gpio-scx/patch.init-refactor    # pull shadow-register init to sub
      
      # Access-Abstraction (add vtable)
      
      gpio-scx/patch.access-vtable    # introduce nsg_gpio_ops vtable, w dump
      gpio-scx/patch.vtable-calls    # add & use the vtable in scx200_gpio
      gpio-scx/patch.nscgpio-shell    # add empty driver for common-fops
      
      # move code under abstraction
      gpio-scx/patch.migrate-fops    # move file-ops methods from scx200_gpio
      gpio-scx/patch.common-dump    # mv scx200.c:scx200_gpio_dump() to nsc_gpio.c
      gpio-scx/patch.add-pc8736x-gpio    # add new driver, like old, w chip adapt
      # gpio-scx/patch.add-DEBUG    # enable all dev_dbg()s
      
      # Cleanups
      
      # finish printk -> dev_dbg() etc
      gpio-scx/patch.pdev-pc8736x    # new drvr needs pdev too,
      gpio-scx/patch.devdbg-nscgpio    # add device to 'vtable', use in dev_dbg()
      
      # gpio-scx/patch.pin-config-view    # another 'c' 'command'
      # gpio-scx/quiet-getset        # take out excess dbg stuff (pretty quiet
      now)
      gpio-scx/patch.shadow-current    # imitate scx200_gpio's shadow regs in
      pc87*
      
      # post KMentors-post patches ..
      
      gpio-scx/patch.mutexes        # use mutexes for config-locks
      gpio-scx/patch.viewpins-values    # extend dump to obsolete separate 'c' cmd
      
      gpio-scx/patch.kconfig        # add stuff for kbuild
      
      # TBC
      # combine api26 with pdev, which is just one step.
      # merge c&v commands to single do-all-fn
      # delay viewpins, dump-diet should also un-ifdef it too.
      
      diff.sys-gpio-rollup-1
      
      This patch:
      
      Removed editor format-control comments, and used scripts/Lindent to clean up
      whitespace, then deleted the bogus chunks :-(
      Signed-off-by: default avatarJim Cromie <jim.cromie@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      62c83cde
    • Chandra Seetharaman's avatar
      [PATCH] cpu hotplug: use hotplug version of cpu notifier in appropriate places · 5a67e4c5
      Chandra Seetharaman authored
      Make use the of newly defined hotplug version of cpu_notifier functionality
      wherever appropriate.
      Signed-off-by: default avatarChandra Seetharaman <sekharan@us.ibm.com>
      Cc: Ashok Raj <ashok.raj@intel.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      5a67e4c5
    • Chandra Seetharaman's avatar
      [PATCH] cpu hotplug: add hotplug versions of cpu_notifier · 39f4885c
      Chandra Seetharaman authored
      Define new macros register_hotcpu_notifier() and unregister_hotcpu_notifier()
      that redefines register_cpu_notifier() and unregister_cpu_notifier() for use
      only when HOTPLUG_CPU is defined.
      Signed-off-by: default avatarChandra Seetharaman <sekharan@us.ibm.com>
      Cc: Ashok Raj <ashok.raj@intel.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      39f4885c
    • Chandra Seetharaman's avatar
      [PATCH] cpu hotplug: make cpu_notifier related notifier calls __cpuinit only · 26c2143b
      Chandra Seetharaman authored
      Make notifier_calls associated with cpu_notifier as __cpuinit.
      
      __cpuinit makes sure that the function is init time only unless
      CONFIG_HOTPLUG_CPU is defined.
      
      [akpm@osdl.org: section fix]
      Signed-off-by: default avatarChandra Seetharaman <sekharan@us.ibm.com>
      Cc: Ashok Raj <ashok.raj@intel.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      26c2143b
    • Chandra Seetharaman's avatar
      [PATCH] cpu hotplug: make cpu_notifier related notifier blocks __cpuinit only · 74b85f37
      Chandra Seetharaman authored
      Make notifier_blocks associated with cpu_notifier as __cpuinitdata.
      
      __cpuinitdata makes sure that the data is init time only unless
      CONFIG_HOTPLUG_CPU is defined.
      Signed-off-by: default avatarChandra Seetharaman <sekharan@us.ibm.com>
      Cc: Ashok Raj <ashok.raj@intel.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      74b85f37
    • Chandra Seetharaman's avatar
      [PATCH] cpu hotplug: make [un]register_cpu_notifier init time only · 65edc68c
      Chandra Seetharaman authored
      CPUs come online only at init time (unless CONFIG_HOTPLUG_CPU is defined).
      So, cpu_notifier functionality need to be available only at init time.
      
      This patch makes register_cpu_notifier() available only at init time, unless
      CONFIG_HOTPLUG_CPU is defined.
      
      This patch exports register_cpu_notifier() and unregister_cpu_notifier() only
      if CONFIG_HOTPLUG_CPU is defined.
      Signed-off-by: default avatarChandra Seetharaman <sekharan@us.ibm.com>
      Cc: Ashok Raj <ashok.raj@intel.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      65edc68c
    • Chandra Seetharaman's avatar
      [PATCH] cpu hotplug: revert initdata patch submitted for 2.6.17 · 054cc8a2
      Chandra Seetharaman authored
      This patch reverts notifier_block changes made in 2.6.17
      Signed-off-by: default avatarChandra Seetharaman <sekharan@us.ibm.com>
      Cc: Ashok Raj <ashok.raj@intel.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      054cc8a2
    • Chandra Seetharaman's avatar
      [PATCH] cpu hotplug: revert init patch submitted for 2.6.17 · 9c7b216d
      Chandra Seetharaman authored
      In 2.6.17, there was a problem with cpu_notifiers and XFS.  I provided a
      band-aid solution to solve that problem.  In the process, i undid all the
      changes you both were making to ensure that these notifiers were available
      only at init time (unless CONFIG_HOTPLUG_CPU is defined).
      
      We deferred the real fix to 2.6.18.  Here is a set of patches that fixes the
      XFS problem cleanly and makes the cpu notifiers available only at init time
      (unless CONFIG_HOTPLUG_CPU is defined).
      
      If CONFIG_HOTPLUG_CPU is defined then cpu notifiers are available at run
      time.
      
      This patch reverts the notifier_call changes made in 2.6.17
      Signed-off-by: default avatarChandra Seetharaman <sekharan@us.ibm.com>
      Cc: Ashok Raj <ashok.raj@intel.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      9c7b216d
    • Sonny Rao's avatar
      [PATCH] rtc: fix idr locking · 6ac12dfe
      Sonny Rao authored
      We need to serialize access to the global rtc_idr even in this error path.
      Signed-off-by: default avatarSonny Rao <sonny@burdell.org>
      Acked-by: default avatarAlessandro Zummo <a.zummo@towertech.it>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      6ac12dfe
    • Alan Cox's avatar
      [PATCH] stallion clean up · b65b5b59
      Alan Cox authored
      There are two locking sets involved.  One locks the board mappings and the
      other is the tty open/close locking.  The low level code was clearly
      designed to be ported to OS's with spin locks already so pretty much comes
      out in the wash
      Signed-off-by: default avatarAlan Cox <alan@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      b65b5b59
    • akpm@osdl.org's avatar
      [PATCH] IPMI: use schedule in kthread · 33979734
      akpm@osdl.org authored
      Corey Minyard <minyard@acm.org>
      
      The kthread used to speed up polling for IPMI was using udelay in its
      busy-wait polling loop when the lower-level state machine told it to do a
      short delay.  This just used CPU and didn't help scheduling, thus causing
      bad problems with other tasks.  Call schedule() instead.
      Signed-off-by: default avatarCorey Minyard <minyard@acm.org>
      Acked-by: default avatarMatt Domsch <Matt_Domsch@dell.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      33979734
    • Paul E. McKenney's avatar
      [PATCH] rcutorture: add call_rcu_bh() operations · c32e0660
      Paul E. McKenney authored
      Add operations for the call_rcu_bh() variant of RCU.  Also add an
      rcu_batches_completed_bh() function, which is needed by rcutorture.
      Signed-off-by: default avatarPaul E. McKenney <paulmck@us.ibm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      c32e0660
    • Paul E. McKenney's avatar
      [PATCH] rcutorture: add ops vector and Classic RCU ops · 72e9bb54
      Paul E. McKenney authored
      Add an ops vector to rcutorture, and add the ops for Classic RCU.  Update
      the rcutorture documentation to reflect slight change to the dmesg formats.
      Signed-off-by: default avatarPaul E. McKenney <paulmck@us.ibm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      72e9bb54
    • Paul E. McKenney's avatar
      [PATCH] rcutorture: catchup doc fixes for idle-hz tests · 29766f1e
      Paul E. McKenney authored
      This just catches the RCU torture documentation up with the recent fixes
      that test RCU for architectures that turn of the scheduling-clock interrupt
      for idle CPUs and the addition of a SUCCESS/FAILURE indication, fixing up
      an obsolete comment as well.
      Signed-off-by: default avatarPaul E. McKenney <paulmck@us.ibm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      29766f1e