pandora-kernel.git
13 years agoamd64_edac: Allocate driver instances dynamically
Borislav Petkov [Wed, 13 Oct 2010 14:11:59 +0000 (16:11 +0200)]
amd64_edac: Allocate driver instances dynamically

Remove static allocation in favor of dynamically allocating space for as
many driver instances as northbridges present on the system.

There should be no functional change resulting from this patch.

Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
13 years agoamd64_edac: Rework printk macros
Borislav Petkov [Thu, 7 Oct 2010 16:29:15 +0000 (18:29 +0200)]
amd64_edac: Rework printk macros

Add a macro per printk level, shorten up error messages. Add relevant
information to KERN_INFO level. No functional change.

Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
13 years agoamd64_edac: Rename CPU PCI devices
Borislav Petkov [Fri, 1 Oct 2010 18:11:07 +0000 (20:11 +0200)]
amd64_edac: Rename CPU PCI devices

Rename variables representing PCI devices to their BKDG names for faster
search and shorter, clearer code.

Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
13 years agoamd64_edac: Concentrate per-family init even more
Borislav Petkov [Fri, 1 Oct 2010 17:35:38 +0000 (19:35 +0200)]
amd64_edac: Concentrate per-family init even more

Move the remaining per-family init code into the proper place and
simplify the rest of the initialization. Reorganize error handling in
amd64_init_one_instance().

Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
13 years agoamd64_edac: Cleanup the CPU PCI device reservation
Borislav Petkov [Fri, 1 Oct 2010 17:27:58 +0000 (19:27 +0200)]
amd64_edac: Cleanup the CPU PCI device reservation

Shorten code and clarify comments, return proper -E* values on error.

Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
13 years agoamd64_edac: Simplify CPU family detection
Borislav Petkov [Fri, 1 Oct 2010 17:20:05 +0000 (19:20 +0200)]
amd64_edac: Simplify CPU family detection

Concentrate CPU family detection in the per-family init function.

Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
13 years agoamd64_edac: Add per-family init function
Borislav Petkov [Fri, 1 Oct 2010 16:38:19 +0000 (18:38 +0200)]
amd64_edac: Add per-family init function

Run a per-family init function which does all the settings based on
the family this driver instance is running on. Move the scrubrate
calculation in it and simplify code.

Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
13 years agoamd64_edac: Use cached extended CPU model
Borislav Petkov [Fri, 1 Oct 2010 17:44:53 +0000 (19:44 +0200)]
amd64_edac: Use cached extended CPU model

... instead of computing it needlessly again.

Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
13 years agoamd64_edac: Remove F11h support
Borislav Petkov [Fri, 1 Oct 2010 16:19:06 +0000 (18:19 +0200)]
amd64_edac: Remove F11h support

F11h doesn't support DRAM ECC so whack it away.

Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
13 years agofs: scale mntget/mntput
Nick Piggin [Fri, 7 Jan 2011 06:50:11 +0000 (17:50 +1100)]
fs: scale mntget/mntput

The problem that this patch aims to fix is vfsmount refcounting scalability.
We need to take a reference on the vfsmount for every successful path lookup,
which often go to the same mount point.

The fundamental difficulty is that a "simple" reference count can never be made
scalable, because any time a reference is dropped, we must check whether that
was the last reference. To do that requires communication with all other CPUs
that may have taken a reference count.

We can make refcounts more scalable in a couple of ways, involving keeping
distributed counters, and checking for the global-zero condition less
frequently.

- check the global sum once every interval (this will delay zero detection
  for some interval, so it's probably a showstopper for vfsmounts).

- keep a local count and only taking the global sum when local reaches 0 (this
  is difficult for vfsmounts, because we can't hold preempt off for the life of
  a reference, so a counter would need to be per-thread or tied strongly to a
  particular CPU which requires more locking).

- keep a local difference of increments and decrements, which allows us to sum
  the total difference and hence find the refcount when summing all CPUs. Then,
  keep a single integer "long" refcount for slow and long lasting references,
  and only take the global sum of local counters when the long refcount is 0.

This last scheme is what I implemented here. Attached mounts and process root
and working directory references are "long" references, and everything else is
a short reference.

This allows scalable vfsmount references during path walking over mounted
subtrees and unattached (lazy umounted) mounts with processes still running
in them.

This results in one fewer atomic op in the fastpath: mntget is now just a
per-CPU inc, rather than an atomic inc; and mntput just requires a spinlock
and non-atomic decrement in the common case. However code is otherwise bigger
and heavier, so single threaded performance is basically a wash.

Signed-off-by: Nick Piggin <npiggin@kernel.dk>
13 years agofs: rename vfsmount counter helpers
Nick Piggin [Fri, 7 Jan 2011 06:50:10 +0000 (17:50 +1100)]
fs: rename vfsmount counter helpers

Suggested by Andreas, mnt_ prefix is clearer namespace, follows kernel
conventions better, and is easier for tab complete. I introduced these
names so I'll admit they were not good choices.

Signed-off-by: Nick Piggin <npiggin@kernel.dk>
13 years agofs: implement faster dentry memcmp
Nick Piggin [Fri, 7 Jan 2011 06:50:09 +0000 (17:50 +1100)]
fs: implement faster dentry memcmp

The standard memcmp function on a Westmere system shows up hot in
profiles in the `git diff` workload (both parallel and single threaded),
and it is likely due to the costs associated with trapping into
microcode, and little opportunity to improve memory access (dentry
name is not likely to take up more than a cacheline).

So replace it with an open-coded byte comparison. This increases code
size by 8 bytes in the critical __d_lookup_rcu function, but the
speedup is huge, averaging 10 runs of each:

git diff st   user   sys   elapsed  CPU
before        1.15   2.57  3.82      97.1
after         1.14   2.35  3.61      96.8

git diff mt   user   sys   elapsed  CPU
before        1.27   3.85  1.46     349
after         1.26   3.54  1.43     333

Elapsed time for single threaded git diff at 95.0% confidence:
        -0.21  +/- 0.01
        -5.45% +/- 0.24%

It's -0.66% +/- 0.06% elapsed time on my Opteron, so rep cmp costs on the
fam10h seem to be relatively smaller, but there is still a win.

Signed-off-by: Nick Piggin <npiggin@kernel.dk>
13 years agofs: prefetch inode data in dcache lookup
Nick Piggin [Fri, 7 Jan 2011 06:50:08 +0000 (17:50 +1100)]
fs: prefetch inode data in dcache lookup

This makes single threaded git diff -1.25% +/- 0.05% elapsed time on my
2s12c24t Westmere system, and -0.86% +/- 0.05% on my 2s8c Barcelona, by
prefetching the important first cacheline of the inode in while we do the
actual name compare and other operations on the dentry.

There was no measurable slowdown in the single file stat case, or the creat
case (where negative dentries would be common).

Signed-off-by: Nick Piggin <npiggin@kernel.dk>
13 years agofs: improve scalability of pseudo filesystems
Nick Piggin [Fri, 7 Jan 2011 06:50:07 +0000 (17:50 +1100)]
fs: improve scalability of pseudo filesystems

Regardless of how much we possibly try to scale dcache, there is likely
always going to be some fundamental contention when adding or removing children
under the same parent. Pseudo filesystems do not seem need to have connected
dentries because by definition they are disconnected.

Signed-off-by: Nick Piggin <npiggin@kernel.dk>
13 years agofs: dcache per-inode inode alias locking
Nick Piggin [Fri, 7 Jan 2011 06:50:06 +0000 (17:50 +1100)]
fs: dcache per-inode inode alias locking

dcache_inode_lock can be replaced with per-inode locking. Use existing
inode->i_lock for this. This is slightly non-trivial because we sometimes
need to find the inode from the dentry, which requires d_inode to be
stabilised (either with refcount or d_lock).

Signed-off-by: Nick Piggin <npiggin@kernel.dk>
13 years agofs: dcache per-bucket dcache hash locking
Nick Piggin [Fri, 7 Jan 2011 06:50:05 +0000 (17:50 +1100)]
fs: dcache per-bucket dcache hash locking

We can turn the dcache hash locking from a global dcache_hash_lock into
per-bucket locking.

Signed-off-by: Nick Piggin <npiggin@kernel.dk>
13 years agobit_spinlock: add required includes
Nick Piggin [Fri, 7 Jan 2011 06:50:04 +0000 (17:50 +1100)]
bit_spinlock: add required includes

Signed-off-by: Nick Piggin <npiggin@kernel.dk>
13 years agokernel: add bl_list
Nick Piggin [Fri, 7 Jan 2011 06:50:03 +0000 (17:50 +1100)]
kernel: add bl_list

Introduce a type of hlist that can support the use of the lowest bit in the
hlist_head. This will be subsequently used to implement per-bucket bit spinlock
for inode and dentry hashes, and may be useful in other cases such as network
hashes.

Reviewed-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Nick Piggin <npiggin@kernel.dk>
13 years agoxfs: provide simple rcu-walk ACL implementation
Nick Piggin [Fri, 7 Jan 2011 06:50:02 +0000 (17:50 +1100)]
xfs: provide simple rcu-walk ACL implementation

This simple implementation just checks for no ACLs on the inode, and
if so, then the rcu-walk may proceed, otherwise fail it.

Signed-off-by: Nick Piggin <npiggin@kernel.dk>
13 years agobtrfs: provide simple rcu-walk ACL implementation
Nick Piggin [Fri, 7 Jan 2011 06:50:01 +0000 (17:50 +1100)]
btrfs: provide simple rcu-walk ACL implementation

This simple implementation just checks for no ACLs on the inode, and
if so, then the rcu-walk may proceed, otherwise fail it.

Signed-off-by: Nick Piggin <npiggin@kernel.dk>
13 years agoext2,3,4: provide simple rcu-walk ACL implementation
Nick Piggin [Fri, 7 Jan 2011 06:50:00 +0000 (17:50 +1100)]
ext2,3,4: provide simple rcu-walk ACL implementation

This simple implementation just checks for no ACLs on the inode, and
if so, then the rcu-walk may proceed, otherwise fail it.

Signed-off-by: Nick Piggin <npiggin@kernel.dk>
13 years agofs: provide simple rcu-walk generic_check_acl implementation
Nick Piggin [Fri, 7 Jan 2011 06:49:59 +0000 (17:49 +1100)]
fs: provide simple rcu-walk generic_check_acl implementation

This simple implementation just checks for no ACLs on the inode, and
if so, then the rcu-walk may proceed, otherwise fail it.

This could easily be extended to put acls under RCU and check them
under seqlock, if need be. But this implementation is enough to show
the rcu-walk aware permissions code for path lookups is working, and
will handle cases where there are no ACLs or ACLs in just the final
element.

This patch implicity converts tmpfs to rcu-aware permission check.
Subsequent patches onvert ext*, xfs, and, btrfs. Each of these uses
acl/permission code in a different way, so convert them all to provide
templates and proof of concept.

Signed-off-by: Nick Piggin <npiggin@kernel.dk>
13 years agofs: provide rcu-walk aware permission i_ops
Nick Piggin [Fri, 7 Jan 2011 06:49:58 +0000 (17:49 +1100)]
fs: provide rcu-walk aware permission i_ops

Signed-off-by: Nick Piggin <npiggin@kernel.dk>
13 years agofs: rcu-walk aware d_revalidate method
Nick Piggin [Fri, 7 Jan 2011 06:49:57 +0000 (17:49 +1100)]
fs: rcu-walk aware d_revalidate method

Require filesystems be aware of .d_revalidate being called in rcu-walk
mode (nd->flags & LOOKUP_RCU). For now do a simple push down, returning
-ECHILD from all implementations.

Signed-off-by: Nick Piggin <npiggin@kernel.dk>
13 years agofs: cache optimise dentry and inode for rcu-walk
Nick Piggin [Fri, 7 Jan 2011 06:49:56 +0000 (17:49 +1100)]
fs: cache optimise dentry and inode for rcu-walk

Put dentry and inode fields into top of data structure.  This allows RCU path
traversal to perform an RCU dentry lookup in a path walk by touching only the
first 56 bytes of the dentry.

We also fit in 8 bytes of inline name in the first 64 bytes, so for short
names, only 64 bytes needs to be touched to perform the lookup. We should
get rid of the hash->prev pointer from the first 64 bytes, and fit 16 bytes
of name in there, which will take care of 81% rather than 32% of the kernel
tree.

inode is also rearranged so that RCU lookup will only touch a single cacheline
in the inode, plus one in the i_ops structure.

This is important for directory component lookups in RCU path walking. In the
kernel source, directory names average is around 6 chars, so this works.

When we reach the last element of the lookup, we need to lock it and take its
refcount which requires another cacheline access.

Align dentry and inode operations structs, so members will be at predictable
offsets and we can group common operations into head of structure.

Signed-off-by: Nick Piggin <npiggin@kernel.dk>
13 years agofs: dcache reduce branches in lookup path
Nick Piggin [Fri, 7 Jan 2011 06:49:55 +0000 (17:49 +1100)]
fs: dcache reduce branches in lookup path

Reduce some branches and memory accesses in dcache lookup by adding dentry
flags to indicate common d_ops are set, rather than having to check them.
This saves a pointer memory access (dentry->d_op) in common path lookup
situations, and saves another pointer load and branch in cases where we
have d_op but not the particular operation.

Patched with:

git grep -E '[.>]([[:space:]])*d_op([[:space:]])*=' | xargs sed -e 's/\([^\t ]*\)->d_op = \(.*\);/d_set_d_op(\1, \2);/' -e 's/\([^\t ]*\)\.d_op = \(.*\);/d_set_d_op(\&\1, \2);/' -i

Signed-off-by: Nick Piggin <npiggin@kernel.dk>
13 years agofs: dcache remove d_mounted
Nick Piggin [Fri, 7 Jan 2011 06:49:54 +0000 (17:49 +1100)]
fs: dcache remove d_mounted

Rather than keep a d_mounted count in the dentry, set a dentry flag instead.
The flag can be cleared by checking the hash table to see if there are any
mounts left, which is not time critical because it is performed at detach time.

The mounted state of a dentry is only used to speculatively take a look in the
mount hash table if it is set -- before following the mount, vfsmount lock is
taken and mount re-checked without races.

This saves 4 bytes on 32-bit, nothing on 64-bit but it does provide a hole I
might use later (and some configs have larger than 32-bit spinlocks which might
make use of the hole).

Autofs4 conversion and changelog by Ian Kent <raven@themaw.net>:
In autofs4, when expring direct (or offset) mounts we need to ensure that we
block user path walks into the autofs mount, which is covered by another mount.
To do this we clear the mounted status so that follows stop before walking into
the mount and are essentially blocked until the expire is completed. The
automount daemon still finds the correct dentry for the umount due to the
follow mount logic in fs/autofs4/root.c:autofs4_follow_link(), which is set as
an inode operation for direct and offset mounts only and is called following
the lookup that stopped at the covered mount.

At the end of the expire the covering mount probably has gone away so the
mounted status need not be restored. But we need to check this and only restore
the mounted status if the expire failed.

XXX: autofs may not work right if we have other mounts go over the top of it?

Signed-off-by: Nick Piggin <npiggin@kernel.dk>
13 years agofs: fs_struct use seqlock
Nick Piggin [Fri, 7 Jan 2011 06:49:53 +0000 (17:49 +1100)]
fs: fs_struct use seqlock

Use a seqlock in the fs_struct to enable us to take an atomic copy of the
complete cwd and root paths. Use this in the RCU lookup path to avoid a
thread-shared spinlock in RCU lookup operations.

Multi-threaded apps may now perform path lookups with scalability matching
multi-process apps. Operations such as stat(2) become very scalable for
multi-threaded workload.

Signed-off-by: Nick Piggin <npiggin@kernel.dk>
13 years agofs: rcu-walk for path lookup
Nick Piggin [Fri, 7 Jan 2011 06:49:52 +0000 (17:49 +1100)]
fs: rcu-walk for path lookup

Perform common cases of path lookups without any stores or locking in the
ancestor dentry elements. This is called rcu-walk, as opposed to the current
algorithm which is a refcount based walk, or ref-walk.

This results in far fewer atomic operations on every path element,
significantly improving path lookup performance. It also avoids cacheline
bouncing on common dentries, significantly improving scalability.

The overall design is like this:
* LOOKUP_RCU is set in nd->flags, which distinguishes rcu-walk from ref-walk.
* Take the RCU lock for the entire path walk, starting with the acquiring
  of the starting path (eg. root/cwd/fd-path). So now dentry refcounts are
  not required for dentry persistence.
* synchronize_rcu is called when unregistering a filesystem, so we can
  access d_ops and i_ops during rcu-walk.
* Similarly take the vfsmount lock for the entire path walk. So now mnt
  refcounts are not required for persistence. Also we are free to perform mount
  lookups, and to assume dentry mount points and mount roots are stable up and
  down the path.
* Have a per-dentry seqlock to protect the dentry name, parent, and inode,
  so we can load this tuple atomically, and also check whether any of its
  members have changed.
* Dentry lookups (based on parent, candidate string tuple) recheck the parent
  sequence after the child is found in case anything changed in the parent
  during the path walk.
* inode is also RCU protected so we can load d_inode and use the inode for
  limited things.
* i_mode, i_uid, i_gid can be tested for exec permissions during path walk.
* i_op can be loaded.

When we reach the destination dentry, we lock it, recheck lookup sequence,
and increment its refcount and mountpoint refcount. RCU and vfsmount locks
are dropped. This is termed "dropping rcu-walk". If the dentry refcount does
not match, we can not drop rcu-walk gracefully at the current point in the
lokup, so instead return -ECHILD (for want of a better errno). This signals the
path walking code to re-do the entire lookup with a ref-walk.

Aside from the final dentry, there are other situations that may be encounted
where we cannot continue rcu-walk. In that case, we drop rcu-walk (ie. take
a reference on the last good dentry) and continue with a ref-walk. Again, if
we can drop rcu-walk gracefully, we return -ECHILD and do the whole lookup
using ref-walk. But it is very important that we can continue with ref-walk
for most cases, particularly to avoid the overhead of double lookups, and to
gain the scalability advantages on common path elements (like cwd and root).

The cases where rcu-walk cannot continue are:
* NULL dentry (ie. any uncached path element)
* parent with d_inode->i_op->permission or ACLs
* dentries with d_revalidate
* Following links

In future patches, permission checks and d_revalidate become rcu-walk aware. It
may be possible eventually to make following links rcu-walk aware.

Uncached path elements will always require dropping to ref-walk mode, at the
very least because i_mutex needs to be grabbed, and objects allocated.

Signed-off-by: Nick Piggin <npiggin@kernel.dk>
13 years agokernel: optimise seqlock
Nick Piggin [Fri, 7 Jan 2011 06:49:51 +0000 (17:49 +1100)]
kernel: optimise seqlock

Add branch annotations for seqlock read fastpath, and introduce
__read_seqcount_begin and __read_seqcount_end functions, that can avoid the
smp_rmb() if used carefully. These will be used by store-free path walking
algorithm performance is critical and seqlocks are in use.

Signed-off-by: Nick Piggin <npiggin@kernel.dk>
13 years agofs: avoid inode RCU freeing for pseudo fs
Nick Piggin [Fri, 7 Jan 2011 06:49:50 +0000 (17:49 +1100)]
fs: avoid inode RCU freeing for pseudo fs

Pseudo filesystems that don't put inode on RCU list or reachable by
rcu-walk dentries do not need to RCU free their inodes.

Signed-off-by: Nick Piggin <npiggin@kernel.dk>
13 years agofs: icache RCU free inodes
Nick Piggin [Fri, 7 Jan 2011 06:49:49 +0000 (17:49 +1100)]
fs: icache RCU free inodes

RCU free the struct inode. This will allow:

- Subsequent store-free path walking patch. The inode must be consulted for
  permissions when walking, so an RCU inode reference is a must.
- sb_inode_list_lock to be moved inside i_lock because sb list walkers who want
  to take i_lock no longer need to take sb_inode_list_lock to walk the list in
  the first place. This will simplify and optimize locking.
- Could remove some nested trylock loops in dcache code
- Could potentially simplify things a bit in VM land. Do not need to take the
  page lock to follow page->mapping.

The downsides of this is the performance cost of using RCU. In a simple
creat/unlink microbenchmark, performance drops by about 10% due to inability to
reuse cache-hot slab objects. As iterations increase and RCU freeing starts
kicking over, this increases to about 20%.

In cases where inode lifetimes are longer (ie. many inodes may be allocated
during the average life span of a single inode), a lot of this cache reuse is
not applicable, so the regression caused by this patch is smaller.

The cache-hot regression could largely be avoided by using SLAB_DESTROY_BY_RCU,
however this adds some complexity to list walking and store-free path walking,
so I prefer to implement this at a later date, if it is shown to be a win in
real situations. I haven't found a regression in any non-micro benchmark so I
doubt it will be a problem.

Signed-off-by: Nick Piggin <npiggin@kernel.dk>
13 years agofs: consolidate dentry kill sequence
Nick Piggin [Fri, 7 Jan 2011 06:49:48 +0000 (17:49 +1100)]
fs: consolidate dentry kill sequence

The tricky locking for disposing of a dentry is duplicated 3 times in the
dcache (dput, pruning a dentry from the LRU, and pruning its ancestors).
Consolidate them all into a single function dentry_kill.

Signed-off-by: Nick Piggin <npiggin@kernel.dk>
13 years agofs: use RCU in shrink_dentry_list to reduce lock nesting
Nick Piggin [Fri, 7 Jan 2011 06:49:47 +0000 (17:49 +1100)]
fs: use RCU in shrink_dentry_list to reduce lock nesting

Signed-off-by: Nick Piggin <npiggin@kernel.dk>
13 years agofs: reduce dcache_inode_lock width in lru scanning
Nick Piggin [Fri, 7 Jan 2011 06:49:46 +0000 (17:49 +1100)]
fs: reduce dcache_inode_lock width in lru scanning

Signed-off-by: Nick Piggin <npiggin@kernel.dk>
13 years agofs: dcache reduce prune_one_dentry locking
Nick Piggin [Fri, 7 Jan 2011 06:49:45 +0000 (17:49 +1100)]
fs: dcache reduce prune_one_dentry locking

prune_one_dentry can avoid quite a bit of locking in the common case where
ancestors have an elevated refcount. Alternatively, we could have gone the
other way and made fewer trylocks in the case where d_count goes to zero, but
is probably less common.

Signed-off-by: Nick Piggin <npiggin@kernel.dk>
13 years agofs: dcache reduce d_parent locking
Nick Piggin [Fri, 7 Jan 2011 06:49:44 +0000 (17:49 +1100)]
fs: dcache reduce d_parent locking

Use RCU to simplify locking in dget_parent.

Signed-off-by: Nick Piggin <npiggin@kernel.dk>
13 years agofs: dcache rationalise dget variants
Nick Piggin [Fri, 7 Jan 2011 06:49:43 +0000 (17:49 +1100)]
fs: dcache rationalise dget variants

dget_locked was a shortcut to avoid the lazy lru manipulation when we already
held dcache_lock (lru manipulation was relatively cheap at that point).
However, how that the lru lock is an innermost one, we never hold it at any
caller, so the lock cost can now be avoided. We already have well working lazy
dcache LRU, so it should be fine to defer LRU manipulations to scan time.

Signed-off-by: Nick Piggin <npiggin@kernel.dk>
13 years agofs: dcache reduce dcache_inode_lock
Nick Piggin [Fri, 7 Jan 2011 06:49:42 +0000 (17:49 +1100)]
fs: dcache reduce dcache_inode_lock

dcache_inode_lock can be avoided in d_delete() and d_materialise_unique()
in cases where it is not required.

Signed-off-by: Nick Piggin <npiggin@kernel.dk>
13 years agofs: dcache reduce locking in d_alloc
Nick Piggin [Fri, 7 Jan 2011 06:49:41 +0000 (17:49 +1100)]
fs: dcache reduce locking in d_alloc

Signed-off-by: Nick Piggin <npiggin@kernel.dk>
13 years agofs: dcache reduce dput locking
Nick Piggin [Fri, 7 Jan 2011 06:49:40 +0000 (17:49 +1100)]
fs: dcache reduce dput locking

It is possible to run dput without taking data structure locks up-front. In
many cases where we don't kill the dentry anyway, these locks are not required.

Signed-off-by: Nick Piggin <npiggin@kernel.dk>
13 years agofs: dcache avoid starvation in dcache multi-step operations
Nick Piggin [Fri, 7 Jan 2011 06:49:39 +0000 (17:49 +1100)]
fs: dcache avoid starvation in dcache multi-step operations

Long lived dcache "multi-step" operations which retry on rename seq can
be starved with a lot of rename activity. If they fail after the 1st pass,
take the rename_lock for writing to avoid further starvation.

Signed-off-by: Nick Piggin <npiggin@kernel.dk>
13 years agofs: dcache remove dcache_lock
Nick Piggin [Fri, 7 Jan 2011 06:49:38 +0000 (17:49 +1100)]
fs: dcache remove dcache_lock

dcache_lock no longer protects anything. remove it.

Signed-off-by: Nick Piggin <npiggin@kernel.dk>
13 years agofs: Use rename lock and RCU for multi-step operations
Nick Piggin [Fri, 7 Jan 2011 06:49:37 +0000 (17:49 +1100)]
fs: Use rename lock and RCU for multi-step operations

The remaining usages for dcache_lock is to allow atomic, multi-step read-side
operations over the directory tree by excluding modifications to the tree.
Also, to walk in the leaf->root direction in the tree where we don't have
a natural d_lock ordering.

This could be accomplished by taking every d_lock, but this would mean a
huge number of locks and actually gets very tricky.

Solve this instead by using the rename seqlock for multi-step read-side
operations, retry in case of a rename so we don't walk up the wrong parent.
Concurrent dentry insertions are not serialised against.  Concurrent deletes
are tricky when walking up the directory: our parent might have been deleted
when dropping locks so also need to check and retry for that.

We can also use the rename lock in cases where livelock is a worry (and it
is introduced in subsequent patch).

Signed-off-by: Nick Piggin <npiggin@kernel.dk>
13 years agofs: increase d_name lock coverage
Nick Piggin [Fri, 7 Jan 2011 06:49:36 +0000 (17:49 +1100)]
fs: increase d_name lock coverage

Cover d_name with d_lock in more cases, where there may be concurrent
modification to it.

Signed-off-by: Nick Piggin <npiggin@kernel.dk>
13 years agofs: scale inode alias list
Nick Piggin [Fri, 7 Jan 2011 06:49:35 +0000 (17:49 +1100)]
fs: scale inode alias list

Add a new lock, dcache_inode_lock, to protect the inode's i_dentry list
from concurrent modification. d_alias is also protected by d_lock.

Signed-off-by: Nick Piggin <npiggin@kernel.dk>
13 years agofs: dcache scale subdirs
Nick Piggin [Fri, 7 Jan 2011 06:49:34 +0000 (17:49 +1100)]
fs: dcache scale subdirs

Protect d_subdirs and d_child with d_lock, except in filesystems that aren't
using dcache_lock for these anyway (eg. using i_mutex).

Note: if we change the locking rule in future so that ->d_child protection is
provided only with ->d_parent->d_lock, it may allow us to reduce some locking.
But it would be an exception to an otherwise regular locking scheme, so we'd
have to see some good results. Probably not worthwhile.

Signed-off-by: Nick Piggin <npiggin@kernel.dk>
13 years agofs: dcache scale d_unhashed
Nick Piggin [Fri, 7 Jan 2011 06:49:33 +0000 (17:49 +1100)]
fs: dcache scale d_unhashed

Protect d_unhashed(dentry) condition with d_lock. This means keeping
DCACHE_UNHASHED bit in synch with hash manipulations.

Signed-off-by: Nick Piggin <npiggin@kernel.dk>
13 years agofs: dcache scale dentry refcount
Nick Piggin [Fri, 7 Jan 2011 06:49:32 +0000 (17:49 +1100)]
fs: dcache scale dentry refcount

Make d_count non-atomic and protect it with d_lock. This allows us to ensure a
0 refcount dentry remains 0 without dcache_lock. It is also fairly natural when
we start protecting many other dentry members with d_lock.

Signed-off-by: Nick Piggin <npiggin@kernel.dk>
13 years agofs: dcache scale lru
Nick Piggin [Fri, 7 Jan 2011 06:49:31 +0000 (17:49 +1100)]
fs: dcache scale lru

Add a new lock, dcache_lru_lock, to protect the dcache LRU list from concurrent
modification. d_lru is also protected by d_lock, which allows LRU lists to be
accessed without the lru lock, using RCU in future patches.

Signed-off-by: Nick Piggin <npiggin@kernel.dk>
13 years agofs: dcache scale hash
Nick Piggin [Fri, 7 Jan 2011 06:49:30 +0000 (17:49 +1100)]
fs: dcache scale hash

Add a new lock, dcache_hash_lock, to protect the dcache hash table from
concurrent modification. d_hash is also protected by d_lock.

Signed-off-by: Nick Piggin <npiggin@kernel.dk>
13 years agohostfs: simplify locking
Nick Piggin [Fri, 7 Jan 2011 06:49:29 +0000 (17:49 +1100)]
hostfs: simplify locking

Remove dcache_lock locking from hostfs filesystem, and move it into dcache
helpers. All that is required is a coherent path name. Protection from
concurrent modification of the namespace after path name generation is not
provided in current code, because dcache_lock is dropped before the path is
used.

Signed-off-by: Nick Piggin <npiggin@kernel.dk>
13 years agofs: change d_hash for rcu-walk
Nick Piggin [Fri, 7 Jan 2011 06:49:28 +0000 (17:49 +1100)]
fs: change d_hash for rcu-walk

Change d_hash so it may be called from lock-free RCU lookups. See similar
patch for d_compare for details.

For in-tree filesystems, this is just a mechanical change.

Signed-off-by: Nick Piggin <npiggin@kernel.dk>
13 years agofs: change d_compare for rcu-walk
Nick Piggin [Fri, 7 Jan 2011 06:49:27 +0000 (17:49 +1100)]
fs: change d_compare for rcu-walk

Change d_compare so it may be called from lock-free RCU lookups. This
does put significant restrictions on what may be done from the callback,
however there don't seem to have been any problems with in-tree fses.
If some strange use case pops up that _really_ cannot cope with the
rcu-walk rules, we can just add new rcu-unaware callbacks, which would
cause name lookup to drop out of rcu-walk mode.

For in-tree filesystems, this is just a mechanical change.

Signed-off-by: Nick Piggin <npiggin@kernel.dk>
13 years agofs: name case update method
Nick Piggin [Fri, 7 Jan 2011 06:49:26 +0000 (17:49 +1100)]
fs: name case update method

smpfs and ncpfs want to update a live dentry name in-place. Rather than
have them open code the locking, provide a documented dcache API.

Signed-off-by: Nick Piggin <npiggin@kernel.dk>
13 years agojfs: dont overwrite dentry name in d_revalidate
Nick Piggin [Fri, 7 Jan 2011 06:49:25 +0000 (17:49 +1100)]
jfs: dont overwrite dentry name in d_revalidate

Use vfat's method for dealing with negative dentries to preserve case,
rather than overwrite dentry name in d_revalidate, which is a bit ugly
and also gets in the way of doing lock-free path walking.

Signed-off-by: Nick Piggin <npiggin@kernel.dk>
13 years agocifs: dont overwrite dentry name in d_revalidate
Nick Piggin [Fri, 7 Jan 2011 06:49:24 +0000 (17:49 +1100)]
cifs: dont overwrite dentry name in d_revalidate

Use vfat's method for dealing with negative dentries to preserve case,
rather than overwrite dentry name in d_revalidate, which is a bit ugly
and also gets in the way of doing lock-free path walking.

Signed-off-by: Nick Piggin <npiggin@kernel.dk>
13 years agofs: change d_delete semantics
Nick Piggin [Fri, 7 Jan 2011 06:49:23 +0000 (17:49 +1100)]
fs: change d_delete semantics

Change d_delete from a dentry deletion notification to a dentry caching
advise, more like ->drop_inode. Require it to be constant and idempotent,
and not take d_lock. This is how all existing filesystems use the callback
anyway.

This makes fine grained dentry locking of dput and dentry lru scanning
much simpler.

Signed-off-by: Nick Piggin <npiggin@kernel.dk>
13 years agofs: dcache documentation cleanup
Nick Piggin [Fri, 7 Jan 2011 06:49:22 +0000 (17:49 +1100)]
fs: dcache documentation cleanup

Remove redundant (and incorrect, since dcache RCU lookup) dentry locking
documentation and point to the canonical document.

Signed-off-by: Nick Piggin <npiggin@kernel.dk>
13 years agoconfig fs: avoid switching ->d_op on live dentry
Nick Piggin [Fri, 7 Jan 2011 06:49:21 +0000 (17:49 +1100)]
config fs: avoid switching ->d_op on live dentry

Switching d_op on a live dentry is racy in general, so avoid it. In this case
it is a negative dentry, which is safer, but there are still concurrent ops
which may be called on d_op in that case (eg. d_revalidate). So in general
a filesystem may not do this. Fix configfs so as not to do this.

Signed-off-by: Nick Piggin <npiggin@kernel.dk>
13 years agocgroup fs: avoid switching ->d_op on live dentry
Nick Piggin [Fri, 7 Jan 2011 06:49:20 +0000 (17:49 +1100)]
cgroup fs: avoid switching ->d_op on live dentry

Switching d_op on a live dentry is racy in general, so avoid it. In this case
it is a negative dentry, which is safer, but there are still concurrent ops
which may be called on d_op in that case (eg. d_revalidate). So in general
a filesystem may not do this. Fix cgroupfs so as not to do this.

Signed-off-by: Nick Piggin <npiggin@kernel.dk>
13 years agofs: use fast counters for vfs caches
Nick Piggin [Fri, 7 Jan 2011 06:49:19 +0000 (17:49 +1100)]
fs: use fast counters for vfs caches

percpu_counter library generates quite nasty code, so unless you need
to dynamically allocate counters or take fast approximate value, a
simple per cpu set of counters is much better.

The percpu_counter can never be made to work as well, because it has an
indirection from pointer to percpu memory, and it can't use direct
this_cpu_inc interfaces because it doesn't use static PER_CPU data, so
code will always be worse.

In the fastpath, it is the difference between this:

        incl %gs:nr_dentry      # nr_dentry

and this:

        movl    percpu_counter_batch(%rip), %edx        # percpu_counter_batch,
        movl    $1, %esi        #,
        movq    $nr_dentry, %rdi        #,
        call    __percpu_counter_add    # (plus I clobber registers)

__percpu_counter_add:
        pushq   %rbp    #
        movq    %rsp, %rbp      #,
        subq    $32, %rsp       #,
        movq    %rbx, -24(%rbp) #,
        movq    %r12, -16(%rbp) #,
        movq    %r13, -8(%rbp)  #,
        movq    %rdi, %rbx      # fbc, fbc
#APP
# 216 "/home/npiggin/usr/src/linux-2.6/arch/x86/include/asm/thread_info.h" 1
        movq %gs:kernel_stack,%rax      #, pfo_ret__
# 0 "" 2
#NO_APP
        incl    -8124(%rax)     # <variable>.preempt_count
        movq    32(%rdi), %r12  # <variable>.counters, tcp_ptr__
#APP
# 78 "lib/percpu_counter.c" 1
        add %gs:this_cpu_off, %r12      # this_cpu_off, tcp_ptr__
# 0 "" 2
#NO_APP
        movslq  (%r12),%r13     #* tcp_ptr__, tmp73
        movslq  %edx,%rax       # batch, batch
        addq    %rsi, %r13      # amount, count
        cmpq    %rax, %r13      # batch, count
        jge     .L27    #,
        negl    %edx    # tmp76
        movslq  %edx,%rdx       # tmp76, tmp77
        cmpq    %rdx, %r13      # tmp77, count
        jg      .L28    #,
.L27:
        movq    %rbx, %rdi      # fbc,
        call    _raw_spin_lock  #
        addq    %r13, 8(%rbx)   # count, <variable>.count
        movq    %rbx, %rdi      # fbc,
        movl    $0, (%r12)      #,* tcp_ptr__
        call    _raw_spin_unlock        #
.L29:
#APP
# 216 "/home/npiggin/usr/src/linux-2.6/arch/x86/include/asm/thread_info.h" 1
        movq %gs:kernel_stack,%rax      #, pfo_ret__
# 0 "" 2
#NO_APP
        decl    -8124(%rax)     # <variable>.preempt_count
        movq    -8136(%rax), %rax       #, D.14625
        testb   $8, %al #, D.14625
        jne     .L32    #,
.L31:
        movq    -24(%rbp), %rbx #,
        movq    -16(%rbp), %r12 #,
        movq    -8(%rbp), %r13  #,
        leave
        ret
        .p2align 4,,10
        .p2align 3
.L28:
        movl    %r13d, (%r12)   # count,*
        jmp     .L29    #
.L32:
        call    preempt_schedule        #
        .p2align 4,,6
        jmp     .L31    #
        .size   __percpu_counter_add, .-__percpu_counter_add
        .p2align 4,,15

Signed-off-by: Nick Piggin <npiggin@kernel.dk>
13 years agovfs: revert per-cpu nr_unused counters for dentry and inodes
Nick Piggin [Fri, 7 Jan 2011 06:49:18 +0000 (17:49 +1100)]
vfs: revert per-cpu nr_unused counters for dentry and inodes

The nr_unused counters count the number of objects on an LRU, and as such they
are synchronized with LRU object insertion and removal and scanning, and
protected under the LRU lock.

Making it per-cpu does not actually get any concurrency improvements because of
this lock, and summing the counter is much slower, and
incrementing/decrementing it costs more code size and is slower too.

These counters should stay per-LRU, which currently means global.

Signed-off-by: Nick Piggin <npiggin@kernel.dk>
13 years agokernel: kmem_ptr_validate considered harmful
Nick Piggin [Fri, 7 Jan 2011 06:49:17 +0000 (17:49 +1100)]
kernel: kmem_ptr_validate considered harmful

This is a nasty and error prone API. It is no longer used, remove it.

Signed-off-by: Nick Piggin <npiggin@kernel.dk>
13 years agofs: d_validate fixes
Nick Piggin [Fri, 7 Jan 2011 06:49:16 +0000 (17:49 +1100)]
fs: d_validate fixes

d_validate has been broken for a long time.

kmem_ptr_validate does not guarantee that a pointer can be dereferenced
if it can go away at any time. Even rcu_read_lock doesn't help, because
the pointer might be queued in RCU callbacks but not executed yet.

So the parent cannot be checked, nor the name hashed. The dentry pointer
can not be touched until it can be verified under lock. Hashing simply
cannot be used.

Instead, verify the parent/child relationship by traversing parent's
d_child list. It's slow, but only ncpfs and the destaged smbfs care
about it, at this point.

Signed-off-by: Nick Piggin <npiggin@kernel.dk>
13 years agoMerge branch 'next' into for-linus
Dmitry Torokhov [Fri, 7 Jan 2011 06:34:59 +0000 (22:34 -0800)]
Merge branch 'next' into for-linus

Conflicts:
include/linux/input.h

13 years agoMerge branch 'omap-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind...
Linus Torvalds [Fri, 7 Jan 2011 03:13:58 +0000 (19:13 -0800)]
Merge branch 'omap-for-linus' of git://git./linux/kernel/git/tmlind/linux-omap-2.6

* 'omap-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap-2.6: (243 commits)
  omap2: Make OMAP2PLUS select OMAP_DM_TIMER
  OMAP4: hwmod data: Fix alignment and end of line in structurefields
  OMAP4: hwmod data: Move the DMA structures
  OMAP4: hwmod data: Move the smartreflex structures
  OMAP4: hwmod data: Fix missing SIDLE_SMART_WKUP in smartreflexsysc
  arm: omap: tusb6010: add name for MUSB IRQ
  arm: omap: craneboard: Add USB EHCI support
  omap2+: Initialize serial port for dynamic remuxing for n8x0
  omap2+: Add struct omap_board_data and use it for platform level serial init
  omap2+: Allow hwmod state changes to mux pads based on the state changes
  omap2+: Add support for hwmod specific muxing of devices
  omap2+: Add omap_mux_get_by_name
  OMAP2: PM: fix compile error when !CONFIG_SUSPEND
  MAINTAINERS: OMAP: hwmod: update hwmod code, data maintainership
  OMAP4: Smartreflex framework extensions
  OMAP4: hwmod: Add inital data for smartreflex modules.
  OMAP4: PM: Program correct init voltages for scalable VDDs
  OMAP4: Adding voltage driver support
  OMAP4: Register voltage PMIC parameters with the voltage layer
  OMAP3: PM: Program correct init voltages for VDD1 and VDD2
  ...

Fix up trivial conflict in arch/arm/plat-omap/Kconfig

13 years agoARM: mach-shmobile: update for SMP changes.
Paul Mundt [Fri, 7 Jan 2011 03:03:22 +0000 (12:03 +0900)]
ARM: mach-shmobile: update for SMP changes.

There have likewise been some API updates, so we refactor to use the
consolidated smp_prepare_cpus().

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
13 years agoARM: mach-shmobile: update for GIC changes.
Paul Mundt [Fri, 7 Jan 2011 03:02:11 +0000 (12:02 +0900)]
ARM: mach-shmobile: update for GIC changes.

This fixes up the SMP support to use the refactored GIC APIs.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
13 years agoARM: mach-shmobile: Fix up clkdev fallout for SH73A0.
Paul Mundt [Fri, 7 Jan 2011 02:49:49 +0000 (11:49 +0900)]
ARM: mach-shmobile: Fix up clkdev fallout for SH73A0.

Use the new linux/clkdev.h to get it building again.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
13 years agoMerge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab...
Linus Torvalds [Fri, 7 Jan 2011 02:32:12 +0000 (18:32 -0800)]
Merge branch 'v4l_for_linus' of git://git./linux/kernel/git/mchehab/linux-2.6

* 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6: (255 commits)
  [media] radio-aimslab.c: Fix gcc 4.5+ bug
  [media] cx25821: Fix compilation breakage due to BKL dependency
  [media] v4l2-compat-ioctl32: fix compile warning
  [media] zoran: fix compiler warning
  [media] tda18218: fix compile warning
  [media] ngene: fix compile warning
  [media] DVB: IR support for TechnoTrend CT-3650
  [media] cx23885, cimax2.c: Fix case of two CAM insertion irq
  [media] ir-nec-decoder: fix repeat key issue
  [media] staging: se401 depends on USB
  [media] staging: usbvideo/vicam depends on USB
  [media] soc_camera: Add the ability to bind regulators to soc_camedra devices
  [media] V4L2: Add a v4l2-subdev (soc-camera) driver for OmniVision OV2640 sensor
  [media] v4l: soc-camera: switch to .unlocked_ioctl
  [media] v4l: ov772x: simplify pointer dereference
  [media] ov9640: fix OmniVision OV9640 sensor driver's priv data retrieving
  [media] ov9640: use macro to request OmniVision OV9640 sensor private data
  [media] ivtv-i2c: Fix two warnings
  [media] staging/lirc: Update lirc TODO files
  [media] cx88: Remove the obsolete i2c_adapter.id field
  ...

13 years agoMerge branch 'common/dma' into rmobile-latest
Paul Mundt [Fri, 7 Jan 2011 02:03:37 +0000 (11:03 +0900)]
Merge branch 'common/dma' into rmobile-latest

13 years agodma: shdma: don't register the global die notifier multiple times
Guennadi Liakhovetski [Thu, 6 Jan 2011 17:04:50 +0000 (17:04 +0000)]
dma: shdma: don't register the global die notifier multiple times

A recent patch has added a die notifier to the shdma driver, however,
it registers a static die-notifier object in the probe routine, i.e.,
for each device instance. This is wrong and leads to a system lockup.
This patch moves the die notifier registration to module init and
exit routines respectively.

Reported-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
13 years agoMerge branch 'rmobile/smp' into rmobile-latest
Paul Mundt [Fri, 7 Jan 2011 01:51:35 +0000 (10:51 +0900)]
Merge branch 'rmobile/smp' into rmobile-latest

Conflicts:
arch/arm/Kconfig
arch/arm/mach-shmobile/include/mach/entry-macro-intc.S

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
13 years agoARM: mach-shmobile: Rely on run-time IRQ handlers
Magnus Damm [Tue, 28 Dec 2010 08:27:19 +0000 (08:27 +0000)]
ARM: mach-shmobile: Rely on run-time IRQ handlers

Remove now unused IRQ demux code. All R-Mobile and
SH-Mobile processors should register IRQ demux
handlers during run-time.

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
13 years agoARM: mach-shmobile: Run-time IRQ handler for GIC
Magnus Damm [Tue, 28 Dec 2010 08:27:10 +0000 (08:27 +0000)]
ARM: mach-shmobile: Run-time IRQ handler for GIC

Break-out GIC specific IRQ demux code from the file
entry-macro-intc.S and register during run-time.

Covers sh73a0.

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
13 years agoARM: mach-shmobile: Run-time IRQ handler for INTCA
Magnus Damm [Tue, 28 Dec 2010 08:27:01 +0000 (08:27 +0000)]
ARM: mach-shmobile: Run-time IRQ handler for INTCA

Break-out INTC specific IRQ demux code from the file
entry-macro-intc.S and register during run-time.

Covers sh7367, sh7377 and sh7372.

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
13 years agoARM: mach-shmobile: Enable CONFIG_MULTI_IRQ_HANDLER
Magnus Damm [Tue, 28 Dec 2010 08:26:52 +0000 (08:26 +0000)]
ARM: mach-shmobile: Enable CONFIG_MULTI_IRQ_HANDLER

Always enable MULTI_IRQ_HANDLER on SH-Mobile.

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
13 years agoARM: mach-shmobile: Use shared GIC entry macros
Magnus Damm [Wed, 22 Dec 2010 12:17:09 +0000 (12:17 +0000)]
ARM: mach-shmobile: Use shared GIC entry macros

Use the GIC demux code in asm/hardware/entry-macro-gic.S
on the R-Mobile / SH-Mobile processors.

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
13 years agoARM: mach-shmobile: mackerel: Add zboot support
Simon Horman [Thu, 9 Dec 2010 00:47:15 +0000 (00:47 +0000)]
ARM: mach-shmobile: mackerel: Add zboot support

When CONFIG_ZBOOT_ROM is selected, the resulting zImage file will be small
boot loader and may be burned to rom or flash.

Cc: Magnus Damm <magnus.damm@gmail.com>
Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
13 years agoMerge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux...
Paul Mundt [Fri, 7 Jan 2011 01:29:26 +0000 (10:29 +0900)]
Merge branch 'master' of /linux/kernel/git/torvalds/linux-2.6 into rmobile-latest

Conflicts:
arch/arm/mach-shmobile/Kconfig

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
13 years agoMerge branch 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm
Linus Torvalds [Fri, 7 Jan 2011 00:50:35 +0000 (16:50 -0800)]
Merge branch 'devel' of /home/rmk/linux-2.6-arm

* 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm: (416 commits)
  ARM: DMA: add support for DMA debugging
  ARM: PL011: add DMA burst threshold support for ST variants
  ARM: PL011: Add support for transmit DMA
  ARM: PL011: Ensure IRQs are disabled in UART interrupt handler
  ARM: PL011: Separate hardware FIFO size from TTY FIFO size
  ARM: PL011: Allow better handling of vendor data
  ARM: PL011: Ensure error flags are clear at startup
  ARM: PL011: include revision number in boot-time port printk
  ARM: vexpress: add sched_clock() for Versatile Express
  ARM i.MX53: Make MX53 EVK bootable
  ARM i.MX53: Some bug fix about MX53 MSL code
  ARM: 6607/1: sa1100: Update platform device registration
  ARM: 6606/1: sa1100: Fix platform device registration
  ARM i.MX51: rename IPU irqs
  ARM i.MX51: Add ipu clock support
  ARM: imx/mx27_3ds: Add PMIC support
  ARM: DMA: Replace page_to_dma()/dma_to_page() with pfn_to_dma()/dma_to_pfn()
  mx51: fix usb clock support
  MX51: Add support for usb host 2
  arch/arm/plat-mxc/ehci.c: fix errors/typos
  ...

13 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-next-2.6
Linus Torvalds [Thu, 6 Jan 2011 23:30:54 +0000 (15:30 -0800)]
Merge git://git./linux/kernel/git/davem/sparc-next-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-next-2.6: (25 commits)
  atyfb: Fix bootup hangs on sparc64.
  sparc: update copyright in piggyback.c
  sparc: unify strip command in boot/Makefile
  sparc: rename piggyback_32 to piggyback
  sparc: fix tftpboot.img for sparc64 on little-endian host
  sparc: add $BITS to piggyback arguments
  sparc: remove obsolete ELF support in piggyback_32.c
  sparc: additional comments to piggyback_32.c
  sparc: use _start for the start entry (like 64 bit does)
  sparc: use trapbase in setup_arch
  sparc: refactor piggy_32.c
  Added support for ampopts in APBUART driver. Used in AMP systems.
  APBUART: added raw AMBA vendor/device number to match against.
  SPARC/LEON: avoid AMBAPP name duplicates in openprom fs when REG is missing
  SPARC/LEON: added support for selecting Timer Core and Timer within core
  LEON: added raw AMBA vendor/device number to find TIMER, IRQCTRL
  SPARC/LEON: added support for IRQAMP IRQ Controller
  SPARC/LEON: find IRQCTRL and Timer via OF-Tree, instead of hardcoded.
  sparc: fix sparse warnings in arch/sparc/prom for 32 bit build
  sparc: remove unused prom tree functions
  ...

13 years agoMerge branch 'devel-stable' into devel
Russell King [Thu, 6 Jan 2011 22:33:32 +0000 (22:33 +0000)]
Merge branch 'devel-stable' into devel

Conflicts:
arch/arm/mach-pxa/clock.c
arch/arm/mach-pxa/clock.h

13 years agoMerge branch 'pgt' (early part) into devel
Russell King [Thu, 6 Jan 2011 22:33:19 +0000 (22:33 +0000)]
Merge branch 'pgt' (early part) into devel

13 years agoMerge branch 'misc' into devel
Russell King [Thu, 6 Jan 2011 22:32:52 +0000 (22:32 +0000)]
Merge branch 'misc' into devel

Conflicts:
arch/arm/Kconfig
arch/arm/common/Makefile
arch/arm/kernel/Makefile
arch/arm/kernel/smp.c

13 years agoMerge branch 'smp' into misc
Russell King [Thu, 6 Jan 2011 22:31:35 +0000 (22:31 +0000)]
Merge branch 'smp' into misc

Conflicts:
arch/arm/kernel/entry-armv.S
arch/arm/mm/ioremap.c

13 years agoARM: DMA: add support for DMA debugging
Russell King [Mon, 3 Jan 2011 11:29:28 +0000 (11:29 +0000)]
ARM: DMA: add support for DMA debugging

Add ARM support for the DMA debug infrastructure, which allows the
DMA API usage to be debugged.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
13 years agoMerge branch 'for-linus' of git://codeaurora.org/quic/kernel/davidb/linux-msm
Linus Torvalds [Thu, 6 Jan 2011 21:36:30 +0000 (13:36 -0800)]
Merge branch 'for-linus' of git://codeaurora.org/quic/kernel/davidb/linux-msm

* 'for-linus' of git://codeaurora.org/quic/kernel/davidb/linux-msm: (35 commits)
  mmc: msm_sdcc: Check for only DATA_END interrupt to end a request
  mmc: msm_sdcc: Fix bug in PIO mode when data size is not word aligned
  mmc: msm_sdcc: Reset SDCC in case of data transfer errors
  mmc: msm_sdcc: Add prog done interrupt support
  mmc: msm_sdcc: Fix possible circular locking dependency warning
  MSM: Add USB support for MSM7x30
  MSM: Add USB suport for QSD8x50
  msm: initial framebuffer support
  msm: add handling for clocks tagged as CLK_MINMAX
  msm: trout: change name of pmdh_clk to mddi_clk
  msm: add CLK_MINMAX to pmdh_clk
  msm: trout: add gpio_to_irq
  msm: iommu: Use the correct memory allocation flag
  msm_serial: Remove redundant unlikely()
  msm: iommu: Miscellaneous code cleanup
  msm: iommu: Support cache-coherent memory access
  msm: iommu: Definitions for extended memory attributes
  msm: iommu: Kconfig dependency for the IOMMU API
  msm: iommu: Check if device is already attached
  msm: iommu: Kconfig item for cacheable page tables
  ...

13 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/lethal/fbdev-2.6
Linus Torvalds [Thu, 6 Jan 2011 21:35:12 +0000 (13:35 -0800)]
Merge git://git./linux/kernel/git/lethal/fbdev-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/lethal/fbdev-2.6: (55 commits)
  video: udlfb: Kill off special printk wrappers, use pr_fmt().
  video: udlfb: Kill off some magic constants for EDID sizing.
  video: udlfb: deifdefify (yes, that's a word).
  fbdev: modedb: Add a new mode for 864x480 TAAL panels.
  drivers/video/i810/i810-i2c.c: fix i2c bus handling
  video: Fix the HGA framebuffer driver
  drivers/video/carminefb.c: improve error handling
  video: imxfb: Fix the maximum value for yres
  fbdev: sh_mobile_lcdcfb: Enable 32 bpp and 24 bpp support
  fbdev: sh_mipi_dsi: use platform provided register layout and values
  ARM: mach-shmobile: specify sh7372 MIPI DSI register layout
  fbdev: sh_mipi_dsi: support different register layouts
  ARM: mach-shmobile: improve MIPI DSI clock configuration
  fbdev: sh-mobile: implement MIPI DSI runtime PM support
  sisfb: eliminate compiler warnings
  sisfb: delete unused register I/O macros
  sisfb: replace setSISIDXREG with SiS_SetRegANDOR
  sisfb: replace andSISIDXREG with SiS_SetRegAND
  sisfb: replace orSISIDXREG with SiS_SetRegOR
  sisfb: replace outSISIDXREG with SiS_SetReg
  ...

13 years agoMerge branch 'sh-latest' of git://git.kernel.org/pub/scm/linux/kernel/git/lethal...
Linus Torvalds [Thu, 6 Jan 2011 21:34:45 +0000 (13:34 -0800)]
Merge branch 'sh-latest' of git://git./linux/kernel/git/lethal/sh-2.6

* 'sh-latest' of git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6:
  sh: include Migo-R TS driver in Migo-R defconfig
  sh: correct definitions to access stack pointers
  sh: Tidy up SH-4A unaligned load support.
  dma: shdma: NMI support.
  sh: mach-sdk7786: Handle baseboard NMI source selection.
  sh: mach-rsk: Add polled GPIO buttons support for RSK+7203.
  sh: Break out cpuinfo_op procfs bits.
  sh: Enable optional gpiolib for all CPUs with pinmux tables.
  sh: migrate SH_CLK_MD to mode pin API.
  sh: machvec IO death.

13 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6
Linus Torvalds [Thu, 6 Jan 2011 20:30:19 +0000 (12:30 -0800)]
Merge git://git./linux/kernel/git/davem/net-next-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6: (1436 commits)
  cassini: Use local-mac-address prom property for Cassini MAC address
  net: remove the duplicate #ifdef __KERNEL__
  net: bridge: check the length of skb after nf_bridge_maybe_copy_header()
  netconsole: clarify stopping message
  netconsole: don't announce stopping if nothing happened
  cnic: Fix the type field in SPQ messages
  netfilter: fix export secctx error handling
  netfilter: fix the race when initializing nf_ct_expect_hash_rnd
  ipv4: IP defragmentation must be ECN aware
  net: r6040: Return proper error for r6040_init_one
  dcb: use after free in dcb_flushapp()
  dcb: unlock on error in dcbnl_ieee_get()
  net: ixp4xx_eth: Return proper error for eth_init_one
  include/linux/if_ether.h: Add #define ETH_P_LINK_CTL for HPNA and wlan local tunnel
  net: add POLLPRI to sock_def_readable()
  af_unix: Avoid socket->sk NULL OOPS in stream connect security hooks.
  net_sched: pfifo_head_drop problem
  mac80211: remove stray extern
  mac80211: implement off-channel TX using hw r-o-c offload
  mac80211: implement hardware offload for remain-on-channel
  ...

13 years agocassini: Use local-mac-address prom property for Cassini MAC address
Richard Mortimer [Thu, 6 Jan 2011 19:50:30 +0000 (11:50 -0800)]
cassini: Use local-mac-address prom property for Cassini MAC address

Fallback on the local-mac-address prom property if the Cassini device
does not have an address programmed in the VPD ROM. This uses the same
technique as implemented by the sungem driver.

The problem was reported by Frans van Berckel using Debian kernel 2.6.34-7
on Sun Fire V440. udev was assigning a new eth<n> device name on each reboot
because the cassini driver was using a random MAC address.

Fix tested on 2.6.34-7 and 2.6.37 Sun Fire V440. Compile tested against
2.6.36 davem/sparc-2.6.git

Reported-by: Frans van Berckel <fberckel@xs4all.nl>
Tested-by: Frans van Berckel <fberckel@xs4all.nl>
Reviewed-by: Julian Calaby <julian.calaby@gmail.com>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Richard Mortimer <richm@oldelvet.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agonet: remove the duplicate #ifdef __KERNEL__
Changli Gao [Thu, 6 Jan 2011 19:41:42 +0000 (11:41 -0800)]
net: remove the duplicate #ifdef __KERNEL__

Since we are already in #ifdef __KERNEL__, we don't need to check it
again.

Signed-off-by: Changli Gao <xiaosuo@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoatyfb: Fix bootup hangs on sparc64.
David S. Miller [Wed, 5 Jan 2011 21:08:06 +0000 (13:08 -0800)]
atyfb: Fix bootup hangs on sparc64.

After commit 25edd6946a1d74e5e77813c2324a0908c68bcf9e ("sparc64: Get
rid of indirect p1275 PROM call buffer.")  we can't pass virtual
addresses >4GB to PROM calls.

Largely this is never necessary in drivers because we have a copy of
the entire PROM device tree in the kernel and a set of of_*()
interfaces to access it.

Unfortunately there were some lingering prom calls in the atyfb
driver, in particular prom_finddevice() was being called with an
on-stack address which could be anywhere.

This code is actually probing for information we already have, the
PROM choosen console output device is stored in of_console_device so
all of this nasty code consolidates into a one-line comparison.

Next we have some prom_getintdefault() calls which are trivially
transformed into the equivalent of_getintprop_default().

Special thanks to Fabio, who figured out exactly where the bootup
was hanging.  That made this bug trivial to fix.

Reported-by: Fabio M. Di NItto <fabbione@fabbione.net>
Reported-by: Sam Ravnborg <sam@ravnborg.org>
Reported-by: Frans van Berckel <fberckel@xs4all.nl>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Fabio M. Di NItto <fabbione@fabbione.net>
13 years agonet: bridge: check the length of skb after nf_bridge_maybe_copy_header()
Changli Gao [Sat, 25 Dec 2010 03:41:30 +0000 (03:41 +0000)]
net: bridge: check the length of skb after nf_bridge_maybe_copy_header()

Since nf_bridge_maybe_copy_header() may change the length of skb,
we should check the length of skb after it to handle the ppoe skbs.

Signed-off-by: Changli Gao <xiaosuo@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agonetconsole: clarify stopping message
Ferenc Wagner [Thu, 6 Jan 2011 05:11:20 +0000 (05:11 +0000)]
netconsole: clarify stopping message

Signed-off-by: Ferenc Wagner <wferi@niif.hu>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agonetconsole: don't announce stopping if nothing happened
Ferenc Wagner [Thu, 6 Jan 2011 05:11:19 +0000 (05:11 +0000)]
netconsole: don't announce stopping if nothing happened

Signed-off-by: Ferenc Wagner <wferi@niif.hu>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agocnic: Fix the type field in SPQ messages
Michael Chan [Wed, 5 Jan 2011 15:14:13 +0000 (15:14 +0000)]
cnic: Fix the type field in SPQ messages

The new firmware interface requires each Slow Path Queue (SPQ) message's
type field to include the function number.  The existing code does not
do this consistently.  We fix this by OR'ing in the function number
into the type field centrally in cnic_submit_kwqe_16().

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agonetfilter: fix export secctx error handling
Pablo Neira Ayuso [Thu, 6 Jan 2011 19:25:00 +0000 (11:25 -0800)]
netfilter: fix export secctx error handling

In 1ae4de0cdf855305765592647025bde55e85e451, the secctx was exported
via the /proc/net/netfilter/nf_conntrack and ctnetlink interfaces
instead of the secmark.

That patch introduced the use of security_secid_to_secctx() which may
return a non-zero value on error.

In one of my setups, I have NF_CONNTRACK_SECMARK enabled but no
security modules. Thus, security_secid_to_secctx() returns a negative
value that results in the breakage of the /proc and `conntrack -L'
outputs. To fix this, we skip the inclusion of secctx if the
aforementioned function fails.

This patch also fixes the dynamic netlink message size calculation
if security_secid_to_secctx() returns an error, since its logic is
also wrong.

This problem exists in Linux kernel >= 2.6.37.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: David S. Miller <davem@davemloft.net>