1. 28 6月, 2006 40 次提交
    • S
      [PATCH] BUG() if setscheduler is called from interrupt context · 66e5393a
      Steven Rostedt 提交于
      Thomas Gleixner is adding the call to a rtmutex function in setscheduler.
      This call grabs a spin_lock that is not always protected by interrupts
      disabled.  So this means that setscheduler cant be called from interrupt
      context.
      
      To prevent this from happening in the future, this patch adds a
      BUG_ON(in_interrupt()) in that function.  (Thanks to akpm <aka.  Andrew
      Morton> for this suggestion).
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      66e5393a
    • O
      [PATCH] sched: uninline task_rq_lock() · 9fea80e4
      Oleg Nesterov 提交于
      Saves 543 bytes from sched.o (gcc 3.3.3).
      Signed-off-by: NOleg Nesterov <oleg@tv-sign.ru>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Nick Piggin <nickpiggin@yahoo.com.au>
      Cc: Con Kolivas <kernel@kolivas.org>
      Cc: Peter Williams <pwil3058@bigpond.net.au>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      9fea80e4
    • S
      [PATCH] sched: mc/smt power savings sched policy · 5c45bf27
      Siddha, Suresh B 提交于
      sysfs entries 'sched_mc_power_savings' and 'sched_smt_power_savings' in
      /sys/devices/system/cpu/ control the MC/SMT power savings policy for the
      scheduler.
      
      Based on the values (1-enable, 0-disable) for these controls, sched groups
      cpu power will be determined for different domains.  When power savings
      policy is enabled and under light load conditions, scheduler will minimize
      the physical packages/cpu cores carrying the load and thus conserving
      power(with a perf impact based on the workload characteristics...  see OLS
      2005 CMP kernel scheduler paper for more details..)
      Signed-off-by: NSuresh Siddha <suresh.b.siddha@intel.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Nick Piggin <nickpiggin@yahoo.com.au>
      Cc: Con Kolivas <kernel@kolivas.org>
      Cc: "Chen, Kenneth W" <kenneth.w.chen@intel.com>
      Cc: "David S. Miller" <davem@davemloft.net>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      5c45bf27
    • S
      [PATCH] sched_domai: Allocate sched_group structures dynamically · 36938169
      Srivatsa Vaddagiri 提交于
      As explained here:
      	http://marc.theaimsgroup.com/?l=linux-kernel&m=114327539012323&w=2
      
      there is a problem with sharing sched_group structures between two
      separate sched_group structures for different sched_domains.
      
      The patch has been tested and found to avoid the kernel lockup problem
      described in above URL.
      Signed-off-by: NSrivatsa Vaddagiri <vatsa@in.ibm.com>
      Cc: Nick Piggin <nickpiggin@yahoo.com.au>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: "Siddha, Suresh B" <suresh.b.siddha@intel.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      36938169
    • S
      [PATCH] sched_domai: Use kmalloc_node · 15f0b676
      Srivatsa Vaddagiri 提交于
      The sched group structures used to represent various nodes need to be
      allocated from respective nodes (as suggested here also:
      
      	http://uwsg.ucs.indiana.edu/hypermail/linux/kernel/0603.3/0051.html)
      Signed-off-by: NSrivatsa Vaddagiri <vatsa@in.ibm.com>
      Cc: Nick Piggin <nickpiggin@yahoo.com.au>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: "Siddha, Suresh B" <suresh.b.siddha@intel.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      15f0b676
    • S
      [PATCH] sched_domai: Don't use GFP_ATOMIC · d3a5aa98
      Srivatsa Vaddagiri 提交于
      Replace GFP_ATOMIC allocation for sched_group_nodes with GFP_KERNEL based
      allocation.
      
      Signed-off-by: Srivatsa Vaddagiri <vatsa@in.ibm.com
      Cc: Nick Piggin <nickpiggin@yahoo.com.au>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: "Siddha, Suresh B" <suresh.b.siddha@intel.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      d3a5aa98
    • S
      [PATCH] sched_domain: handle kmalloc failure · 51888ca2
      Srivatsa Vaddagiri 提交于
      Try to handle mem allocation failures in build_sched_domains by bailing out
      and cleaning up thus-far allocated memory.  The patch has a direct consequence
      that we disable load balancing completely (even at sibling level) upon *any*
      memory allocation failure.
      
      [Lee.Schermerhorn@hp.com: bugfix]
      Signed-off-by: NSrivatsa Vaddagir <vatsa@in.ibm.com>
      Cc: Nick Piggin <nickpiggin@yahoo.com.au>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: "Siddha, Suresh B" <suresh.b.siddha@intel.com>
      Signed-off-by: NLee Schermerhorn <lee.schermerhorn@hp.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      51888ca2
    • P
      [PATCH] sched: Avoid unnecessarily moving highest priority task move_tasks() · 615052dc
      Peter Williams 提交于
      Problem:
      
      To help distribute high priority tasks evenly across the available CPUs
      move_tasks() does not, under some circumstances, skip tasks whose load
      weight is bigger than the designated amount.  Because the highest priority
      task on the busiest queue may be on the expired array it may be moved as a
      result of this mechanism.  Apart from not being the most desirable way to
      redistribute the high priority tasks (we'd rather move the second highest
      priority task), there is a risk that this could set up a loop with this
      task bouncing backwards and forwards between the two queues.  (This latter
      possibility can be demonstrated by running a nice==-20 CPU bound task on an
      otherwise quiet 2 CPU system.)
      
      Solution:
      
      Modify the mechanism so that it does not override skip for the highest
      priority task on the CPU.  Of course, if there are more than one tasks at
      the highest priority then it will allow the override for one of them as
      this is a desirable redistribution of high priority tasks.
      Signed-off-by: NPeter Williams <pwil3058@bigpond.com.au>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: "Siddha, Suresh B" <suresh.b.siddha@intel.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      615052dc
    • P
      [PATCH] sched: modify move_tasks() to improve load balancing outcomes · 50ddd969
      Peter Williams 提交于
      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: NPeter 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: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      50ddd969
    • P
      [PATCH] sched: implement smpnice · 2dd73a4f
      Peter Williams 提交于
      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: NPeter 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: NIngo Molnar <mingo@elte.hu>
      Cc: Nick Piggin <nickpiggin@yahoo.com.au>
      Signed-off-by: NCon Kolivas <kernel@kolivas.org>
      Cc: John Hawkes <hawkes@sgi.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      2dd73a4f
    • K
      [PATCH] sched: CPU hotplug race vs. set_cpus_allowed() · efc30814
      Kirill Korotaev 提交于
      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: NKirill Korotaev <dev@openvz.org>
      Acked-By: NIngo Molnar <mingo@elte.hu>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      efc30814
    • S
      [PATCH] unnecessary long index i in sched · cc94abfc
      Steven Rostedt 提交于
      Unless we expect to have more than 2G CPUs, there's no reason to have 'i'
      as a long long here.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      cc94abfc
    • C
      [PATCH] sched: fix interactive ceiling code · 72d2854d
      Con Kolivas 提交于
      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: NCon Kolivas <kernel@kolivas.org>
      Signed-off-by: NMike Galbraith <efault@gmx.de>
      Acked-by: NIngo Molnar <mingo@elte.hu>
      Signed-off-by: NKen Chen <kenneth.w.chen@intel.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      72d2854d
    • S
      d444886e
    • C
      [PATCH] sched: fix smt nice lock contention and optimization · c96d145e
      Chen, Kenneth W 提交于
      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: NKen Chen <kenneth.w.chen@intel.com>
      Acked-by: NIngo Molnar <mingo@elte.hu>
      Acked-by: NCon Kolivas <kernel@kolivas.org>
      Signed-off-by: NNick Piggin <npiggin@suse.de>
      Acked-by: NChris Mason <mason@suse.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      c96d145e
    • J
      [PATCH] chardev: GPIO for SCx200 & PC-8736x: add proper Kconfig, Makefile entries · 7a8e2a5e
      Jim Cromie 提交于
      Replace the temp makefile hacks with proper CONFIG entries, which are also
      added to Kconfig.
      Signed-off-by: NJim Cromie <jim.cromie@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      7a8e2a5e
    • J
      [PATCH] chardev: GPIO for SCx200 & PC-8736x: display pin values in/out in gpio_dump · 23916a8e
      Jim Cromie 提交于
      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: NJim Cromie <jim.cromie@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      23916a8e
    • J
      [PATCH] gpio-patchset-fixups: include linux/io.h · ec312310
      Jim Cromie 提交于
      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: NJim Cromie <jim.cromie@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      ec312310
    • J
      [PATCH] chardev: GPIO for SCx200 & PC-8736x: replace spinlocks w mutexes · 8bcf6135
      Jim Cromie 提交于
      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: NJim Cromie <jim.cromie@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      8bcf6135
    • J
      [PATCH] chardev: GPIO for SCx200 & PC-8736x: fix gpio_current, use shadow regs · 6cad56fd
      Jim Cromie 提交于
      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: NJim Cromie <jim.cromie@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      6cad56fd
    • J
      [PATCH] chardev: GPIO for SCx200 & PC-8736x: use dev_dbg in common module · f31000e5
      Jim Cromie 提交于
      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: NJim Cromie <jim.cromie@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      f31000e5
    • J
      [PATCH] chardev: GPIO for SCx200 & PC-8736x: add platform_device for use w dev_dbg · 58b087cd
      Jim Cromie 提交于
      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: NJim Cromie <jim.cromie@gmail.com>
      Cc: Greg KH <greg@kroah.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      58b087cd
    • J
      [PATCH] chardev: GPIO for SCx200 & PC-8736x: add new pc8736x_gpio module · 681a3e7d
      Jim Cromie 提交于
      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: NJim Cromie <jim.cromie@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      681a3e7d
    • J
      [PATCH] chardev: GPIO for SCx200 & PC-8736x: migrate gpio_dump to common module · 0e41ef3c
      Jim Cromie 提交于
      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: NJim Cromie <jim.cromie@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      0e41ef3c
    • J
      [PATCH] chardev: GPIO for SCx200 & PC-8736x: migrate file-ops to common module · 1a66fdf0
      Jim Cromie 提交于
      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: NJim Cromie <jim.cromie@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      1a66fdf0
    • J
      [PATCH] chardev: GPIO for SCx200 & PC-8736x: add empty common-module · 1ca5df0a
      Jim Cromie 提交于
      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: NJim Cromie <jim.cromie@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      1ca5df0a
    • J
      [PATCH] chardev: GPIO for SCx200 & PC-8736x: dispatch via vtable · c3dc8071
      Jim Cromie 提交于
      Now actually call the gpio operations thru the vtable.
      Signed-off-by: NJim Cromie <jim.cromie@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      c3dc8071
    • J
      [PATCH] chardev: GPIO for SCx200 & PC-8736x: add gpio-ops vtable · fe3a168a
      Jim Cromie 提交于
      Abstract the gpio operations into a new nsc_gpio_ops vtable.
      Signed-off-by: NJim Cromie <jim.cromie@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      fe3a168a
    • J
      [PATCH] chardev: GPIO for SCx200 & PC-8736x: refactor scx200_probe to better... · 9b170b8f
      Jim Cromie 提交于
      [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: NJim Cromie <jim.cromie@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      9b170b8f
    • J
      [PATCH] chardev: GPIO for SCx200 & PC-8736x: add 'v' command to device-file · 9550a339
      Jim Cromie 提交于
      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: NJim Cromie <jim.cromie@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      9550a339
    • J
      [PATCH] chardev: GPIO for SCx200 & PC-8736x: put gpio_dump on a diet · d424aa87
      Jim Cromie 提交于
      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: NJim Cromie <jim.cromie@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      d424aa87
    • J
      [PATCH] chardev: GPIO for SCx200 & PC-8736x: device minor numbers are unsigned ints · 55b8c045
      Jim Cromie 提交于
      Per kernel headers, device minor numbers are unsigned ints.  Do the same in
      this driver.
      Signed-off-by: NJim Cromie <jim.cromie@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      55b8c045
    • J
      [PATCH] chardev: GPIO for SCx200 & PC-8736x: add platforn_device for use w dev_dbg · 979b5ec3
      Jim Cromie 提交于
      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: NJim Cromie <jim.cromie@gmail.com>
      Cc: Greg KH <greg@kroah.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      979b5ec3
    • J
      [PATCH] chardev: GPIO for SCx200 & PC-8736x: modernize driver init to 2.6 api · 7d7f2126
      Jim Cromie 提交于
      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: NJim Cromie <jim.cromie@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      7d7f2126
    • J
      [PATCH] chardev: GPIO for SCx200 & PC-8736x: whitespace pre-clean · 62c83cde
      Jim Cromie 提交于
      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: NJim Cromie <jim.cromie@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      62c83cde
    • C
      [PATCH] cpu hotplug: use hotplug version of cpu notifier in appropriate places · 5a67e4c5
      Chandra Seetharaman 提交于
      Make use the of newly defined hotplug version of cpu_notifier functionality
      wherever appropriate.
      Signed-off-by: NChandra Seetharaman <sekharan@us.ibm.com>
      Cc: Ashok Raj <ashok.raj@intel.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      5a67e4c5
    • C
      [PATCH] cpu hotplug: add hotplug versions of cpu_notifier · 39f4885c
      Chandra Seetharaman 提交于
      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: NChandra Seetharaman <sekharan@us.ibm.com>
      Cc: Ashok Raj <ashok.raj@intel.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      39f4885c
    • C
      [PATCH] cpu hotplug: make cpu_notifier related notifier calls __cpuinit only · 26c2143b
      Chandra Seetharaman 提交于
      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: NChandra Seetharaman <sekharan@us.ibm.com>
      Cc: Ashok Raj <ashok.raj@intel.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      26c2143b
    • C
      [PATCH] cpu hotplug: make cpu_notifier related notifier blocks __cpuinit only · 74b85f37
      Chandra Seetharaman 提交于
      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: NChandra Seetharaman <sekharan@us.ibm.com>
      Cc: Ashok Raj <ashok.raj@intel.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      74b85f37
    • C
      [PATCH] cpu hotplug: make [un]register_cpu_notifier init time only · 65edc68c
      Chandra Seetharaman 提交于
      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: NChandra Seetharaman <sekharan@us.ibm.com>
      Cc: Ashok Raj <ashok.raj@intel.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      65edc68c