safe/jmp/linux-2.6
14 years agomsi-wmi: switch to using input sparse keymap library
Anisse Astier [Thu, 10 Dec 2009 13:18:19 +0000 (14:18 +0100)]
msi-wmi: switch to using input sparse keymap library

Signed-off-by: Anisse Astier <anisse@astier.eu>
Signed-off-by: Len Brown <len.brown@intel.com>
14 years agomsi-wmi: replace one-condition switch-case with if statement
Anisse Astier [Thu, 10 Dec 2009 13:18:18 +0000 (14:18 +0100)]
msi-wmi: replace one-condition switch-case with if statement

Signed-off-by: Anisse Astier <anisse@astier.eu>
Signed-off-by: Len Brown <len.brown@intel.com>
14 years agomsi-wmi: remove unused field 'instance' in key_entry structure
Anisse Astier [Thu, 10 Dec 2009 13:18:17 +0000 (14:18 +0100)]
msi-wmi: remove unused field 'instance' in key_entry structure

Signed-off-by: Anisse Astier <anisse@astier.eu>
Signed-off-by: Len Brown <len.brown@intel.com>
14 years agomsi-wmi: remove custom runtime debug implementation
Anisse Astier [Thu, 10 Dec 2009 13:18:16 +0000 (14:18 +0100)]
msi-wmi: remove custom runtime debug implementation

Rely on DYNAMIC_DEBUG instead if needed

Signed-off-by: Anisse Astier <anisse@astier.eu>
Signed-off-by: Len Brown <len.brown@intel.com>
14 years agomsi-wmi: rework init
Anisse Astier [Thu, 10 Dec 2009 13:18:15 +0000 (14:18 +0100)]
msi-wmi: rework init

There should be less code duplication with usage of gotos
Driver won't load if there's no hardware to control
Safer error handling at input driver allocation

Signed-off-by: Anisse Astier <anisse@astier.eu>
Signed-off-by: Len Brown <len.brown@intel.com>
14 years agomsi-wmi: remove useless includes
Anisse Astier [Thu, 10 Dec 2009 13:18:14 +0000 (14:18 +0100)]
msi-wmi: remove useless includes

Signed-off-by: Anisse Astier <anisse@astier.eu>
Signed-off-by: Len Brown <len.brown@intel.com>
14 years agoX86 drivers: Introduce msi-wmi driver
Thomas Renninger [Thu, 10 Dec 2009 13:18:13 +0000 (14:18 +0100)]
X86 drivers: Introduce msi-wmi driver

This driver serves backlight (including switching) and volume up/down
keys for MSI machines providing a specific wmi interface:
551A1F84-FBDD-4125-91DB-3EA8F44F1D45
B6F3EEF2-3D2F-49DC-9DE3-85BCE18C62F2

Signed-off-by: Thomas Renninger <trenn@suse.de>
CC: Carlos Corbacho <carlos@strangeworlds.co.uk>
CC: Matthew Garrett <mjg59@srcf.ucam.org>
Tested-by: Matt Chen <machen@novell.com>
Reviewed-by: Anisse Astier <anisse@astier.eu>
Signed-off-by: Len Brown <len.brown@intel.com>
14 years agoperf record: Use per-task-per-cpu events for inherited events
Peter Zijlstra [Wed, 16 Dec 2009 16:55:56 +0000 (17:55 +0100)]
perf record: Use per-task-per-cpu events for inherited events

Create events with a pid and cpu contraint for inherited events
so that we get a stream per cpu, instead of all cpus contending
on a single stream.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: fweisbec@gmail.com
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <20091216165904.987643843@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
14 years agoperf record: Properly synchronize child creation
Peter Zijlstra [Wed, 16 Dec 2009 16:55:55 +0000 (17:55 +0100)]
perf record: Properly synchronize child creation

Remove that ugly usleep and provide proper serialization between
parent and child just like perf-stat does.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: fweisbec@gmail.com
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <20091216165904.908184135@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
14 years agoperf events: Allow per-task-per-cpu counters
Peter Zijlstra [Wed, 16 Dec 2009 16:55:54 +0000 (17:55 +0100)]
perf events: Allow per-task-per-cpu counters

In order to allow for per-task-per-cpu counters, useful for
scalability when profiling task hierarchies, we allow installing
events with event->cpu != -1 in task contexts.

__perf_event_sched_in() already skips events where ->cpu
mis-matches the current cpu, fix up __perf_install_in_context()
and __perf_event_enable() to also respect this filter.

This does lead to vary hard to interpret enabled/running times
for such counters, but I don't see a simple solution for that.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: fweisbec@gmail.com
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <20091216165904.831451147@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
14 years agoperf diff: Percent calcs should use double values
Arnaldo Carvalho de Melo [Wed, 16 Dec 2009 16:31:49 +0000 (14:31 -0200)]
perf diff: Percent calcs should use double values

Otherwise we do integer math and the delta values round up to
multiples of 1.0%.

Also, calculate absolute values. Things look precise now:

$ perf report -i perf.data.old --sort dso,symbol | head -13
     9.02%  libc-2.10.1.so               [.] _IO_vfprintf_internal
     4.88%  find                         [.] 0x00000000014af0
     2.91%  [kernel]                     [k] __kmalloc
     2.85%  [kernel]                     [k] ext4_htree_store_dirent
     2.50%  libc-2.10.1.so               [.] __GI_memmove
     2.44%  [kernel]                     [k] half_md4_transform
     2.43%  [kernel]                     [k] _spin_lock
     2.33%  [kernel]                     [k] system_call
$ perf report -i perf.data --sort dso,symbol | head -13
     8.55%  libc-2.10.1.so               [.] _IO_vfprintf_internal
     3.11%  [kernel]                     [k] __kmalloc
     3.07%  [kernel]                     [k] ext4_htree_store_dirent
     2.66%  find                         [.] 0x00000000016bcf
     2.61%  [kernel]                     [k] _atomic_dec_and_lock
     2.46%  [kernel]                     [k] half_md4_transform
     2.41%  libc-2.10.1.so               [.] __GI_memmove
     2.30%  find                         [.] 0x00000000009219
$ perf diff | head -13
     9.02%     -0.47%  libc-2.10.1.so               [.] _IO_vfprintf_internal
     2.91%     +0.20%  [kernel]                     [k] __kmalloc
     2.85%     +0.23%  [kernel]                     [k] ext4_htree_store_dirent
     1.99%     +0.62%  [kernel]                     [k] _atomic_dec_and_lock
     2.44%     +0.02%  [kernel]                     [k] half_md4_transform
     2.50%     -0.09%  libc-2.10.1.so               [.] __GI_memmove
     1.88%     +0.01%  [kernel]                     [k] __d_lookup
     2.43%     -0.75%  [kernel]                     [k] _spin_lock
     0.97%     +0.62%  [kernel]                     [k] path_get
     1.99%     -0.42%  libc-2.10.1.so               [.] _int_malloc
$

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <1260981109-2621-1-git-send-email-acme@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
14 years agodirect I/O fallback sync simplification
Christoph Hellwig [Wed, 23 Sep 2009 13:07:30 +0000 (15:07 +0200)]
direct I/O fallback sync simplification

In the case of direct I/O falling back to buffered I/O we sync data
twice currently: once at the end of generic_file_buffered_write using
filemap_write_and_wait_range and once a little later in
__generic_file_aio_write using do_sync_mapping_range with all flags set.

The wait before write of the do_sync_mapping_range call does not make
any sense, so just keep the filemap_write_and_wait_range call and move
it to the right spot.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoocfs: stop using do_sync_mapping_range
Christoph Hellwig [Wed, 23 Sep 2009 13:04:02 +0000 (15:04 +0200)]
ocfs: stop using do_sync_mapping_range

do_sync_mapping_range(..., SYNC_FILE_RANGE_WRITE) is a very awkward way
to perform a filemap_fdatawrite_range.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agocleanup blockdev_direct_IO locking
Christoph Hellwig [Tue, 3 Nov 2009 15:44:53 +0000 (16:44 +0100)]
cleanup blockdev_direct_IO locking

Currently the locking in blockdev_direct_IO is a mess, we have three different
locking types and very confusing checks for some of them.  The most
complicated one is DIO_OWN_LOCKING for reads, which happens to not actually be
used.

This patch gets rid of the DIO_OWN_LOCKING - as mentioned above the read case
is unused anyway, and the write side is almost identical to DIO_NO_LOCKING.
The difference is that DIO_NO_LOCKING always sets the create argument for
the get_blocks callback to zero, but we can easily move that to the actual
get_blocks callbacks.  There are four users of the DIO_NO_LOCKING mode:
gfs already ignores the create argument and thus is fine with the new
version, ocfs2 only errors out if create were ever set, and we can remove
this dead code now, the block device code only ever uses create for an
error message if we are fully beyond the device which can never happen,
and last but not least XFS will need the new behavour for writes.

Now we can replace the lock_type variable with a flags one, where no flag
means the DIO_NO_LOCKING behaviour and DIO_LOCKING is kept as the first
flag.  Separate out the check for not allowing to fill holes into a separate
flag, although for now both flags always get set at the same time.

Also revamp the documentation of the locking scheme to actually make sense.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agomake generic_acl slightly more generic
Christoph Hellwig [Tue, 3 Nov 2009 15:44:44 +0000 (16:44 +0100)]
make generic_acl slightly more generic

Now that we cache the ACL pointers in the generic inode all the generic_acl
cruft can go away and generic_acl.c can directly implement xattr handlers
dealing with the full Posix ACL semantics for in-memory filesystems.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agosanitize xattr handler prototypes
Christoph Hellwig [Fri, 13 Nov 2009 09:52:56 +0000 (09:52 +0000)]
sanitize xattr handler prototypes

Add a flags argument to struct xattr_handler and pass it to all xattr
handler methods.  This allows using the same methods for multiple
handlers, e.g. for the ACL methods which perform exactly the same action
for the access and default ACLs, just using a different underlying
attribute.  With a little more groundwork it'll also allow sharing the
methods for the regular user/trusted/secure handlers in extN, ocfs2 and
jffs2 like it's already done for xfs in this patch.

Also change the inode argument to the handlers to a dentry to allow
using the handlers mechnism for filesystems that require it later,
e.g. cifs.

[with GFS2 bits updated by Steven Whitehouse <swhiteho@redhat.com>]

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: James Morris <jmorris@namei.org>
Acked-by: Joel Becker <joel.becker@oracle.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agolibfs: move EXPORT_SYMBOL for d_alloc_name
H Hartley Sweeten [Wed, 30 Sep 2009 00:09:42 +0000 (20:09 -0400)]
libfs: move EXPORT_SYMBOL for d_alloc_name

The EXPORT_SYMBOL for d_alloc_name is in fs/libfs.c but the function
is in fs/dcache.c.  Move the EXPORT_SYMBOL to the line immediately
after the closing function brace line in fs/dcache.c as mentioned
in Documentation/CodingStyle.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agovfs: force reval of target when following LAST_BIND symlinks (try #7)
Jeff Layton [Mon, 7 Dec 2009 17:01:50 +0000 (12:01 -0500)]
vfs: force reval of target when following LAST_BIND symlinks (try #7)

procfs-style symlinks return a last_type of LAST_BIND without an actual
path string. This causes __follow_link to skip calling __vfs_follow_link
and so the dentry isn't revalidated.

This is a problem when the link target sits on NFSv4 as it depends on
the VFS to revalidate the dentry before using it on an open call. Ensure
that this occurs by forcing a revalidation of the target dentry of
LAST_BIND symlinks.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>
Acked-by: Miklos Szeredi <mszeredi@suse.cz>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoima: limit imbalance msg
Mimi Zohar [Fri, 4 Dec 2009 20:48:40 +0000 (15:48 -0500)]
ima: limit imbalance msg

Limit the number of imbalance messages to once per filesystem type instead of
once per system boot.  (it's actually slightly racy and could give you a
couple per fs, but this isn't a real issue)

Signed-off-by: Mimi Zohar <zohar@us.ibm.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoUntangling ima mess, part 3: kill dead code in ima
Al Viro [Wed, 16 Dec 2009 11:38:01 +0000 (06:38 -0500)]
Untangling ima mess, part 3: kill dead code in ima

Kill the 'update' argument of ima_path_check(), kill
dead code in ima.

Current rules: ima counters are bumped at the same time
when the file switches from put_filp() fodder to fput()
one.  Which happens exactly in two places - alloc_file()
and __dentry_open().  Nothing else needs to do that at
all.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoUntangling ima mess, part 2: deal with counters
Al Viro [Wed, 16 Dec 2009 11:27:40 +0000 (06:27 -0500)]
Untangling ima mess, part 2: deal with counters

* do ima_get_count() in __dentry_open()
* stop doing that in followups
* move ima_path_check() to right after nameidata_to_filp()
* don't bump counters on it

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoUntangling ima mess, part 1: alloc_file()
Al Viro [Wed, 16 Dec 2009 09:53:03 +0000 (04:53 -0500)]
Untangling ima mess, part 1: alloc_file()

There are 2 groups of alloc_file() callers:
* ones that are followed by ima_counts_get
* ones giving non-regular files
So let's pull that ima_counts_get() into alloc_file();
it's a no-op in case of non-regular files.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoO_TRUNC open shouldn't fail after file truncation
Al Viro [Wed, 16 Dec 2009 08:54:00 +0000 (03:54 -0500)]
O_TRUNC open shouldn't fail after file truncation

* take truncate logics into a helper (handle_truncate())
* rip it out of may_open()
* call it from the only caller of may_open() that might pass
O_TRUNC
* and do that after we'd finished with opening.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoima: call ima_inode_free ima_inode_free
Eric Paris [Fri, 4 Dec 2009 20:48:08 +0000 (15:48 -0500)]
ima: call ima_inode_free ima_inode_free

ima_inode_free() has some funky #define just to confuse the crap out of me.

void ima_iint_delete(struct inode *inode)

and then things actually call ima_inode_free() and nothing calls
ima_iint_delete().

Signed-off-by: Eric Paris <eparis@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoIMA: clean up the IMA counts updating code
Eric Paris [Fri, 4 Dec 2009 20:48:00 +0000 (15:48 -0500)]
IMA: clean up the IMA counts updating code

We currently have a lot of duplicated code around ima file counts.  Clean
that all up.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Serge Hallyn <serue@us.ibm.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoima: only insert at inode creation time
Eric Paris [Fri, 4 Dec 2009 20:47:52 +0000 (15:47 -0500)]
ima: only insert at inode creation time

iints are supposed to be allocated when an inode is allocated (during
security_inode_alloc())  But we have code which will attempt to allocate
an iint during measurement calls.  If we couldn't allocate the iint and we
cared, we should have died during security_inode_alloc().  Not make the
code more complex and less efficient.

Signed-off-by: Eric Paris <eparis@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoima: valid return code from ima_inode_alloc
Eric Paris [Fri, 4 Dec 2009 20:47:44 +0000 (15:47 -0500)]
ima: valid return code from ima_inode_alloc

ima_inode_alloc returns 0 and 1, but the LSM hooks expects an errno.

Signed-off-by: Eric Paris <eparis@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agofs: move get_empty_filp() deffinition to internal.h
Eric Paris [Fri, 4 Dec 2009 20:47:36 +0000 (15:47 -0500)]
fs: move get_empty_filp() deffinition to internal.h

All users outside of fs/ of get_empty_filp() have been removed.  This patch
moves the definition from the include/ directory to internal.h so no new
users crop up and removes the EXPORT_SYMBOL.  I'd love to see open intents
stop using it too, but that's a problem for another day and a smarter
developer!

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Miklos Szeredi <miklos@szeredi.hu>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoSanitize exec_permission_lite()
Al Viro [Wed, 16 Dec 2009 06:01:38 +0000 (01:01 -0500)]
Sanitize exec_permission_lite()

Use the sucker in other places in pathname resolution
that check MAY_EXEC for directories; lose the _lite
from name, it's equivalent of full-blown inode_permission()
for its callers (albeit still lighter, since large parts
of generic_permission() do not apply for pure MAY_EXEC).

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoKill cached_lookup() and real_lookup()
Al Viro [Thu, 13 Aug 2009 19:38:37 +0000 (23:38 +0400)]
Kill cached_lookup() and real_lookup()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoKill path_lookup_open()
Al Viro [Thu, 13 Aug 2009 16:40:45 +0000 (20:40 +0400)]
Kill path_lookup_open()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoTake hash recalculation into do_lookup()
Al Viro [Thu, 13 Aug 2009 14:27:43 +0000 (18:27 +0400)]
Take hash recalculation into do_lookup()

Both callers of do_lookup() do the same thing before it

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agofix mismerge with Trond's stuff (create_mnt_ns() export is gone now)
Al Viro [Sun, 9 Aug 2009 14:44:32 +0000 (18:44 +0400)]
fix mismerge with Trond's stuff (create_mnt_ns() export is gone now)

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoswitch cachefiles to kern_path()
Al Viro [Sat, 8 Aug 2009 22:03:00 +0000 (02:03 +0400)]
switch cachefiles to kern_path()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agofix the crap in dst/dcore
Al Viro [Sat, 8 Aug 2009 21:58:52 +0000 (01:58 +0400)]
fix the crap in dst/dcore

* don't reinvent the wheels, please - open_bdev_exclusive() is there
  for purpose
* both open_by_devnum() and open_bdev_exclusive() return ERR_PTR(...)
  upon error, not NULL

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agokill __link_path_walk()/link_path_walk() distinction
Al Viro [Sat, 8 Aug 2009 21:41:57 +0000 (01:41 +0400)]
kill __link_path_walk()/link_path_walk() distinction

put retry logics into path_walk() and do_filp_open()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agolift path_put(path) to callers of __do_follow_link()
Al Viro [Sat, 8 Aug 2009 21:32:02 +0000 (01:32 +0400)]
lift path_put(path) to callers of __do_follow_link()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoswitch create_read_pipe() to alloc_file()
Al Viro [Sat, 8 Aug 2009 21:01:37 +0000 (01:01 +0400)]
switch create_read_pipe() to alloc_file()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoswitch alloc_file() to passing struct path
Al Viro [Sat, 8 Aug 2009 20:52:35 +0000 (00:52 +0400)]
switch alloc_file() to passing struct path

... and have the caller grab both mnt and dentry; kill
leak in infiniband, while we are at it.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoswitch nilfs2 to deactivate_locked_super()
Al Viro [Sat, 8 Aug 2009 20:52:02 +0000 (00:52 +0400)]
switch nilfs2 to deactivate_locked_super()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoget rid of init_file()
Al Viro [Sat, 8 Aug 2009 19:56:29 +0000 (23:56 +0400)]
get rid of init_file()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoswitch sock_alloc_file() to alloc_file()
Al Viro [Thu, 6 Aug 2009 05:43:59 +0000 (09:43 +0400)]
switch sock_alloc_file() to alloc_file()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years ago9p connect fixes
Al Viro [Wed, 5 Aug 2009 22:02:43 +0000 (02:02 +0400)]
9p connect fixes

* if we fail in p9_conn_create(), we shouldn't leak references to struct file.
  Logics in ->close() doesn't help - ->trans is already gone by the time it's
  called.
* sock_create_kern() can fail.
* use of sock_map_fd() is all fscked up; I'd fixed most of that, but the
  rest will have to wait for a bit more work in net/socket.c (we still are
  violating the basic rule of working with descriptor table: "once the reference
  is installed there, don't rely on finding it there again").

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agomerge sock_alloc_fd/sock_attach_fd into a new helper
Al Viro [Wed, 5 Aug 2009 15:59:08 +0000 (19:59 +0400)]
merge sock_alloc_fd/sock_attach_fd into a new helper

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoreorder alloc_fd/attach_fd in socketpair()
Al Viro [Wed, 5 Aug 2009 15:29:23 +0000 (19:29 +0400)]
reorder alloc_fd/attach_fd in socketpair()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agounexport get_empty_filp()
Al Viro [Wed, 5 Aug 2009 14:44:31 +0000 (18:44 +0400)]
unexport get_empty_filp()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoswitched inotify_init1() to alloc_file()
Al Viro [Wed, 5 Aug 2009 14:35:21 +0000 (18:35 +0400)]
switched inotify_init1() to alloc_file()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoswitch shmem_file_setup() to alloc_file()
Al Viro [Wed, 5 Aug 2009 14:25:56 +0000 (18:25 +0400)]
switch shmem_file_setup() to alloc_file()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agosanitize do_pipe_flags() callers in arch
Al Viro [Wed, 16 Dec 2009 05:34:13 +0000 (00:34 -0500)]
sanitize do_pipe_flags() callers in arch

* hpux_pipe() - no need to take BKL
* sys32_pipe() in arch/x86/ia32 and xtensa_pipe() in arch/xtensa -
no need at all, since both functions are open-coded sys_pipe()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoperf diff: Change the default sort order to "dso,symbol"
Arnaldo Carvalho de Melo [Wed, 16 Dec 2009 16:09:53 +0000 (14:09 -0200)]
perf diff: Change the default sort order to "dso,symbol"

This is a more intuitive / more meaningful default:

$ perf diff | head -8
     9.02%     +1.00%  libc-2.10.1.so               [.] _IO_vfprintf_internal
     2.91%     -1.00%  [kernel]                     [k] __kmalloc
     2.85%     -1.00%  [kernel]                     [k] ext4_htree_store_dirent
     1.99%     -1.00%  [kernel]                     [k] _atomic_dec_and_lock
     2.44%             [kernel]
$

Suggested-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <1260979793-1981-1-git-send-email-acme@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
14 years agoToshiba Bluetooth Enabling driver (RFKill handler v3)
Jes Sorensen [Wed, 16 Dec 2009 17:08:15 +0000 (12:08 -0500)]
Toshiba Bluetooth Enabling driver (RFKill handler v3)

This patch adds support for the ACPI events generated by the RFKill
switch on modern Toshiba laptops, and re-enables the Bluetooth USB
device when the switch is flipped back to the 'on' position.

The RFKill switch brute force pulls out the USB device when flipped to
'off', but it doesn't automatically re-enable it. Without this driver,
the Bluetooth is gone until after a reboot on my Portege R500.

Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
Signed-off-by: Len Brown <len.brown@intel.com>
14 years agoedac, mce, amd: silence GART TLB errors
Borislav Petkov [Tue, 15 Dec 2009 15:03:53 +0000 (16:03 +0100)]
edac, mce, amd: silence GART TLB errors

Although reporting of benign GART TLB errors is disabled in
__mcheck_cpu_apply_quirks, those are still being logged, and, as a
result, trip up amd64_edac. Pull up reporting check so that machines
with loaded edac module bail out early and don't spit fragments into
dmesg.

Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
14 years agoperf diff: Use perf_session__fprintf_hists just like 'perf record'
Arnaldo Carvalho de Melo [Wed, 16 Dec 2009 15:49:27 +0000 (13:49 -0200)]
perf diff: Use perf_session__fprintf_hists just like 'perf record'

That means that almost everything you can do with 'perf report'
can be done with 'perf diff', for instance:

$ perf record -f find / > /dev/null
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.062 MB perf.data (~2699
samples) ] $ perf record -f find / > /dev/null
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.062 MB perf.data (~2687
samples) ] perf diff | head -8
     9.02%     +1.00%     find  libc-2.10.1.so               [.] _IO_vfprintf_internal
     2.91%     -1.00%     find  [kernel]                     [k] __kmalloc
     2.85%     -1.00%     find  [kernel]                     [k] ext4_htree_store_dirent
     1.99%     -1.00%     find  [kernel]                     [k] _atomic_dec_and_lock
     2.44%                find  [kernel]                     [k] half_md4_transform
$

So if you want to zoom into libc:

$ perf diff --dsos libc-2.10.1.so | head -8
    37.34%                find  [.] _IO_vfprintf_internal
    10.34%                find  [.] __GI_memmove
     8.25%     +2.00%     find  [.] _int_malloc
     5.07%     -1.00%     find  [.] __GI_mempcpy
     7.62%     +2.00%     find  [.] _int_free
$

And if there were multiple commands using libc, it is also
possible to aggregate them all by using --sort symbol:

$ perf diff --dsos libc-2.10.1.so --sort symbol | head -8
    37.34%             [.] _IO_vfprintf_internal
    10.34%             [.] __GI_memmove
     8.25%     +2.00%  [.] _int_malloc
     5.07%     -1.00%  [.] __GI_mempcpy
     7.62%     +2.00%  [.] _int_free
$

The displacement column now is off by default, to use it:

perf diff -m --dsos libc-2.10.1.so --sort symbol | head -8
    37.34%                   [.] _IO_vfprintf_internal
    10.34%                   [.] __GI_memmove
     8.25%     +2.00%        [.] _int_malloc
     5.07%     -1.00%    +2  [.] __GI_mempcpy
     7.62%     +2.00%    -1  [.] _int_free
$

Using -t/--field-separator can be used for scripting:

$ perf diff -t, -m --dsos libc-2.10.1.so --sort symbol | head -8
37.34, , ,[.] _IO_vfprintf_internal
10.34, , ,[.] __GI_memmove
8.25,+2.00%, ,[.] _int_malloc
5.07,-1.00%,  +2,[.] __GI_mempcpy
7.62,+2.00%,  -1,[.] _int_free
6.99,+1.00%,  -1,[.] _IO_new_file_xsputn
1.89,-2.00%,  +4,[.] __readdir64
$

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <1260978567-550-1-git-send-email-acme@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
14 years agoperf report: Fix cut'n'paste error recently introduced
Arnaldo Carvalho de Melo [Wed, 16 Dec 2009 14:27:11 +0000 (12:27 -0200)]
perf report: Fix cut'n'paste error recently introduced

Introduced in:

d599db3fc5dd4f1e8432fdbc6d899584b25f4dff
"perf report: Generalize perf_session__fprintf_hists()"

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <1260973631-28035-3-git-send-email-acme@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
14 years agoperf session: Move perf report specific hits out of perf_session__fprintf_hists
Arnaldo Carvalho de Melo [Wed, 16 Dec 2009 14:27:10 +0000 (12:27 -0200)]
perf session: Move perf report specific hits out of perf_session__fprintf_hists

Those don't make sense for tools such as 'perf diff'.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <1260973631-28035-2-git-send-email-acme@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
14 years agoperf tools: Move hist entries printing routines from perf report
Arnaldo Carvalho de Melo [Wed, 16 Dec 2009 14:27:09 +0000 (12:27 -0200)]
perf tools: Move hist entries printing routines from perf report

Will be used in other tools such as 'perf diff'.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <1260973631-28035-1-git-send-email-acme@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
14 years agogenalloc: use bitmap_find_next_zero_area
Akinobu Mita [Wed, 16 Dec 2009 00:48:31 +0000 (16:48 -0800)]
genalloc: use bitmap_find_next_zero_area

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agoia64: use bitmap_find_next_zero_area
Akinobu Mita [Wed, 16 Dec 2009 00:48:30 +0000 (16:48 -0800)]
ia64: use bitmap_find_next_zero_area

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agosparc: use bitmap_find_next_zero_area
Akinobu Mita [Wed, 16 Dec 2009 00:48:30 +0000 (16:48 -0800)]
sparc: use bitmap_find_next_zero_area

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Acked-by: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agomlx4: use bitmap_find_next_zero_area
Akinobu Mita [Wed, 16 Dec 2009 00:48:29 +0000 (16:48 -0800)]
mlx4: use bitmap_find_next_zero_area

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Reviewed-by: Roland Dreier <rolandd@cisco.com>
Cc: Yevgeny Petrilin <yevgenyp@mellanox.co.il>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agoisp1362-hcd: use bitmap_find_next_zero_area
Akinobu Mita [Wed, 16 Dec 2009 00:48:28 +0000 (16:48 -0800)]
isp1362-hcd: use bitmap_find_next_zero_area

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Cc: Lothar Wassmann <LW@KARO-electronics.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agoiommu-helper: use bitmap library
Akinobu Mita [Wed, 16 Dec 2009 00:48:28 +0000 (16:48 -0800)]
iommu-helper: use bitmap library

Use bitmap library and kill some unused iommu helper functions.

1. s/iommu_area_free/bitmap_clear/

2. s/iommu_area_reserve/bitmap_set/

3. Use bitmap_find_next_zero_area instead of find_next_zero_area

  This cannot be simple substitution because find_next_zero_area
  doesn't check the last bit of the limit in bitmap

4. Remove iommu_area_free, iommu_area_reserve, and find_next_zero_area

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agobitmap: introduce bitmap_set, bitmap_clear, bitmap_find_next_zero_area
Akinobu Mita [Wed, 16 Dec 2009 00:48:25 +0000 (16:48 -0800)]
bitmap: introduce bitmap_set, bitmap_clear, bitmap_find_next_zero_area

This introduces new bitmap functions:

bitmap_set: Set specified bit area
bitmap_clear: Clear specified bit area
bitmap_find_next_zero_area: Find free bit area

These are mostly stolen from iommu helper. The differences are:

- Use find_next_bit instead of doing test_bit for each bit

- Rewrite bitmap_set and bitmap_clear

  Instead of setting or clearing for each bit.

- Check the last bit of the limit

  iommu-helper doesn't want to find such area

- The return value if there is no zero area

  find_next_zero_area in iommu helper: returns -1
  bitmap_find_next_zero_area: return >= bitmap size

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Cc: Lothar Wassmann <LW@KARO-electronics.de>
Cc: Roland Dreier <rolandd@cisco.com>
Cc: Yevgeny Petrilin <yevgenyp@mellanox.co.il>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agoqnx4: use hweight8
Akinobu Mita [Wed, 16 Dec 2009 00:48:24 +0000 (16:48 -0800)]
qnx4: use hweight8

Use hweight8 instead of counting for each bit

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Acked-by: Anders Larsen <al@alarsen.net>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agoqnx4fs: remove remains of the (defunct) write support
Anders Larsen [Wed, 16 Dec 2009 00:48:23 +0000 (16:48 -0800)]
qnx4fs: remove remains of the (defunct) write support

commit 945ffe54bbd56ceed62de3b908800fd7c6ffb284 ("qnx4: remove write support") removed the (defunct)
write support but missed a chunk of related, dead code.

Signed-off-by: Anders Larsen <al@alarsen.net>
Cc: Jiri Kosina <jkosina@suse.cz>
Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agoresource: constify arg to resource_size() and resource_type()
Jean Delvare [Wed, 16 Dec 2009 00:48:21 +0000 (16:48 -0800)]
resource: constify arg to resource_size() and resource_type()

resource_size() doesn't change the resource it operates on, so the res
parameter can be marked const.  Same for resource_type().

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Reviewed-by: WANG Cong <xiyou.wangcong@gmail.com>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agogru: send cross partition interrupts using the gru
Jack Steiner [Wed, 16 Dec 2009 00:48:21 +0000 (16:48 -0800)]
gru: send cross partition interrupts using the gru

GRU Message queue instructions are used to deliver messages to other SSIs
within the numalink domain.  In most cases, a single GRU mesq instruction
will deliver both the message AND an interrupt to notify the other SSI
that a messsage is present.  In some cases, however, the interrupt must be
sent explicitly.

To improve resilency, the GRU driver should send these explicit interrupts
using the GRU to write the remote chipset register.  Current code sends
the interrupt using a cpu instruction to write the chipset register.

Signed-off-by: Jack Steiner <steiner@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agogru: function to generate chipset IPI values
Jack Steiner [Wed, 16 Dec 2009 00:48:20 +0000 (16:48 -0800)]
gru: function to generate chipset IPI values

Create a function to generate the value that is written to the UV hub MMR
to cause an IPI interrupt to be sent.  The function will be used in the
GRU message queue error recovery code that sends IPIs to nodes in remote
partitions.

Signed-off-by: Jack Steiner <steiner@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agogru: update driver version number
Jack Steiner [Wed, 16 Dec 2009 00:48:19 +0000 (16:48 -0800)]
gru: update driver version number

Update the version number of the GRU driver.

Signed-off-by: Jack Steiner <steiner@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agogru: improve GRU TLB dropin statistics
Jack Steiner [Wed, 16 Dec 2009 00:48:18 +0000 (16:48 -0800)]
gru: improve GRU TLB dropin statistics

Update the TLB dropin statistics kept for each GRU context.  Count TLB
dropins separate from the misses - some misses do not result in a TLB
dropin.  Some of the diagnostics need both counts.

Signed-off-by: Jack Steiner <steiner@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agogru: fix GRU interrupt race at deallocate
Jack Steiner [Wed, 16 Dec 2009 00:48:18 +0000 (16:48 -0800)]
gru: fix GRU interrupt race at deallocate

Fix a race where an interrupt could be received for a GRU context that has
been deallocated.

Signed-off-by: Jack Steiner <steiner@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agogru: add hugepage support
Jack Steiner [Wed, 16 Dec 2009 00:48:17 +0000 (16:48 -0800)]
gru: add hugepage support

Add support for hugepages. Easier than I originally thought.

Signed-off-by: Jack Steiner <steiner@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agogru: fix bug in allocation of kernel contexts
Jack Steiner [Wed, 16 Dec 2009 00:48:17 +0000 (16:48 -0800)]
gru: fix bug in allocation of kernel contexts

Fix a bug in the assignment of GRU contexts used for kernel functions.  If
a sleep occurs on the wait for a semaphore, the thread could switch cpus
and allocate resources on the wrong blade.

Signed-off-by: Jack Steiner <steiner@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agogru: update GRU structures to match latest hardware spec
Jack Steiner [Wed, 16 Dec 2009 00:48:16 +0000 (16:48 -0800)]
gru: update GRU structures to match latest hardware spec

Add a few new definitions for chipset MMR field names.  This matches rev
0.7 of the hardware spec.

Signed-off-by: Jack Steiner <steiner@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agogru: check for correct GRU chiplet assignment
Jack Steiner [Wed, 16 Dec 2009 00:48:15 +0000 (16:48 -0800)]
gru: check for correct GRU chiplet assignment

Simplify the code that checks for correct assignment of GRU contexts to
users.

Signed-off-by: Jack Steiner <steiner@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agogru: remove stray local_irq_enable
Jack Steiner [Wed, 16 Dec 2009 00:48:15 +0000 (16:48 -0800)]
gru: remove stray local_irq_enable

Remove a stray local_irq_enable() in the GRU TLB dropin code.

Signed-off-by: Jack Steiner <steiner@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agogru: add symbolic names for GRU error code
Jack Steiner [Wed, 16 Dec 2009 00:48:14 +0000 (16:48 -0800)]
gru: add symbolic names for GRU error code

Use symbol names instead of numbers for error return values for the vtop
functions.

Signed-off-by: Jack Steiner <steiner@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agogru: fix bug in exception handling
Jack Steiner [Wed, 16 Dec 2009 00:48:14 +0000 (16:48 -0800)]
gru: fix bug in exception handling

Fix a GRU driver bug converting a CBR address to the context that contains
the CBR.  The conversion is rarely done so performance does not matter.

Signed-off-by: Jack Steiner <steiner@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agogru: preload tlb for bcopy instructions
Jack Steiner [Wed, 16 Dec 2009 00:48:13 +0000 (16:48 -0800)]
gru: preload tlb for bcopy instructions

Add anticipatory TLB dropins for GRU TLB misses that occur on BCOPY
instructions that copy large amounts of data.

Signed-off-by: Jack Steiner <steiner@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agogru: expicitly set instruction status to active
Jack Steiner [Wed, 16 Dec 2009 00:48:12 +0000 (16:48 -0800)]
gru: expicitly set instruction status to active

Explicitly set GRU instructions to "ACTIVE".  This eliminates the need for
barriers that would have been necessary to prevent reading the instruction
"status" field before the GRU had actually started the instruction.

Signed-off-by: Jack Steiner <steiner@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agogru: add additional GRU statistics
Jack Steiner [Wed, 16 Dec 2009 00:48:12 +0000 (16:48 -0800)]
gru: add additional GRU statistics

Add additional GRU statistics & debug messages.

Signed-off-by: Jack Steiner <steiner@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agogru: update irq infrastructure
Jack Steiner [Wed, 16 Dec 2009 00:48:11 +0000 (16:48 -0800)]
gru: update irq infrastructure

Update the GRU irq allocate/free functions to use the latest upstream
infrastructure.

Signed-off-by: Jack Steiner <steiner@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agogru: fix prefetch and speculation bugs
Jack Steiner [Wed, 16 Dec 2009 00:48:11 +0000 (16:48 -0800)]
gru: fix prefetch and speculation bugs

Fix several bugs related to prefetch, ordering & speculation:

- GRU cch_allocate() instruction causes cacheable memory
  to be created. Add a barriers to prevent speculation
  from prefetching data before it exists.
- Add memory barriers before cache-flush instructions to ensure
  that previously stored data is included in the line flushed to memory.

Signed-off-by: Jack Steiner <steiner@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agogru: check for valid vma
Jack Steiner [Wed, 16 Dec 2009 00:48:10 +0000 (16:48 -0800)]
gru: check for valid vma

Fix bug caused by failure to allocate a GRU gts structure.  The old code
failed to handle the case where the vma was invalid.

Signed-off-by: Jack Steiner <steiner@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agogru: add test for gru_copy_gpa
Jack Steiner [Wed, 16 Dec 2009 00:48:09 +0000 (16:48 -0800)]
gru: add test for gru_copy_gpa

Improve existing driver self-tests.  Add a new debugging test to the SGI
GRU driver for verifying the global GRU copy function.

Signed-off-by: Jack Steiner <steiner@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agogru: add debug option for cache flushing
Jack Steiner [Wed, 16 Dec 2009 00:48:09 +0000 (16:48 -0800)]
gru: add debug option for cache flushing

Add a debug option to the SGI GRU driver for flushing GRU cache lines from
memory.  In theory this is not needed but it is useful for debugging.
This has no use by end users.

Signed-off-by: Jack Steiner <steiner@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agogru: handle failures to mmu_notifier_register
Jack Steiner [Wed, 16 Dec 2009 00:48:08 +0000 (16:48 -0800)]
gru: handle failures to mmu_notifier_register

Under some conditions, mmu_notifier_register() will fail to register a
mmu_notifier.  Fix the GRU driver to correctly handle these failures.

Signed-off-by: Jack Steiner <steiner@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agogru: support 64-bit GRU addresses
Jack Steiner [Wed, 16 Dec 2009 00:48:07 +0000 (16:48 -0800)]
gru: support 64-bit GRU addresses

Increase the maximum address supported by the SGI GRU driver to a full 64
bits.  Note that GRU addresses are not always the same as socket virtual
addresses.  Sockets may not necessarily support the full 64 bits.

Signed-off-by: Jack Steiner <steiner@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agogru: improve messages for malfunctioning GRUs
Jack Steiner [Wed, 16 Dec 2009 00:48:07 +0000 (16:48 -0800)]
gru: improve messages for malfunctioning GRUs

Improve error messages for malfunctioning GRUs.  Identify the type of
instruction that is failing.

Signed-off-by: Jack Steiner <steiner@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agogru: fix bug in module unload
Jack Steiner [Wed, 16 Dec 2009 00:48:06 +0000 (16:48 -0800)]
gru: fix bug in module unload

Fix bug in module unload.  Previous code was not correctly deleting the
files in /proc.

Signed-off-by: Jack Steiner <steiner@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agogru: allow users to specify gru chiplet 3
Jack Steiner [Wed, 16 Dec 2009 00:48:06 +0000 (16:48 -0800)]
gru: allow users to specify gru chiplet 3

This patch builds on the infrastructure introduced in the patches that
allow user specification of GRU blades & chiplets for context allocation.

This patch simplifies the algorithms for migrating GRU contexts between
blades.

No new functionality is introduced.

Signed-off-by: Jack Steiner <steiner@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agogru: allow users to specify gru chiplet 2
Jack Steiner [Wed, 16 Dec 2009 00:48:05 +0000 (16:48 -0800)]
gru: allow users to specify gru chiplet 2

Add support to the GRU driver to allow users to specify the blade &
chiplet for allocation of GRU contexts.  Add new statistics for context
loading/unloading/retargeting.  Also deleted a few GRU stats that were no
longer being unused.

Signed-off-by: Jack Steiner <steiner@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agogru: allow users to specify gru chiplet 1
Jack Steiner [Wed, 16 Dec 2009 00:48:04 +0000 (16:48 -0800)]
gru: allow users to specify gru chiplet 1

Add table & user request infrastructure that is needed to allow users to
specify the blade and chiplet for allocation of GRU contexts.  Use of this
information is in a subsequent patch.

Signed-off-by: Jack Steiner <steiner@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agogru: handle blades without memory
Jack Steiner [Wed, 16 Dec 2009 00:48:03 +0000 (16:48 -0800)]
gru: handle blades without memory

Do not use alloc_pages_exact_node() to allocate GRU tables.  If a blade
has no local memory, nid will be -1.  Use alloc_pages_node() instead.

Signed-off-by: Jack Steiner <steiner@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agogru: fix istatus race in GRU tlb dropin
Jack Steiner [Wed, 16 Dec 2009 00:48:03 +0000 (16:48 -0800)]
gru: fix istatus race in GRU tlb dropin

TLB dropins require updates to the CBR instruction istatus field.  This is
needed to resolve race conditions in the chip.

The code currently uses the user address of the CBR.  This works but opens
up additional endcases related to stealing of contexts and accessing the
CBR from tasks that do not have access to the user address space.  (Some
of this non-user task access is debug code that is not currently being
pushed to the community).

User CBRs are also directly accessible using the kernel mapping of the
CBR.  Change the TLB dropin code to use the the kernel mapping of the CBR.

Signed-off-by: Jack Steiner <steiner@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agogru: add comments raised in previous code reviews
Jack Steiner [Wed, 16 Dec 2009 00:48:02 +0000 (16:48 -0800)]
gru: add comments raised in previous code reviews

Add comments from previous code reviews.  The comments help explain some
of the more esoteric aspects of the driver.

Move a free() to the other side of an unlock.

Signed-off-by: Jack Steiner <steiner@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agogru: initial GRU based on blade topology
Jack Steiner [Wed, 16 Dec 2009 00:48:01 +0000 (16:48 -0800)]
gru: initial GRU based on blade topology

Change the GRU initialization code to initialize based on blade topology
instead of node topology.  The result is the same but blade-based
initialization is cleaner.

Signed-off-by: Jack Steiner <steiner@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agoUV - XPC: pass nasid instead of nid to gru_create_message_queue
Robin Holt [Wed, 16 Dec 2009 00:48:00 +0000 (16:48 -0800)]
UV - XPC: pass nasid instead of nid to gru_create_message_queue

Currently, the UV xpc code is passing nid to the gru_create_message_queue
instead of nasid as it expects.

Signed-off-by: Robin Holt <holt@sgi.com>
Signed-off-by: Jack Steiner <steiner@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agox86: uv: XPC receive message reuse triggers invalid BUG_ON()
Robin Holt [Wed, 16 Dec 2009 00:47:59 +0000 (16:47 -0800)]
x86: uv: XPC receive message reuse triggers invalid BUG_ON()

This was a difficult bug to trip.  XPC was in the middle of sending an
acknowledgement for a received message.

In xpc_received_payload_uv():
.
        ret = xpc_send_gru_msg(ch->sn.uv.cached_notify_gru_mq_desc, msg,
                               sizeof(struct xpc_notify_mq_msghdr_uv));
        if (ret != xpSuccess)
                XPC_DEACTIVATE_PARTITION(&xpc_partitions[ch->partid], ret);

        msg->hdr.msg_slot_number += ch->remote_nentries;

at the point in xpc_send_gru_msg() where the hardware has dispatched the
acknowledgement, the remote side is able to reuse the message structure
and send a message with a different slot number.  This problem is made
worse by interrupts.

The adjustment of msg_slot_number and the BUG_ON in
xpc_handle_notify_mq_msg_uv() which verifies the msg_slot_number is
consistent are only used for debug purposes.  Since a fix for this that
preserves the debug functionality would either have to infringe upon the
payload or allocate another structure just for debug, I decided to remove
it entirely.

Signed-off-by: Robin Holt <holt@sgi.com>
Cc: Jack Steiner <steiner@sgi.com>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agoX86: uv: xpc_make_first_contact hang due to not accepting ACTIVE state
Robin Holt [Wed, 16 Dec 2009 00:47:58 +0000 (16:47 -0800)]
X86: uv: xpc_make_first_contact hang due to not accepting ACTIVE state

Many times while the initial connection is being made, the contacted
partition will send back both the ACTIVATING and the ACTIVE
remote_act_state changes in very close succescion.  The 1/4 second delay
in the make first contact loop is large enough to nearly always miss the
ACTIVATING state change.

Since either state indicates the remote partition has acknowledged our
state change, accept either.

Signed-off-by: Robin Holt <holt@sgi.com>
Cc: Jack Steiner <steiner@sgi.com>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>