9 years agonilfs2: reject incompatible filesystem
Ryusuke Konishi [Wed, 21 Jul 2010 18:22:20 +0000]
nilfs2: reject incompatible filesystem

This forces nilfs to check compatibility of feature flags so as to
reject a filesystem with unknown features when it mounts or remounts
the filesystem.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>

9 years agonilfs2: add feature set fields to super block
Ryusuke Konishi [Wed, 21 Jul 2010 18:22:19 +0000]
nilfs2: add feature set fields to super block

This adds three new fields to nilfs_super_block structure, compatible
feature set, readonly-compatible feature set, and incompatible feature
set in order to prepare for future disk format modifications.

The role of these fields conforms to those of ext3 or other
filesystems.  Most important flags are the incompatible feature set;
it is used to refuse to mount the filesystem which sets an
incompatible feature the kernel doesn't know about.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>

9 years agonilfs2: clarify byte offset in super block format
Ryusuke Konishi [Wed, 21 Jul 2010 18:22:18 +0000]
nilfs2: clarify byte offset in super block format

This inserts comments indicating hexadecimal offset in declaration of
nilfs_super_block structure so that people can know offset of its
fields without counting from the head.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>

9 years agonilfs2: apply read-ahead for nilfs_btree_lookup_contig
Ryusuke Konishi [Sun, 18 Jul 2010 01:42:26 +0000]
nilfs2: apply read-ahead for nilfs_btree_lookup_contig

This applies read-ahead to nilfs_btree_do_lookup and
nilfs_btree_lookup_contig functions and extends them to read ahead
siblings of level 1 btree nodes that hold data blocks.

At present, the read-ahead is not applied to most btree operations;
only get_block() callback function, which is used during read of
regular files or directories, receives the benefit.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>

9 years agonilfs2: introduce check flag to btree node buffer
Ryusuke Konishi [Sun, 18 Jul 2010 01:42:25 +0000]
nilfs2: introduce check flag to btree node buffer

nilfs_btree_get_block() now may return untested buffer due to
read-ahead.  This adds a new flag for buffer heads so that the btree
code can check whether the buffer is already verified or not.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>

9 years agonilfs2: add btree get block function with readahead option
Ryusuke Konishi [Sun, 18 Jul 2010 01:42:24 +0000]
nilfs2: add btree get block function with readahead option

This adds __nilfs_btree_get_block() function that can issue a series
of read-ahead requests for sibling btree nodes.

This read-ahead needs parent node block, so nilfs_btree_readahead_info
structure is added to pass the information that
__nilfs_btree_get_block() needs.

This also replaces the previous nilfs_btree_get_block() implementation
with a wrapper function of __nilfs_btree_get_block().

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>

9 years agonilfs2: add read ahead mode to nilfs_btnode_submit_block
Ryusuke Konishi [Sun, 18 Jul 2010 01:42:23 +0000]
nilfs2: add read ahead mode to nilfs_btnode_submit_block

This adds mode argument to nilfs_btnode_submit_block() function and
allows it to issue a read-ahead request.

An optional submit_ptr argument is also added to store the actual
block address for which bio is sent.  submit_ptr is used for a series
of read-ahead requests, and helps to decide if each requested block is
continous to the previous one on disk.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>

9 years agonilfs2: fix buffer head leak in nilfs_btnode_submit_block
Ryusuke Konishi [Thu, 15 Jul 2010 02:39:10 +0000]
nilfs2: fix buffer head leak in nilfs_btnode_submit_block

nilfs_btnode_submit_block() refers to buffer head just before
returning from the function, but it releases the buffer head earlier
than that if nilfs_dat_translate() gets an error.

This has potential for oops in the erroneous case.  This fixes the

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>

9 years agonilfs2: eliminate inline keywords in btree implementation
Ryusuke Konishi [Tue, 13 Jul 2010 14:33:55 +0000]
nilfs2: eliminate inline keywords in btree implementation

This removes all inline uses from btree.c.  Gcc now agressively apply
inline expansion even for the functions declared without the keyword;
the inline use in btree.c looks excessive.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>

9 years agonilfs2: get maximum number of child nodes from bmap object
Ryusuke Konishi [Tue, 13 Jul 2010 14:33:54 +0000]
nilfs2: get maximum number of child nodes from bmap object

The patch "reduce repetitive calculation of max number of child nodes"
gathered up the calculation of maximum number of child nodes into
nilfs_btree_nchildren_per_block() function.  This makes the function
get resultant value from a private variable in bmap object instead of
calculating it for each call.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>

9 years agonilfs2: reduce repetitive calculation of max number of child nodes
Ryusuke Konishi [Tue, 13 Jul 2010 14:33:53 +0000]
nilfs2: reduce repetitive calculation of max number of child nodes

The current btree implementation repeats the same calculation on the
maximum number of child nodes.  This is because a few low level
routines use the calculation for index addressing in a btree node

This reduces the calculation by explicitly passing the maximum number
of child nodes (ncmax) through their argument.

This changes parameter passing of the following functions:

 - nilfs_btree_node_dptrs
 - nilfs_btree_node_get_ptr
 - nilfs_btree_node_set_ptr
 - nilfs_btree_node_init
 - nilfs_btree_node_move_left
 - nilfs_btree_node_move_right
 - nilfs_btree_node_insert
 - nilfs_btree_node_delete, and
 - nilfs_btree_get_node

The following functions are removed:

 - nilfs_btree_node_nchildren_min
 - nilfs_btree_node_nchildren_max

Most middle level btree operations are rewritten to pass a proper
ncmax value depending on whether each occurrence of node is "root" or

A constant NILFS_BTREE_ROOT_NCHILDREN_MAX is used for the root node,
whereas nilfs_btree_nchildren_per_block() function is used for
non-root nodes.  If a node could be either root or a non-root node, an
output argument of nilfs_btree_get_node() is used to set up ncmax.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>

9 years agonilfs2: optimize calculation of min/max number of btree node children
Ryusuke Konishi [Tue, 13 Jul 2010 14:33:52 +0000]
nilfs2: optimize calculation of min/max number of btree node children

nilfs_btree_node_nchildren_max() and nilfs_btree_node_nchildren_min()
functions switch return value depending on whether target node is the
root or a node block.  In most uses of these functions, however, the
node type is fixed, and moreover the same calculation is repeatedly
performed in loop.

This unfold these functions depending on context and move them outside
loops wherever possible.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>

9 years agonilfs2: remove redundant pointer checks in bmap lookup functions
Ryusuke Konishi [Tue, 13 Jul 2010 14:33:51 +0000]
nilfs2: remove redundant pointer checks in bmap lookup functions

nilfs_bmap_lookup and its variants are supposed to take a valid
pointer argument to return a block address, thus pointer checks in
nilfs_btree_lookup and nilfs_direct_lookup are needless.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>

9 years agonilfs2: get rid of nilfs_bmap_union
Ryusuke Konishi [Sat, 10 Jul 2010 11:52:09 +0000]
nilfs2: get rid of nilfs_bmap_union

This removes nilfs_bmap_union and finally unifies three structures and
the union in bmap/btree code into one.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>

9 years agonilfs2: unify bmap set_target_v operations
Ryusuke Konishi [Sat, 10 Jul 2010 13:21:54 +0000]
nilfs2: unify bmap set_target_v operations

This unifies two similar functions nilfs_btree_set_target_v and
nilfs_direct_set_target_v into one, nilfs_bmap_set_target_v.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>

9 years agonilfs2: get rid of nilfs_btree uses
Ryusuke Konishi [Sat, 10 Jul 2010 10:09:49 +0000]
nilfs2: get rid of nilfs_btree uses

This replaces all uses of nilfs_btree struct in implementation of
btree mapping with nilfs_bmap struct.

Name of local variable "btree" is kept not to bloat amount of change.
And, a part of local variables "bmap" is renamed to "btree" to uniform
naming rule.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>

9 years agonilfs2: get rid of nilfs_direct uses
Ryusuke Konishi [Sat, 10 Jul 2010 09:07:04 +0000]
nilfs2: get rid of nilfs_direct uses

This replaces all uses of nilfs_direct struct in implementation of
direct mapping with nilfs_bmap struct.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>

9 years agonilfs2: remove constant qualifier from argument of bmap propagate
Ryusuke Konishi [Sat, 10 Jul 2010 12:37:47 +0000]
nilfs2: remove constant qualifier from argument of bmap propagate

The first argument of bops->bop_propagate operation takes a constant
qualifier, and causes compilation error when removed cast to pointer
of nilfs_btree structure type.  This fixes the issue to prepare for
succesive removal of nilfs_btree struct.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>

9 years agonilfs2: get rid of private conversion macros on bmap key and pointer
Ryusuke Konishi [Sat, 10 Jul 2010 07:50:41 +0000]
nilfs2: get rid of private conversion macros on bmap key and pointer

Will remove nilfs_bmap_key_to_dkey(), nilfs_bmap_dkey_to_key(),
nilfs_bmap_ptr_to_dptr(), and nilfs_bmap_dptr_to_ptr() for simplicity.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>

9 years agonilfs2: verify btree node after reading
Ryusuke Konishi [Fri, 16 Jul 2010 14:52:40 +0000]
nilfs2: verify btree node after reading

This inserts sanity checks soon after read btree node from disk.  This
allows early detection of broken btree nodes, and helps to narrow down
problems due to file system corruption.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>

9 years agonilfs2: add sanity check in nilfs_btree_add_dirty_buffer
Ryusuke Konishi [Wed, 7 Jul 2010 08:19:54 +0000]
nilfs2: add sanity check in nilfs_btree_add_dirty_buffer

According to the report titled "problem with nilfs_cleanerd" from
Łukasz Wójcicki, nilfs_btree_lookup_dirty_buffers or
nilfs_btree_add_dirty_buffer got memory violation during garbage

This could happen if a level field of given btree node buffer is
incorrect, which is a crucial internal bug.

This inserts a sanity check to figure out the problem.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>

9 years agonilfs2: pass remount flag to parse_options
Ryusuke Konishi [Mon, 5 Jul 2010 11:08:33 +0000]
nilfs2: pass remount flag to parse_options

This adds is_remount argument to the parse_options() function that
obtains mount options from strings.

Previously, parse_options did not distinguish context whether it's
called for a new mount or remount, so the caller needed additional
verifications outside the function.

This allows parse_options to verify options and print messages
depending on the context.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>

9 years agonilfs2: use seq_puts to print mount options without argument
Ryusuke Konishi [Mon, 5 Jul 2010 05:40:27 +0000]
nilfs2: use seq_puts to print mount options without argument

This replaces seq_printf() with seq_puts() in nilfs_show_options for
mount options which have no argument.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>

9 years agonilfs2: add nodiscard mount option
Ryusuke Konishi [Mon, 5 Jul 2010 05:27:04 +0000]
nilfs2: add nodiscard mount option

Nilfs has "discard" mount option which issues discard/TRIM commands to
underlying block device, but it lacks a complementary option and has
no way to disable the feature through remount.

This adds "nodiscard" option to resolve this imbalance.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>

9 years agonilfs2: add barrier mount option
Ryusuke Konishi [Mon, 5 Jul 2010 04:00:08 +0000]
nilfs2: add barrier mount option

Nilfs enables write barriers by default and has "nobarrier" mount
option to disable this feature.  But it lacks the complementary option
and has no way to re-enable the feature on remount.

This adds "barrier" option to resolve this imbalance.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>

9 years agonilfs2: do not update log cursor for small change
Ryusuke Konishi [Tue, 29 Jun 2010 05:42:13 +0000]
nilfs2: do not update log cursor for small change

Super blocks of nilfs are periodically overwritten in order to record
the recent log position.  This shortens recovery time after unclean
unmount, but the current implementation performs the update even for a
few blocks of change.  If the filesystem gets small changes slowly and
continually, super blocks may be updated excessively.

This moderates the issue by skipping update of log cursor if it does
not cross a segment boundary.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>

9 years agonilfs2: implement fallback for super root search
Ryusuke Konishi [Mon, 28 Jun 2010 10:15:26 +0000]
nilfs2: implement fallback for super root search

Although nilfs redundantly uses two super blocks and each may point to
different position on log, the current version of nilfs does not try
fallback to the spare super block when it doesn't find any valid log
at the position that the primary super block points to.

This has been a cause of mount failures due to write order reversals
on barrier less block devices.

This inserts fallback code in error path of nilfs_search_super_root
routine to resolve the mount failure problem.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>

9 years agonilfs2: add missing error code in comment of nilfs_search_super_root
Ryusuke Konishi [Mon, 28 Jun 2010 10:15:25 +0000]
nilfs2: add missing error code in comment of nilfs_search_super_root

nilfs_search_super_root can return -ENOMEM, but this error code is not
described in its kernel-doc comment.  This fixes the discrepancy.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>

9 years agonilfs2: separate setup of log cursor from init_nilfs
Ryusuke Konishi [Mon, 28 Jun 2010 10:15:24 +0000]
nilfs2: separate setup of log cursor from init_nilfs

This separates a setup routine of log cursor from init_nilfs().  The
routine, nilfs_store_log_cursor, reads the last position of the log
containing a super root, and initializes relevant state on the nilfs

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>

9 years agonilfs2: sync super blocks in turns
Jiro SEKIBA [Mon, 28 Jun 2010 08:49:33 +0000]
nilfs2: sync super blocks in turns

This will sync super blocks in turns instead of syncing duplicate
super blocks at the time.  This will help searching valid super root
when super block is written into disk before log is written, which is
happen when barrier-less block devices are unmounted uncleanly.  In
the situation, old super block likely points to valid log.

This patch introduces ns_sbwcount member to the nilfs object and adds
nilfs_sb_will_flip() function; ns_sbwcount counts how many times super
blocks write back to the disk.  And, nilfs_sb_will_flip() decides
whether flipping required or not based on the count of ns_sbwcount to
sync super blocks asymmetrically.

The following functions are also changed:

 - nilfs_prepare_super(): flips super blocks according to the
   argument.  The argument is calculated by nilfs_sb_will_flip()

 - nilfs_cleanup_super(): sets "clean" flag to both super blocks if
   they point to the same checkpoint.

To update both of super block information, caller of
nilfs_commit_super must set the information on both super blocks.

Signed-off-by: Jiro SEKIBA <jir@unicus.jp>
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>

9 years agonilfs2: introduce nilfs_prepare_super
Jiro SEKIBA [Mon, 28 Jun 2010 08:49:32 +0000]
nilfs2: introduce nilfs_prepare_super

This function checks validity of super block pointers.
If first super block is invalid, it will swap the super blocks.
The function should be called before any super block information updates.
Caller must obtain nilfs->ns_sem.

Signed-off-by: Jiro SEKIBA <jir@unicus.jp>
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>

9 years agonilfs2: separate function that updates log position
Ryusuke Konishi [Mon, 28 Jun 2010 08:49:31 +0000]
nilfs2: separate function that updates log position

This moves out section that updates information of the recent log
position stored in super blocks from nilfs_commit_super to a new
routine named nilfs_set_log_cursor.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>

9 years agonilfs2: add nilfs_set_error
Ryusuke Konishi [Mon, 28 Jun 2010 08:49:30 +0000]
nilfs2: add nilfs_set_error

This function marks error state and write it on super blocks.  This is
a preparation for making super block writeback alternately.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>

9 years agonilfs2: add nilfs_cleanup_super
Ryusuke Konishi [Mon, 28 Jun 2010 08:49:29 +0000]
nilfs2: add nilfs_cleanup_super

This function write out filesystem state to super blocks in order to
share the same cleanup work.  This is a preparation for making super
block writeback alternately.

Cc: Jiro SEKIBA <jir@unicus.jp>
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>

9 years agonilfs2: do not update mount time on rw->ro remount
Ryusuke Konishi [Sun, 27 Jun 2010 12:38:05 +0000]
nilfs2: do not update mount time on rw->ro remount

Mount time field in super block is wrongly updated when nilfs remounts
the partition from read-write to read-only.  This fixes the issue.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>

9 years agonilfs2: get rid of ns_free_segments_count
Ryusuke Konishi [Sat, 19 Jun 2010 18:10:21 +0000]
nilfs2: get rid of ns_free_segments_count

This counter is unused.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>

9 years agonilfs2: get rid of macros for segment summary information
Ryusuke Konishi [Sun, 23 May 2010 12:48:36 +0000]
nilfs2: get rid of macros for segment summary information

This removes macros to test segment summary flags and redefines a few
relevant macros with inline functions.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>

9 years agonilfs2: do not use nilfs_segsum_info structure in recovery code
Ryusuke Konishi [Sun, 23 May 2010 10:46:44 +0000]
nilfs2: do not use nilfs_segsum_info structure in recovery code

This will get rid of nilfs_segsum_info use from recovery functions for

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>

9 years agonilfs2: divide load_segment_summary function
Ryusuke Konishi [Sun, 23 May 2010 10:21:49 +0000]
nilfs2: divide load_segment_summary function

load_segment_summary function has two distinct roles: getting summary
header of a log, and verifying consistencies of the log.

This divide it into two corresponding functions, nilfs_read_log_header
and nilfs_validate_log to clarify the meaning.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>

9 years agonilfs2: rename nilfs_recover_logical_segments function
Ryusuke Konishi [Sun, 23 May 2010 03:21:57 +0000]
nilfs2: rename nilfs_recover_logical_segments function

The function name of nilfs_recover_logical_segments makes no sense.
This changes the name into nilfs_salvage_orphan_logs to clarify the
role of the function.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>

9 years agonilfs2: refactor recovery logic routines
Ryusuke Konishi [Sat, 22 May 2010 16:39:02 +0000]
nilfs2: refactor recovery logic routines

Most functions in recovery code take an argument of a super block
instance or a nilfs_sb_info struct for convenience sake.

This replaces them aggressively with a nilfs object by applying
__bread and __breadahead against routines using sb_bread and

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>

9 years agonilfs2: add blocksize member to nilfs object
Ryusuke Konishi [Sat, 22 May 2010 15:17:48 +0000]
nilfs2: add blocksize member to nilfs object

This stores blocksize in nilfs objects for the successive refactoring
of recovery logic.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>

9 years agoLinux 2.6.35-rc6
Linus Torvalds [Thu, 22 Jul 2010 19:13:38 +0000]
Linux 2.6.35-rc6

9 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
Linus Torvalds [Thu, 22 Jul 2010 18:46:15 +0000]
Merge branch 'for-linus' of git://git./linux/kernel/git/dtor/input

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
  Input: synaptics - relax capability ID checks on newer hardware
  Input: twl40300-keypad - fix handling of "all ground" rows
  Input: gamecon - reference correct pad in gc_psx_command()
  Input: gamecon - reference correct input device in NES mode
  Input: w90p910_keypad - change platfrom driver name to 'nuc900-kpi'
  Input: i8042 - add Gigabyte Spring Peak to dmi_noloop_table
  Input: qt2160 - rename kconfig symbol name

9 years agoMerge branch 'drm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied...
Linus Torvalds [Thu, 22 Jul 2010 18:45:57 +0000]
Merge branch 'drm-fixes' of git://git./linux/kernel/git/airlied/drm-2.6

* 'drm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6:
  drm/radeon/kms: add quirk to make HP DV5000 laptop resume
  drm/radeon/kms: fix RADEON_INFO_CRTC_FROM_ID info ioctl
  Fix ttm_page_alloc.c build breakage
  drm/radeon/kms: fix legacy LVDS dpms sequence
  drm/radeon/kms: drop taking lock around crtc lookup.

9 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
Linus Torvalds [Thu, 22 Jul 2010 18:45:23 +0000]
Merge git://git./linux/kernel/git/herbert/crypto-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6:
  crypto: talitos - fix bug in sg_copy_end_to_buffer

9 years agoMerge branch 'x86/auditsyscall' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Thu, 22 Jul 2010 18:45:02 +0000]
Merge branch 'x86/auditsyscall' of git://git./linux/kernel/git/frob/linux-2.6-roland

* 'x86/auditsyscall' of git://git.kernel.org/pub/scm/linux/kernel/git/frob/linux-2.6-roland:
  x86: auditsyscall: fix fastpath return value after reschedule

9 years agoMerge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel...
Linus Torvalds [Thu, 22 Jul 2010 18:44:26 +0000]
Merge branch 'for_linus' of git://git./linux/kernel/git/jwessel/linux-2.6-kgdb

* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/linux-2.6-kgdb:
  sysrq,kdb: Use __handle_sysrq() for kdb's sysrq function
  debug_core,kdb: fix kgdb_connected bit set in the wrong place
  Fix merge regression from external kdb to upstream kdb
  repair gdbstub to match the gdbserial protocol specification
  kdb: break out of kdb_ll() when command is terminated

9 years agoCIFS: Fix a malicious redirect problem in the DNS lookup code
David Howells [Thu, 22 Jul 2010 11:53:18 +0000]
CIFS: Fix a malicious redirect problem in the DNS lookup code

Fix the security problem in the CIFS filesystem DNS lookup code in which a
malicious redirect could be installed by a random user by simply adding a
result record into one of their keyrings with add_key() and then invoking a
CIFS CFS lookup [CVE-2010-2524].

This is done by creating an internal keyring specifically for the caching of
DNS lookups.  To enforce the use of this keyring, the module init routine
creates a set of override credentials with the keyring installed as the thread
keyring and instructs request_key() to only install lookup result keys in that

The override is then applied around the call to request_key().

This has some additional benefits when a kernel service uses this module to
request a key:

 (1) The result keys are owned by root, not the user that caused the lookup.

 (2) The result keys don't pop up in the user's keyrings.

 (3) The result keys don't come out of the quota of the user that caused the

The keyring can be viewed as root by doing cat /proc/keys:

2a0ca6c3 I-----     1 perm 1f030000     0     0 keyring   .dns_resolver: 1/4

It can then be listed with 'keyctl list' by root.

# keyctl list 0x2a0ca6c3
1 key in keyring:
726766307: --alswrv     0     0 dns_resolver: foo.bar.com

Signed-off-by: David Howells <dhowells@redhat.com>
Reviewed-and-Tested-by: Jeff Layton <jlayton@redhat.com>
Acked-by: Steve French <smfrench@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

9 years agodrm/radeon/kms: add quirk to make HP DV5000 laptop resume
Alex Deucher [Thu, 22 Jul 2010 03:54:35 +0000]
drm/radeon/kms: add quirk to make HP DV5000 laptop resume


Reported-by:  Andres Cimmarusti <acimmarusti@gmail.com>
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>

9 years agoInput: synaptics - relax capability ID checks on newer hardware
Dmitry Torokhov [Wed, 21 Jul 2010 07:01:19 +0000]
Input: synaptics - relax capability ID checks on newer hardware

Older firmwares fixed the middle byte of the Synaptics capabilities
query to 0x47, but starting with firmware 7.5 the middle byte
represents submodel ID, sometimes also called "dash number".

Reported-and-tested-by: Miroslav Šulc <fordfrog@gmail.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>

9 years agox86: auditsyscall: fix fastpath return value after reschedule
Roland McGrath [Thu, 22 Jul 2010 00:44:12 +0000]
x86: auditsyscall: fix fastpath return value after reschedule

In the CONFIG_AUDITSYSCALL fast-path for x86 64-bit system calls,
we can pass a bad return value and/or error indication for the
system call to audit_syscall_exit().  This happens when
TIF_NEED_RESCHED was set as the system call returned, so we went
out to schedule() and came back to the exit-audit fast-path.  The
fix is to reload the user return value register from the pt_regs
before using it for audit_syscall_exit().

Both the 32-bit kernel's fast path and the 64-bit kernel's 32-bit
system call fast paths work slightly differently, so that they
always leave the fast path entirely to reschedule and don't return
there, so they don't have the analogous bugs.

Reported-by: Alexander Viro <aviro@redhat.com>
Signed-off-by: Roland McGrath <roland@redhat.com>

9 years agosysrq,kdb: Use __handle_sysrq() for kdb's sysrq function
Jason Wessel [Thu, 22 Jul 2010 00:27:07 +0000]
sysrq,kdb: Use __handle_sysrq() for kdb's sysrq function

The kdb code should not toggle the sysrq state in case an end user
wants to try and resume the normal kernel execution.

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

9 years agodebug_core,kdb: fix kgdb_connected bit set in the wrong place
Jason Wessel [Thu, 22 Jul 2010 00:27:07 +0000]
debug_core,kdb: fix kgdb_connected bit set in the wrong place

Immediately following an exit from the kdb shell the kgdb_connected
variable should be set to zero, unless there are breakpoints planted.
If the kgdb_connected variable is not zeroed out with kdb, it is
impossible to turn off kdb.

This patch is merely a work around for now, the real fix will check
for the breakpoints.

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>

9 years agoFix merge regression from external kdb to upstream kdb
Jason Wessel [Thu, 22 Jul 2010 00:27:06 +0000]
Fix merge regression from external kdb to upstream kdb

In the process of merging kdb to the mainline, the kdb lsmod command
stopped printing the base load address of kernel modules.  This is
needed for using kdb in conjunction with external tools such as gdb.

Simply restore the functionality by adding a kdb_printf for the base
load address of the kernel modules.

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>

9 years agorepair gdbstub to match the gdbserial protocol specification
Jason Wessel [Thu, 22 Jul 2010 00:27:05 +0000]
repair gdbstub to match the gdbserial protocol specification

The gdbserial protocol handler should return an empty packet instead
of an error string when ever it responds to a command it does not

The problem cases come from a debugger client sending
qTBuffer, qTStatus, qSearch, qSupported.

The incorrect response from the gdbstub leads the debugger clients to
not function correctly.  Recent versions of gdb will not detach correctly as a result of this behavior.

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Dongdong Deng <dongdong.deng@windriver.com>

9 years agokdb: break out of kdb_ll() when command is terminated
Martin Hicks [Thu, 22 Jul 2010 00:27:05 +0000]
kdb: break out of kdb_ll() when command is terminated

Without this patch the "ll" linked-list traversal command won't
terminate when you hit q/Q.

Signed-off-by: Martin Hicks <mort@sgi.com>
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>

9 years agodrm/radeon/kms: fix RADEON_INFO_CRTC_FROM_ID info ioctl
Alex Deucher [Wed, 21 Jul 2010 18:05:35 +0000]
drm/radeon/kms: fix RADEON_INFO_CRTC_FROM_ID info ioctl

Return the crtc_id, not the counter value.  They are not
necessarily the same.

Cc: Jerome Glisse <glisse@freedesktop.org>
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>

9 years agoFix ttm_page_alloc.c build breakage
Luck, Tony [Wed, 21 Jul 2010 17:15:39 +0000]
Fix ttm_page_alloc.c build breakage

The commit 1e8655f87333def92bb8215b423adc65403b08a5
    drm/ttm: Fix build on architectures without AGP

looks at TTM_HAS_AGP before it has been set in ttm_bo_driver.h

Move the conditional inclusion of <asm/agp.h> *after* we have included

Signed-of-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>

9 years agodrm/radeon/kms: fix legacy LVDS dpms sequence
Alex Deucher [Wed, 21 Jul 2010 23:37:21 +0000]
drm/radeon/kms: fix legacy LVDS dpms sequence

Add delay after turning off the LVDS encoder.


Tested-by: Jan Kreuzer <kontrollator@gmx.de>
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Cc: stable@kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>

9 years agodrm/radeon/kms: drop taking lock around crtc lookup.
Dave Airlie [Wed, 21 Jul 2010 23:57:13 +0000]
drm/radeon/kms: drop taking lock around crtc lookup.

We only add/remove crtcs at driver load, you cannot remove when
the GPU is running a CS packet since the fd is open, when
GPU hotplugging on radeons actually is needed all this locking
needs a review and I've started re-working kms core locking to deal
with this better. But for now avoid long delays in CS processing when
hotplug detect is happening in a different thread.

this fixes a regression introduced with hotplug detection.

Signed-off-by: Dave Airlie <airlied@redhat.com>

9 years agoMerge branch 'urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-2.6
Linus Torvalds [Wed, 21 Jul 2010 16:31:15 +0000]
Merge branch 'urgent' of git://git./linux/kernel/git/brodo/pcmcia-2.6

* 'urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-2.6:
  pcmcia: fix 'driver ... did not release config properly' warning

9 years agoMerge branch 'shrinker' of git://git.kernel.org/pub/scm/linux/kernel/git/dgc/xfsdev
Linus Torvalds [Wed, 21 Jul 2010 16:30:59 +0000]
Merge branch 'shrinker' of git://git./linux/kernel/git/dgc/xfsdev

* 'shrinker' of git://git.kernel.org/pub/scm/linux/kernel/git/dgc/xfsdev:
  mm: add context argument to shrinker callback to remaining shrinkers

9 years agoMerge branch 'fix/asoc' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6
Linus Torvalds [Wed, 21 Jul 2010 16:29:39 +0000]
Merge branch 'fix/asoc' of git://git./linux/kernel/git/tiwai/sound-2.6

* 'fix/asoc' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6:
  ASoC: Select wm_hubs automatically for WM8994
  ASoC: Remove duplicate AUX definition from WM8776
  ASoC:: remove a redundant snd_soc_unregister_codec call in wm8988_register
  ASoC: wm8727: add a missing return in wm8727_platform_probe
  ASoC: fsi: fixup wrong value setting order of TDM
  ASoC: fsi: fixup clock inversion operation

9 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6
Linus Torvalds [Wed, 21 Jul 2010 16:28:50 +0000]
Merge git://git./linux/kernel/git/davem/sparc-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6:
  math-emu: correct test for downshifting fraction in _FP_FROM_INT()
  perf: Add DWARF register lookup for sparc
  MAINTAINERS: Add SBUS driver path to sparc entry.
  drivers/sbus: Remove unnecessary casts of private_data
  sparc: remove homegrown L1_CACHE_ALIGN macro
  sparc64: fix the build error due to smp_kgdb_capture_client()
  sparc64: Fix maybe_change_configuration() PCR setting.
  arch/sparc/kernel: Eliminate what looks like a NULL pointer dereference
  sparc64: Update defconfig.
  sunsu: Fix use after free in su_remove().
  sunserial: Don't call add_preferred_console() when console= is specified.
  sparc32: Kill none_mask, it's bogus.

9 years agoFix up trivial spelling errors ('taht' -> 'that')
Linus Torvalds [Wed, 21 Jul 2010 16:25:42 +0000]
Fix up trivial spelling errors ('taht' -> 'that')

Pointed out by Lucas who found the new one in a comment in
setup_percpu.c. And then I fixed the others that I grepped

Reported-by: Lucas <canolucas@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

9 years agopcmcia: fix 'driver ... did not release config properly' warning
Patrick McHardy [Tue, 20 Jul 2010 22:21:42 +0000]
pcmcia: fix 'driver ... did not release config properly' warning

Up to 2.6.34 pcmcia_release_irq() reset p_dev->_irq to 0 after releasing
the irq.  The IRQ is now released in pcmcia_disable_device(), however
p_dev->_irq is not reset, triggering a warning in pcmcia_device_remove().

Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>

9 years agomm: add context argument to shrinker callback to remaining shrinkers
Dave Chinner [Wed, 21 Jul 2010 05:33:01 +0000]
mm: add context argument to shrinker callback to remaining shrinkers

Add the shrinkers missed in the first conversion of the API in
commit 7f8275d0d660c146de6ee3017e1e2e594c49e820 ("mm: add context argument to
shrinker callback").

Signed-off-by: Dave Chinner <dchinner@redhat.com>

9 years agoInput: twl40300-keypad - fix handling of "all ground" rows
Dmitry Torokhov [Wed, 21 Jul 2010 03:25:35 +0000]
Input: twl40300-keypad - fix handling of "all ground" rows

The Nokia RX51 board code (arch/arm/mach-omap2/board-rx51-peripherals.c)
defines a key map for the matrix keypad keyboard. The hardware seems to
use all of the 8 rows and 8 columns of the keypad, although not all
possible locations are used.

The TWL4030 supports keypads with at most 8 rows and 8 columns. Most keys
are defined with a row and column number between 0 and 7, except

        KEY(0xff, 2, KEY_F9),
        KEY(0xff, 4, KEY_F10),
        KEY(0xff, 5, KEY_F11),

which represent keycodes that should be emitted when entire row is
connected to the ground.  since the driver handles this case as if we
had an extra column in the key matrix. Unfortunately we do not allocate
enough space and end up owerwriting some random memory.

Reported-and-tested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: stable@kernel.org
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>

9 years agoInput: gamecon - reference correct pad in gc_psx_command()
Dmitry Torokhov [Wed, 21 Jul 2010 03:25:35 +0000]
Input: gamecon - reference correct pad in gc_psx_command()

Otherwise we won't see any events from the gamepad.
Addresses https://bugzilla.kernel.org/show_bug.cgi?id=16408

Reported-and-tested-by: Eugene Yudin <eugene.yudin@gmail.com>
Cc: stable@kernel.org
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>

9 years agoInput: gamecon - reference correct input device in NES mode
Dmitry Torokhov [Wed, 21 Jul 2010 03:25:35 +0000]
Input: gamecon - reference correct input device in NES mode

We moved input devices from 'struct gc' to individial pads (struct
gc-pad), but gc_nes_process_packet() was still trying to use old
ones and crashing.

Cc: stable@kernel.org
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>

9 years agomath-emu: correct test for downshifting fraction in _FP_FROM_INT()
Mikael Pettersson [Wed, 21 Jul 2010 01:45:14 +0000]
math-emu: correct test for downshifting fraction in _FP_FROM_INT()

The kernel's math-emu code contains a macro _FP_FROM_INT() which is
used to convert an integer to a raw normalized floating-point value.
It does this basically in three steps:

1. Compute the exponent from the number of leading zero bits.
2. Downshift large fractions to put the MSB in the right position
   for normalized fractions.
3. Upshift small fractions to put the MSB in the right position.

There is an boundary error in step 2, causing a fraction with its
MSB exactly one bit above the normalized MSB position to not be
downshifted.  This results in a non-normalized raw float, which when
packed becomes a massively inaccurate representation for that input.

The impact of this depends on a number of arch-specific factors,
but it is known to have broken emulation of FXTOD instructions
on UltraSPARC III, which was originally reported as GCC bug 44631

Any arch which uses math-emu to emulate conversions from integers to
same-size floats may be affected.

The fix is simple: the exponent comparison used to determine if the
fraction should be downshifted must be "<=" not "<".

I'm sending a kernel module to test this as a reply to this message.
There are also SPARC user-space test cases in the GCC bug entry.

Signed-off-by: Mikael Pettersson <mikpe@it.uu.se>
Signed-off-by: David S. Miller <davem@davemloft.net>

9 years agoMerge branch 'drm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied...
Linus Torvalds [Wed, 21 Jul 2010 01:29:25 +0000]
Merge branch 'drm-fixes' of git://git./linux/kernel/git/airlied/drm-2.6

* 'drm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6:
  drm/r600: fix possible NULL pointer derefernce
  drm/radeon/kms: add quirk for ASUS HD 3600 board
  include/linux/vgaarb.h: add missing part of include guard
  drm/nouveau: Fix crashes during fbcon init on single head cards.
  drm/nouveau: fix pcirom vbios shadow breakage from acpi rom patch
  drm/radeon/kms: fix shared ddc harder
  drm/i915: enable low power render writes on GEN3 hardware.
  drm/i915: Define MI_ARB_STATE bits
  vmwgfx: return -EFAULT if copy_to_user fails
  fb: handle allocation failure in alloc_apertures()
  drm: radeon: check kzalloc() result
  drm/ttm: Fix build on architectures without AGP
  drm/radeon/kms: fix gtt MC base alignment on rs4xx/rs690/rs740 asics
  drm/radeon/kms: fix possible mis-detection of sideport on rs690/rs740
  drm/radeon/kms: fix legacy tv-out pal mode

9 years agodrm/r600: fix possible NULL pointer derefernce
Alex Deucher [Wed, 21 Jul 2010 00:29:32 +0000]
drm/r600: fix possible NULL pointer derefernce

Reported-by: Alexander Y. Fomichev <git.user@gmail.com>
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>

9 years agodrm/radeon/kms: add quirk for ASUS HD 3600 board
Alex Deucher [Tue, 20 Jul 2010 22:07:22 +0000]
drm/radeon/kms: add quirk for ASUS HD 3600 board

Connector is actually DVI rather than HDMI.

Reported-by: trapDoor <trapdoor6@gmail.com>
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Cc: stable@kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>

9 years agoinclude/linux/vgaarb.h: add missing part of include guard
Doug Goldstein [Tue, 20 Jul 2010 22:22:25 +0000]
include/linux/vgaarb.h: add missing part of include guard

vgaarb.h was missing the #define of the #ifndef at the top for the guard
to prevent multiple #include's from causing re-define errors

Signed-off-by: Doug Goldstein <cardoe@gentoo.org>
Cc: Dave Airlie <airlied@redhat.com>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>

9 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph...
Linus Torvalds [Tue, 20 Jul 2010 23:27:58 +0000]
Merge branch 'for-linus' of git://git./linux/kernel/git/sage/ceph-client

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client:
  ceph: do not include cap/dentry releases in replayed messages
  ceph: reuse request message when replaying against recovering mds
  ceph: fix creation of ipv6 sockets
  ceph: fix parsing of ipv6 addresses
  ceph: fix printing of ipv6 addrs
  ceph: add kfree() to error path
  ceph: fix leak of mon authorizer
  ceph: fix message revocation

9 years agoMerge branch 'linuxdocs' of git://git.kernel.org/pub/scm/linux/kernel/git/rdunlap...
Linus Torvalds [Tue, 20 Jul 2010 23:27:34 +0000]
Merge branch 'linuxdocs' of git://git./linux/kernel/git/rdunlap/linux-docs

* 'linuxdocs' of git://git.kernel.org/pub/scm/linux/kernel/git/rdunlap/linux-docs:
  documentation: fix almost duplicate filenames (IO/io-mapping.txt)

9 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
Linus Torvalds [Tue, 20 Jul 2010 23:26:42 +0000]
Merge git://git./linux/kernel/git/davem/net-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (24 commits)
  bridge: Partially disable netpoll support
  tcp: fix crash in tcp_xmit_retransmit_queue
  IPv6: fix CoA check in RH2 input handler (mip6_rthdr_input())
  ibmveth: lost IRQ while closing/opening device leads to service loss
  rt2x00: Fix lockdep warning in rt2x00lib_probe_dev()
  vhost: avoid pr_err on condition guest can trigger
  ipmr: Don't leak memory if fib lookup fails.
  vhost-net: avoid flush under lock
  net: fix problem in reading sock TX queue
  net/core: neighbour update Oops
  net: skb_tx_hash() fix relative to skb_orphan_try()
  rfs: call sock_rps_record_flow() in tcp_splice_read()
  xfrm: do not assume that template resolving always returns xfrms
  hostap_pci: set dev->base_addr during probe
  axnet_cs: use spin_lock_irqsave in ax_interrupt
  dsa: Fix Kconfig dependencies.
  act_nat: not all of the ICMP packets need an IP header payload
  r8169: incorrect identifier for a 8168dp
  Phonet: fix skb leak in pipe endpoint accept()
  Bluetooth: Update sec_level/auth_type for already existing connections

9 years agovfs: fix RCU-lockdep false positive due to /proc
Paul E. McKenney [Tue, 20 Jul 2010 20:24:34 +0000]
vfs: fix RCU-lockdep false positive due to /proc

If a single-threaded process does a file-descriptor operation, and some
other process accesses that same file descriptor via /proc, the current
rcu_dereference_check_fdtable() can give a false-positive RCU-lockdep
splat due to the reference count being increased by the /proc access after
the reference-count check in fget_light() but before the check in

This commit prevents this false positive by checking for a single-threaded
process.  To avoid #include hell, this commit uses the wrapper for
thread_group_empty(current) defined by rcu_my_thread_group_empty()
provided in a separate commit.

Located-by: Miles Lane <miles.lane@gmail.com>
Located-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
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>

9 years agosdhci-s3c: add missing remove function
Marek Szyprowski [Tue, 20 Jul 2010 20:24:33 +0000]
sdhci-s3c: add missing remove function

System will crash sooner or later once the memory with the code of the
s3c-sdhci.ko module is reused for something else. I really have no idea
how the lack of remove function went unnoticed into the mainline code.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

9 years agoAndres has moved
Andres Salomon [Tue, 20 Jul 2010 20:24:32 +0000]
Andres has moved

My Collabora address is no longer enabled - update the MODULE_AUTHOR
fields of drivers to my current email address.

Signed-off-by: Andres Salomon <dilinger@queued.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

9 years agox86,nobootmem: make alloc_bootmem_node fall back to other node when 32bit numa is...
Yinghai Lu [Tue, 20 Jul 2010 20:24:31 +0000]
x86,nobootmem: make alloc_bootmem_node fall back to other node when 32bit numa is used

Borislav Petkov reported his 32bit numa system has problem:

[    0.000000] Reserving total of 4c00 pages for numa KVA remap
[    0.000000] kva_start_pfn ~ 32800 max_low_pfn ~ 375fe
[    0.000000] max_pfn = 238000
[    0.000000] 8202MB HIGHMEM available.
[    0.000000] 885MB LOWMEM available.
[    0.000000]   mapped low ram: 0 - 375fe000
[    0.000000]   low ram: 0 - 375fe000
[    0.000000] alloc (nid=8 100000 - 7ee00000) (1000000 - ffffffff) 1000 1000 => 34e7000
[    0.000000] alloc (nid=8 100000 - 7ee00000) (1000000 - ffffffff) 200 40 => 34c9d80
[    0.000000] alloc (nid=0 100000 - 7ee00000) (1000000 - ffffffffffffffff) 180 40 => 34e6140
[    0.000000] alloc (nid=1 80000000 - c7e60000) (1000000 - ffffffffffffffff) 240 40 => 80000000
[    0.000000] BUG: unable to handle kernel paging request at 40000000
[    0.000000] IP: [<c2c8cff1>] __alloc_memory_core_early+0x147/0x1d6
[    0.000000] *pdpt = 0000000000000000 *pde = f000ff53f000ff00
[    0.000000] Call Trace:
[    0.000000]  [<c2c8b4f8>] ? __alloc_bootmem_node+0x216/0x22f
[    0.000000]  [<c2c90c9b>] ? sparse_early_usemaps_alloc_node+0x5a/0x10b
[    0.000000]  [<c2c9149e>] ? sparse_init+0x1dc/0x499
[    0.000000]  [<c2c79118>] ? paging_init+0x168/0x1df
[    0.000000]  [<c2c780ff>] ? native_pagetable_setup_start+0xef/0x1bb

looks like it allocates too much high address for bootmem.

Try to cut limit with get_max_mapped()

Reported-by: Borislav Petkov <borislav.petkov@amd.com>
Tested-by: Conny Seidel <conny.seidel@amd.com>
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Cc: <stable@kernel.org> [2.6.34.x]
Cc: Ingo Molnar <mingo@elte.hu>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Lee Schermerhorn <lee.schermerhorn@hp.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

9 years agox86, numa: fix boot without RAM on node0 again
Yinghai Lu [Tue, 20 Jul 2010 20:24:30 +0000]
x86, numa: fix boot without RAM on node0 again

Commit e534c7c5f8d6 ("numa: x86_64: use generic percpu var
numa_node_id() implementation") broke numa systems that don't have ram
on node0 when MEMORY_HOTPLUG is enabled, because cpu_up() will call
cpu_to_node() before per_cpu(numa_node) is setup for APs.

When Node0 doesn't have RAM, on x86, cpus already round it to nearest
node with RAM in x86_cpu_to_node_map.  and per_cpu(numa_node) is not set
up until in c_init for APs.

When later cpu_up() calling cpu_to_node() will get 0 again, and make it
online even there is no RAM on node0.  so later all APs can not booted up,
and later will have panic.

[    1.611101] On node 0 totalpages: 0
[    2.608558] On node 0 totalpages: 0
[    2.612065] Brought up 1 CPUs
[    2.615199] Total of 1 processors activated (3990.31 BogoMIPS).
   93.225341] calling  loop_init+0x0/0x1a4 @ 1
[   93.229314] PERCPU: allocation failed, size=80 align=8, failed to populate
[   93.246539] Pid: 1, comm: swapper Tainted: G        W   2.6.35-rc4-tip-yh-04371-gd64e6c4-dirty #354
[   93.264621] Call Trace:
[   93.266533]  [<ffffffff81125e43>] pcpu_alloc+0x83a/0x8e7
[   93.270710]  [<ffffffff81125f15>] __alloc_percpu+0x10/0x12
[   93.285849]  [<ffffffff8140786c>] alloc_disk_node+0x94/0x16d
[   93.291811]  [<ffffffff81407956>] alloc_disk+0x11/0x13
[   93.306157]  [<ffffffff81503e51>] loop_alloc+0xa7/0x180
[   93.310538]  [<ffffffff8277ef48>] loop_init+0x9b/0x1a4
[   93.324909]  [<ffffffff8277eead>] ? loop_init+0x0/0x1a4
[   93.329650]  [<ffffffff810001f2>] do_one_initcall+0x57/0x136
[   93.345197]  [<ffffffff827486d0>] kernel_init+0x184/0x20e
[   93.348146]  [<ffffffff81034954>] kernel_thread_helper+0x4/0x10
[   93.365194]  [<ffffffff81c7cc3c>] ? restore_args+0x0/0x30
[   93.369305]  [<ffffffff8274854c>] ? kernel_init+0x0/0x20e
[   93.386011]  [<ffffffff81034950>] ? kernel_thread_helper+0x0/0x10
[   93.392047] loop: out of memory

Try to assign per_cpu(numa_node) early

[akpm@linux-foundation.org: tidy up code comment]
Signed-off-by: Yinghai <yinghai@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Denys Vlasenko <vda.linux@googlemail.com>
Acked-by: Lee Schermerhorn <lee.schermerhorn@hp.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

9 years agoedac: mpc85xx: add support for MPC8569 EDAC controllers
Anton Vorontsov [Tue, 20 Jul 2010 20:24:28 +0000]
edac: mpc85xx: add support for MPC8569 EDAC controllers

Simply add a proper ID into the device table.

Signed-off-by: Anton Vorontsov <avorontsov@mvista.com>
Cc: Doug Thompson <dougthompson@xmission.com>
Cc: Peter Tyser <ptyser@xes-inc.com>
Cc: Dave Jiang <djiang@mvista.com>
Cc: Kumar Gala <galak@kernel.crashing.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

9 years agoedac: mpc85xx: fix MPC85xx dependency
Anton Vorontsov [Tue, 20 Jul 2010 20:24:27 +0000]
edac: mpc85xx: fix MPC85xx dependency

Since commit 5753c082f66eca5be81f6bda85c1718c5eea6ada ("powerpc/85xx:
Kconfig cleanup"), there is no MPC85xx Kconfig symbol anymore, so the
driver became non-selectable.

This patch fixes the issue by switching to PPC_85xx symbol.

Signed-off-by: Anton Vorontsov <avorontsov@mvista.com>
Cc: Doug Thompson <dougthompson@xmission.com>
Cc: Peter Tyser <ptyser@xes-inc.com>
Cc: Dave Jiang <djiang@mvista.com>
Cc: Kumar Gala <galak@kernel.crashing.org>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

9 years agomm/vmscan.c: fix mapping use after free
Nick Piggin [Tue, 20 Jul 2010 20:24:25 +0000]
mm/vmscan.c: fix mapping use after free

We need lock_page_nosync() here because we have no reference to the
mapping when taking the page lock.

Signed-off-by: Nick Piggin <npiggin@suse.de>
Reviewed-by: Johannes Weiner <hannes@cmpxchg.org>
Cc: Mel Gorman <mel@csn.ul.ie>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

9 years agoipc/sem.c: bugfix for semop() not reporting successful operation
Manfred Spraul [Tue, 20 Jul 2010 20:24:23 +0000]
ipc/sem.c: bugfix for semop() not reporting successful operation

The last change to improve the scalability moved the actual wake-up out of
the section that is protected by spin_lock(sma->sem_perm.lock).

This means that IN_WAKEUP can be in queue.status even when the spinlock is
acquired by the current task.  Thus the same loop that is performed when
queue.status is read without the spinlock acquired must be performed when
the spinlock is acquired.

Thanks to kamezawa.hiroyu@jp.fujitsu.com for noticing lack of the memory

Addresses https://bugzilla.kernel.org/show_bug.cgi?id=16255

[akpm@linux-foundation.org: clean up kerneldoc, checkpatch warning and whitespace]
Signed-off-by: Manfred Spraul <manfred@colorfullife.com>
Reported-by: Luca Tettamanti <kronos.it@gmail.com>
Tested-by: Luca Tettamanti <kronos.it@gmail.com>
Reported-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Maciej Rutecki <maciej.rutecki@gmail.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

9 years agodrm/nouveau: Fix crashes during fbcon init on single head cards.
Francisco Jerez [Sat, 10 Jul 2010 15:37:00 +0000]
drm/nouveau: Fix crashes during fbcon init on single head cards.

this fixes a regression since the fbcon rework.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>

9 years agodrm/nouveau: fix pcirom vbios shadow breakage from acpi rom patch
Ben Skeggs [Mon, 12 Jul 2010 03:15:44 +0000]
drm/nouveau: fix pcirom vbios shadow breakage from acpi rom patch

On nv50 it became impossible to attempt a PCI ROM shadow of the VBIOS,
which will break some setups.

This patch also removes the different ordering of shadow methods for
pre-nv50 chipsets.  The reason for the different ordering was paranoia,
but it should hopefully be OK to try shadowing PRAMIN first.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>

9 years agodrm/radeon/kms: fix shared ddc harder
Alex Deucher [Tue, 20 Jul 2010 15:27:54 +0000]
drm/radeon/kms: fix shared ddc harder

This fixes a regression caused by b2ea4aa67bfd084834edd070e0a4a47857d6db59
due to the way shared ddc with multiple digital connectors was handled.

You generally have two cases where DDC lines are shared:

HDMI + VGA is easy to deal with because you can check the EDID for the
to see if the attached monitor is digital.  A shared DDC line with two
digital connectors is more complex.  You can't use the hdmi bits in the
EDID since they may not be there with DVI<->HDMI adapters.  In this case
all we can do is check the HPD pins to see which is connected as we have
no way of knowing using the EDID.

Reported-by: trapdoor6@gmail.com
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Cc: stable@kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>

9 years agodocumentation: fix almost duplicate filenames (IO/io-mapping.txt)
Randy Dunlap [Mon, 19 Jul 2010 22:20:27 +0000]
documentation: fix almost duplicate filenames (IO/io-mapping.txt)

Having both IO-mapping.txt and io-mapping.txt in Documentation/
was confusing and/or bothersome to some people, so rename
IO-mapping.txt to bus-virt-phys-mapping.txt.  Also update
Documentation/00-INDEX for both of these files.

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Cc: Kees Bakker <kees.bakker@xs4all.nl>
Cc: Keith Packard <keithp@keithp.com>

9 years agoMerge git://git.infradead.org/users/cbou/battery-2.6.35
Linus Torvalds [Tue, 20 Jul 2010 15:22:15 +0000]
Merge git://git.infradead.org/users/cbou/battery-2.6.35

* git://git.infradead.org/users/cbou/battery-2.6.35:
  ds2782_battery: Fix ds2782_get_capacity return value

9 years agoASoC: Select wm_hubs automatically for WM8994
Chanwoo Choi [Tue, 20 Jul 2010 05:28:33 +0000]
ASoC: Select wm_hubs automatically for WM8994

Otherwise all machine drivers need to do so.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>

9 years agobridge: Partially disable netpoll support
Herbert Xu [Mon, 19 Jul 2010 19:26:45 +0000]
bridge: Partially disable netpoll support

The new netpoll code in bridging contains use-after-free bugs
that are non-trivial to fix.

This patch fixes this by removing the code that uses skbs after
they're freed.

As a consequence, this means that we can no longer call bridge
from the netpoll path, so this patch also removes the controller
function in order to disable netpoll.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Signed-off-by: David S. Miller <davem@davemloft.net>

9 years agodrm/i915: enable low power render writes on GEN3 hardware.
Dave Airlie [Tue, 20 Jul 2010 03:15:31 +0000]
drm/i915: enable low power render writes on GEN3 hardware.

A lot of 945GMs have had stability issues for a long time, this manifested as X hangs, blitter engine hangs, and lots of crashes.

one such report is at:

along with numerous distro bugzillas.

This only took a week of digging and hair ripping to figure out.

Tracked down and tested on a 945GM Lenovo T60,
previously running
x11perf -copypixwin500
x11perf -copywinpix500
repeatedly would cause the GPU to wedge within 4 or 5 tries, with random busy bits set.

After this patch no hangs were observed.

cc: stable@kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>

9 years agodrm/i915: Define MI_ARB_STATE bits
Keith Packard [Tue, 20 Jul 2010 04:12:35 +0000]
drm/i915: Define MI_ARB_STATE bits

The i915 memory arbiter has a register full of configuration
bits which are currently not defined in the driver header file.

Signed-off-by: Keith Packard <keithp@keithp.com>
cc: stable@kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>

9 years agovmwgfx: return -EFAULT if copy_to_user fails
Dan Carpenter [Sat, 10 Jul 2010 14:30:04 +0000]
vmwgfx: return -EFAULT if copy_to_user fails

copy_to_user() returns the number of bytes remaining to be copied, but
we want to return a negative error code.  This gets copied to user

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>

9 years agofb: handle allocation failure in alloc_apertures()
Dan Carpenter [Thu, 15 Jul 2010 08:39:47 +0000]
fb: handle allocation failure in alloc_apertures()

If the kzalloc() fails we should return NULL.  All the places that call
alloc_apertures() check for this already.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Acked-by: James Simmons <jsimmons@infradead.org>
Acked-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>

9 years agodrm: radeon: check kzalloc() result
Kulikov Vasiliy [Fri, 16 Jul 2010 16:13:33 +0000]
drm: radeon: check kzalloc() result

If kzalloc() fails exit with -ENOMEM.

Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>