pandora-kernel.git
11 years agoALSA: ens1370: Reduce ifdefs
Takashi Iwai [Wed, 12 Sep 2012 13:46:20 +0000 (15:46 +0200)]
ALSA: ens1370: Reduce ifdefs

... just by defining CHIP_NAME and string concats.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: ctxfi: Fix mono channel map to UNKNOWN
Takashi Iwai [Wed, 12 Sep 2012 13:19:20 +0000 (15:19 +0200)]
ALSA: ctxfi: Fix mono channel map to UNKNOWN

To follow the previous commit.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: pcm - Use UNKNOWN chmap for mono streams
Takashi Iwai [Tue, 11 Sep 2012 12:24:43 +0000 (14:24 +0200)]
ALSA: pcm - Use UNKNOWN chmap for mono streams

In general, mono streams have no dedicated speaker assignment, thus
they should be rather marked as UNKNOWN position.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Allow 3/5/7 channel map for HDMI/DP
Takashi Iwai [Mon, 10 Sep 2012 14:08:40 +0000 (16:08 +0200)]
ALSA: hda - Allow 3/5/7 channel map for HDMI/DP

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: Follow channel position definitions to alsa-lib mixer
Takashi Iwai [Tue, 21 Aug 2012 12:47:18 +0000 (14:47 +0200)]
ALSA: Follow channel position definitions to alsa-lib mixer

There is already a set of channel position definitions in alsa-lib
mixer.h, and it'd be more practical to keep the same order for the
PCM channel map, too.  The value is shifted with 1 to keep zero for
UNKNOWN.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: Remove VOLATILE flag from chmap ctls
Takashi Iwai [Tue, 21 Aug 2012 12:49:47 +0000 (14:49 +0200)]
ALSA: Remove VOLATILE flag from chmap ctls

The VOLATILE flag was added to control elements by
snd_pcm_add_chmap_ctls() just because I didn't want to have a
side-effect of "alsactl restore".  But now the set operation doesn't
allow to change the value unless the PCM stream is in PREAPRED state,
there is no reason to keep this flag.  Let's rip it off.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: ctxfi: Implement channel maps
Takashi Iwai [Fri, 3 Aug 2012 16:03:17 +0000 (18:03 +0200)]
ALSA: ctxfi: Implement channel maps

Assign the multi-channel map to front PCM, and other channel map to
each other channel PCM.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: cmipci: Implement channel mapping
Takashi Iwai [Fri, 3 Aug 2012 16:02:38 +0000 (18:02 +0200)]
ALSA: cmipci: Implement channel mapping

Simply enable the channel map according to the h/w capability.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: Implement channel maps for standard onboard AC97 drivers
Takashi Iwai [Fri, 3 Aug 2012 16:01:40 +0000 (18:01 +0200)]
ALSA: Implement channel maps for standard onboard AC97 drivers

Just set the channel maps depending on the hardware availability.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: ac97: Implement channel map workaround for ALC650
Takashi Iwai [Fri, 3 Aug 2012 15:59:36 +0000 (17:59 +0200)]
ALSA: ac97: Implement channel map workaround for ALC650

ALC650 has a channel swap option between surround and CLFE channels,
so we need to tweak the channel maps dynamically depending on the
register bit.

Now struct snd_ac97 can contain chmap pointers for playback and
capture.  The driver may store these and let ac97 driver changing the
channel mapping dynamically.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Fix channel maps for Nvidia 7x 8ch HDMI codecs
Takashi Iwai [Wed, 1 Aug 2012 10:17:41 +0000 (12:17 +0200)]
ALSA: hda - Fix channel maps for Nvidia 7x 8ch HDMI codecs

Some old Nvidia HDMI codecs with 8ch support only 2/8 or
2/6/8 channels and with the fixed CLFE-first map.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Provide the proper channel mapping for generic HDMI driver
Takashi Iwai [Tue, 31 Jul 2012 09:36:00 +0000 (11:36 +0200)]
ALSA: hda - Provide the proper channel mapping for generic HDMI driver

... instead of the standard fixed channel maps.
The generic HDMI is based on the audio infoframe, and its configuration
can be selected via CA bits.  Thus we need a translation between the
CA index and the verbose channel map list.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Add standard channel maps
Takashi Iwai [Tue, 31 Jul 2012 09:35:35 +0000 (11:35 +0200)]
ALSA: hda - Add standard channel maps

Although HD-audio allows pair-wise channel configurations, only the
fixed channel positions are used in this version.  In future, this can
be changed and allow user to modify the channel positions.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: Add a documentation for channel mapping API
Takashi Iwai [Wed, 15 Aug 2012 14:06:43 +0000 (16:06 +0200)]
ALSA: Add a documentation for channel mapping API

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: PCM: channel mapping API implementation
Takashi Iwai [Fri, 27 Jul 2012 16:27:00 +0000 (18:27 +0200)]
ALSA: PCM: channel mapping API implementation

This patch implements the basic data types for the standard channel
mapping API handling.

- The definitions of the channel positions and the new TLV types are
  added in sound/asound.h and sound/tlv.h, so that they can be
  referred from user-space.

- Introduced a new helper function snd_pcm_add_chmap_ctls() to create
  control elements representing the channel maps for each PCM
  (sub)stream.

- Some standard pre-defined channel maps are provided for
  convenience.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: control: Fix missing VOLATILE flag at creating controls
Takashi Iwai [Mon, 30 Jul 2012 11:47:07 +0000 (13:47 +0200)]
ALSA: control: Fix missing VOLATILE flag at creating controls

The SNDRV_CTL_ELEM_ACCESS_VOLATILE bit flag wasn't properly inherited
at creating control elements via snd_ctl_new1().

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Move non-PCM check to per_pin in patch_hdmi.c
Takashi Iwai [Thu, 6 Sep 2012 15:42:08 +0000 (17:42 +0200)]
ALSA: hda - Move non-PCM check to per_pin in patch_hdmi.c

Recently the check for non-PCM stream state was added to the generic
HDMI driver code.  But this check should be done rather to each pin
instead of each converter.  Otherwise when a different converter is
assigned at the next open, the audio infoframe can be inconsistent
with the setup using the previous converter.

For fixing this issue, this patch moves the state of the current
non-PCM status from per_cvt to per_pin.  (In addition an unused
argument cvt_nid is stripped from hdmi_setup_channel_mapping())

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - fix control names for multiple speaker out on IDT/STAC
David Henningsson [Thu, 6 Sep 2012 09:17:58 +0000 (11:17 +0200)]
ALSA: hda - fix control names for multiple speaker out on IDT/STAC

For multiple speaker outs, the names were previously
"Speaker,0", "Speaker,1", "Center"/"LFE", "Speaker,3". This is
inconsistent, confusing, and is not picked up correctly by PulseAudio.
Instead use "Front", "Surround", "Center"/"LFE", "Side" which
is more standard.

BugLink: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1046734
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: HDMI - Setup channel mapping for non_pcm audio
Wang Xingchao [Thu, 6 Sep 2012 02:02:38 +0000 (10:02 +0800)]
ALSA: HDMI - Setup channel mapping for non_pcm audio

For HBR stream test, use straight channel mapping way.
when switched back to "speaker-test -c8", even the audio
infoframe is up-to-date, there should be correct channel mapping setup.

Signed-off-by: Wang Xingchao <xingchao.wang@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: HDMI - Enable HBR feature on Intel chips
Wang Xingchao [Thu, 6 Sep 2012 02:02:37 +0000 (10:02 +0800)]
ALSA: HDMI - Enable HBR feature on Intel chips

HDMI channel remapping apparently effects HBR packets on Intel's chips.
For compressed non-PCM audio, use "straight-through" channel mapping.
For uncompressed multi-channel pcm audio, use normal channel mapping.

Signed-off-by: Wang Xingchao <xingchao.wang@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: HDMI - Fix channel_allocation array wrong order
Wang Xingchao [Thu, 6 Sep 2012 02:02:36 +0000 (10:02 +0800)]
ALSA: HDMI - Fix channel_allocation array wrong order

The array channel_allocations[] is an ordered list, add function to get
correct order by ca_index.

Signed-off-by: Wang Xingchao <xingchao.wang@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoMerge branch 'fixes' of git://git.alsa-project.org/alsa-kernel into for-next
Takashi Iwai [Wed, 5 Sep 2012 07:17:31 +0000 (09:17 +0200)]
Merge branch 'fixes' of git://git.alsa-project.org/alsa-kernel into for-next

11 years agoALSA: emu10k1: use list_move_tail instead of list_del/list_add_tail
Wei Yongjun [Wed, 5 Sep 2012 07:00:15 +0000 (15:00 +0800)]
ALSA: emu10k1: use list_move_tail instead of list_del/list_add_tail

Using list_move_tail() instead of list_del() + list_add_tail().

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: opl4: use list_move_tail instead of list_del/list_add_tail
Wei Yongjun [Wed, 5 Sep 2012 06:33:21 +0000 (14:33 +0800)]
ALSA: opl4: use list_move_tail instead of list_del/list_add_tail

Using list_move_tail() instead of list_del() + list_add_tail().

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Acked-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: remove the main version information
Jaroslav Kysela [Tue, 4 Sep 2012 09:21:45 +0000 (11:21 +0200)]
ALSA: remove the main version information

Remove the main ALSA version number from the kernel ALSA driver.
The ALSA driver package release diverges from the upstream. This may
confuse users to see the same ALSA version for many kernel releases
and this version lost it's original purpose and connection.

The "ioctl" APIs have own version numbers, so the user space may check
for specific API changes only.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
11 years agoALSA: snd-usb: Add quirks for Playback Designs devices
Daniel Mack [Tue, 4 Sep 2012 08:23:07 +0000 (10:23 +0200)]
ALSA: snd-usb: Add quirks for Playback Designs devices

Playback Designs' USB devices have some hardware limitations on their
USB interface. In particular:

 - They need a 20ms delay after each class compliant request as the
   hardware ACKs the USB packets before the device is actually ready
   for the next command. Sending data immediately will result in buffer
   overflows in the hardware.
 - The devices send bogus feedback data at the start of each stream
   which confuse the feedback format auto-detection.

This patch introduces a new quirks hook that is called after each
control packet and which adds a delay for all devices that match
Playback Designs' USB VID for now.

In addition, it adds a counter to snd_usb_endpoint to drop received
packets on the floor. Another new quirks function that is called once
an endpoint is started initializes that counter for these devices on
their sync endpoint.

Signed-off-by: Daniel Mack <zonque@gmail.com>
Reported-and-tested-by: Andreas Koch <andreas@akdesigninc.com>
Supported-by: Demian Martin <demianm_1@yahoo.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: USB: Support for (original) Xbox Communicator
Marko Friedemann [Mon, 3 Sep 2012 08:12:40 +0000 (10:12 +0200)]
ALSA: USB: Support for (original) Xbox Communicator

Added support for Xbox Communicator to USB quirks.

Signed-off-by: Marko Friedemann <mfr@bmx-chemnitz.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: fix possible memory leak in snd_mixer_oss_build_input()
Wei Yongjun [Sun, 2 Sep 2012 14:10:27 +0000 (22:10 +0800)]
ALSA: fix possible memory leak in snd_mixer_oss_build_input()

uinfo has been allocated in this function and should be
freed before leaving from the error handling cases.

spatch with a semantic match is used to found this problem.
(http://coccinelle.lip6.fr/)

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: Remove the last mention of SNDRV_MAIN_OBJECT_FILE
Josh Triplett [Mon, 3 Sep 2012 03:04:17 +0000 (20:04 -0700)]
ALSA: Remove the last mention of SNDRV_MAIN_OBJECT_FILE

SNDRV_MAIN_OBJECT_FILE hasn't done anything since the pre-git days, and
the only remaining reference occurs as a #define in sound/last.c.  Drop
that last mention of it.

Signed-off-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Clean up redundant FG checks
Takashi Iwai [Fri, 31 Aug 2012 14:54:38 +0000 (07:54 -0700)]
ALSA: hda - Clean up redundant FG checks

Just refactoring, no functional changes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Yet another fix for D3 stop-clock refcounting
Takashi Iwai [Fri, 31 Aug 2012 14:46:56 +0000 (07:46 -0700)]
ALSA: hda - Yet another fix for D3 stop-clock refcounting

The call of pm_notify callback in snd_hda_codec_free() should be with
the check of the current state whether pm_notify(false) is called or
not, instead of codec->power_on check.

For improving the code readability and fixing this inconsistency,
codec->d3_stop_clk_ok is renamed to codec->pm_down_notified, and this
flag is set only when runtime PM down is called.  The new name reflects
to a more direct purpose of the flag.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: cs5530: Fix resource leak in error path
Takashi Iwai [Thu, 30 Aug 2012 20:21:00 +0000 (13:21 -0700)]
ALSA: cs5530: Fix resource leak in error path

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=44741

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: korg1212: Fix reverted min/max ADC sense range
Takashi Iwai [Thu, 30 Aug 2012 14:57:38 +0000 (07:57 -0700)]
ALSA: korg1212: Fix reverted min/max ADC sense range

k1212MinADCSens and k1212MaxADCSens are defined wrongly.
The max must be greater than the min by obvious reason.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=46561

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Optimize bitfield usage in struct hda_codec
Takashi Iwai [Tue, 28 Aug 2012 23:39:25 +0000 (16:39 -0700)]
ALSA: hda - Optimize bitfield usage in struct hda_codec

Move up a few bitfields to be packed into a single int.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Clean up CONFIG_SND_HDA_POWER_SAVE
Takashi Iwai [Fri, 24 Aug 2012 16:38:08 +0000 (18:38 +0200)]
ALSA: hda - Clean up CONFIG_SND_HDA_POWER_SAVE

CONFIG_SND_HDA_POWER_SAVE is no longer an experimental feature and its
behavior can be well controlled via the default value and module
parameter.  Let's just replace it with the standard CONFIG_PM.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Fix D3 clock stop check for codecs with own set_power_state op
Takashi Iwai [Tue, 28 Aug 2012 16:59:20 +0000 (09:59 -0700)]
ALSA: hda - Fix D3 clock stop check for codecs with own set_power_state op

When a codec provides its own set_power_state op, the D3-clock-stop
isn't checked correctly.  And the recent changes for repeating the
state-setting operation isn't applied to such a codec, too.

This patch fixes these issues by moving the call of codec's own op to
the place where the generic power-set operation is done, and move the
power-state synchronization code out of
snd_hda_set_power_state_to_all() so that it can be called always at
the end of power-up/down sequence, and updates the D3 clock-stop flag
properly.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Fix runtime PM leftover refcounts
Takashi Iwai [Tue, 28 Aug 2012 16:14:29 +0000 (09:14 -0700)]
ALSA: hda - Fix runtime PM leftover refcounts

When the HD-audio is removed, it leaves the refcounts when codecs are
powered up (usually yes) in the destructor.  For fixing the unbalance,
and cleaning up the code mess, this patch changes the following:
- change pm_notify callback to take the explicit power on/off state,
- check of D3 stop-clock and keep_link_on flags is moved to the caller
  side,
- call pm_notify callback in snd_hda_codec_new() and snd_hda_codec_free()
  so that the refcounts are proprely updated.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux...
Linus Torvalds [Wed, 29 Aug 2012 18:36:22 +0000 (11:36 -0700)]
Merge branch 'for-linus' of git://git./linux/kernel/git/mason/linux-btrfs

Pull btrfs fixes from Chris Mason:
 "I've split out the big send/receive update from my last pull request
  and now have just the fixes in my for-linus branch.  The send/recv
  branch will wander over to linux-next shortly though.

  The largest patches in this pull are Josef's patches to fix DIO
  locking problems and his patch to fix a crash during balance.  They
  are both well tested.

  The rest are smaller fixes that we've had queued.  The last rc came
  out while I was hacking new and exciting ways to recover from a
  misplaced rm -rf on my dev box, so these missed rc3."

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs: (25 commits)
  Btrfs: fix that repair code is spuriously executed for transid failures
  Btrfs: fix ordered extent leak when failing to start a transaction
  Btrfs: fix a dio write regression
  Btrfs: fix deadlock with freeze and sync V2
  Btrfs: revert checksum error statistic which can cause a BUG()
  Btrfs: remove superblock writing after fatal error
  Btrfs: allow delayed refs to be merged
  Btrfs: fix enospc problems when deleting a subvol
  Btrfs: fix wrong mtime and ctime when creating snapshots
  Btrfs: fix race in run_clustered_refs
  Btrfs: don't run __tree_mod_log_free_eb on leaves
  Btrfs: increase the size of the free space cache
  Btrfs: barrier before waitqueue_active
  Btrfs: fix deadlock in wait_for_more_refs
  btrfs: fix second lock in btrfs_delete_delayed_items()
  Btrfs: don't allocate a seperate csums array for direct reads
  Btrfs: do not strdup non existent strings
  Btrfs: do not use missing devices when showing devname
  Btrfs: fix that error value is changed by mistake
  Btrfs: lock extents as we map them in DIO
  ...

11 years agoMerge git://www.linux-watchdog.org/linux-watchdog
Linus Torvalds [Wed, 29 Aug 2012 18:35:00 +0000 (11:35 -0700)]
Merge git://www.linux-watchdog.org/linux-watchdog

Pull watchdog fixes from Wim Van Sebroeck:
 "This will fix a warning for watchdog-test.c and it will remove a
  duplicate include of delay.h"

* git://www.linux-watchdog.org/linux-watchdog:
  watchdog: da9052: Remove duplicate inclusion of delay.h
  watchdog: fix watchdog-test.c build warning

11 years agomm, slab: lock the correct nodelist after reenabling irqs
David Rientjes [Wed, 29 Aug 2012 02:57:21 +0000 (19:57 -0700)]
mm, slab: lock the correct nodelist after reenabling irqs

cache_grow() can reenable irqs so the cpu (and node) can change, so ensure
that we take list_lock on the correct nodelist.

This fixes an issue with commit 072bb0aa5e06 ("mm: sl[au]b: add
knowledge of PFMEMALLOC reserve pages") where list_lock for the wrong
node was taken after growing the cache.

Reported-and-tested-by: Haggai Eran <haggaie@mellanox.com>
Signed-off-by: David Rientjes <rientjes@google.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
11 years agowatchdog: da9052: Remove duplicate inclusion of delay.h
Sachin Kamat [Tue, 7 Aug 2012 09:44:12 +0000 (15:14 +0530)]
watchdog: da9052: Remove duplicate inclusion of delay.h

delay.h header file was included twice.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
11 years agowatchdog: fix watchdog-test.c build warning
Randy Dunlap [Mon, 23 Jul 2012 17:46:11 +0000 (10:46 -0700)]
watchdog: fix watchdog-test.c build warning

Fix compiler warning by making the function static:

Documentation/watchdog/src/watchdog-test.c:34:6: warning: no previous prototype for 'term'

Signed-off-by: Randy Dunlap <rdunlap@xenotime.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
11 years agoALSA: usb-audio: Remove obsoleted fields in struct snd_usb_substream
Takashi Iwai [Tue, 28 Aug 2012 23:27:26 +0000 (16:27 -0700)]
ALSA: usb-audio: Remove obsoleted fields in struct snd_usb_substream

The two entries are duplicated in struct snd_usb_endpoint.
Seems forgotten in the last clean-up.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoBtrfs: fix that repair code is spuriously executed for transid failures
Stefan Behrens [Fri, 10 Aug 2012 14:58:21 +0000 (08:58 -0600)]
Btrfs: fix that repair code is spuriously executed for transid failures

If verify_parent_transid() fails for all mirrors, the current code
calls repair_io_failure() anyway which means:
- that the disk block is rewritten without repairing anything and
- that a kernel log message is printed which misleadingly claims
  that a read error was corrected.

This is an example:
parent transid verify failed on 615015833600 wanted 110423 found 110424
parent transid verify failed on 615015833600 wanted 110423 found 110424
btrfs read error corrected: ino 1 off 615015833600 (dev /dev/...)

It is wrong to ignore the results from verify_parent_transid() and to
call repair_eb_io_failure() when the verification of the transids failed.
This commit fixes the issue.

Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
11 years agoBtrfs: fix ordered extent leak when failing to start a transaction
Liu Bo [Wed, 22 Aug 2012 03:13:25 +0000 (21:13 -0600)]
Btrfs: fix ordered extent leak when failing to start a transaction

We cannot just return error before freeing ordered extent and releasing reserved
space when we fail to start a transacion.

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
11 years agoBtrfs: fix a dio write regression
Liu Bo [Thu, 23 Aug 2012 02:10:38 +0000 (20:10 -0600)]
Btrfs: fix a dio write regression

This bug is introduced by commit 3b8bde746f6f9bd36a9f05f5f3b6e334318176a9
(Btrfs: lock extents as we map them in DIO).

In dio write, we should unlock the section which we didn't do IO on in case that
we fall back to buffered write.  But we need to not only unlock the section
but also cleanup reserved space for the section.

This bug was found while running xfstests 133, with this 133 no longer complains.

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
11 years agoBtrfs: fix deadlock with freeze and sync V2
Josef Bacik [Fri, 24 Aug 2012 18:53:03 +0000 (12:53 -0600)]
Btrfs: fix deadlock with freeze and sync V2

We can deadlock with freeze right now because we unconditionally start a
transaction in our ->sync_fs() call.  To fix this just check and see if we
have a running transaction to commit.  This saves us from the deadlock
because at this point we'll have the umount sem for the sb so we're safe
from freezes coming in after we've done our check.  With this patch the
freeze xfstests no longer deadlocks.  Thanks,

Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
11 years agoBtrfs: revert checksum error statistic which can cause a BUG()
Stefan Behrens [Mon, 27 Aug 2012 14:30:03 +0000 (08:30 -0600)]
Btrfs: revert checksum error statistic which can cause a BUG()

Commit 442a4f6308e694e0fa6025708bd5e4e424bbf51c added btrfs device
statistic counters for detected IO and checksum errors to Linux 3.5.
The statistic part that counts checksum errors in
end_bio_extent_readpage() can cause a BUG() in a subfunction:
"kernel BUG at fs/btrfs/volumes.c:3762!"
That part is reverted with the current patch.
However, the counting of checksum errors in the scrub context remains
active, and the counting of detected IO errors (read, write or flush
errors) in all contexts remains active.

Cc: stable <stable@vger.kernel.org> # 3.5
Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
11 years agoBtrfs: remove superblock writing after fatal error
Stefan Behrens [Wed, 1 Aug 2012 11:45:52 +0000 (05:45 -0600)]
Btrfs: remove superblock writing after fatal error

With commit acce952b0, btrfs was changed to flag the filesystem with
BTRFS_SUPER_FLAG_ERROR and switch to read-only mode after a fatal
error happened like a write I/O errors of all mirrors.
In such situations, on unmount, the superblock is written in
btrfs_error_commit_super(). This is done with the intention to be able
to evaluate the error flag on the next mount. A warning is printed
in this case during the next mount and the log tree is ignored.

The issue is that it is possible that the superblock points to a root
that was not written (due to write I/O errors).
The result is that the filesystem cannot be mounted. btrfsck also does
not start and all the other btrfs-progs tools fail to start as well.
However, mount -o recovery is working well and does the right things
to recover the filesystem (i.e., don't use the log root, clear the
free space cache and use the next mountable root that is stored in the
root backup array).

This patch removes the writing of the superblock when
BTRFS_SUPER_FLAG_ERROR is set, and removes the handling of the error
flag in the mount function.

These lines can be used to reproduce the issue (using /dev/sdm):
SCRATCH_DEV=/dev/sdm
SCRATCH_MNT=/mnt
echo 0 25165824 linear $SCRATCH_DEV 0 | dmsetup create foo
ls -alLF /dev/mapper/foo
mkfs.btrfs /dev/mapper/foo
mount /dev/mapper/foo $SCRATCH_MNT
echo bar > $SCRATCH_MNT/foo
sync
echo 0 25165824 error | dmsetup reload foo
dmsetup resume foo
ls -alF $SCRATCH_MNT
touch $SCRATCH_MNT/1
ls -alF $SCRATCH_MNT
sleep 35
echo 0 25165824 linear $SCRATCH_DEV 0 | dmsetup reload foo
dmsetup resume foo
sleep 1
umount $SCRATCH_MNT
btrfsck /dev/mapper/foo
dmsetup remove foo

Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de>
Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net>
11 years agoBtrfs: allow delayed refs to be merged
Josef Bacik [Tue, 7 Aug 2012 20:00:32 +0000 (16:00 -0400)]
Btrfs: allow delayed refs to be merged

Daniel Blueman reported a bug with fio+balance on a ramdisk setup.
Basically what happens is the balance relocates a tree block which will drop
the implicit refs for all of its children and adds a full backref.  Once the
block is relocated we have to add the implicit refs back, so when we cow the
block again we add the implicit refs for its children back.  The problem
comes when the original drop ref doesn't get run before we add the implicit
refs back.  The delayed ref stuff will specifically prefer ADD operations
over DROP to keep us from freeing up an extent that will have references to
it, so we try to add the implicit ref before it is actually removed and we
panic.  This worked fine before because the add would have just canceled the
drop out and we would have been fine.  But the backref walking work needs to
be able to freeze the delayed ref stuff in time so we have this ever
increasing sequence number that gets attached to all new delayed ref updates
which makes us not merge refs and we run into this issue.

So to fix this we need to merge delayed refs.  So everytime we run a
clustered ref we need to try and merge all of its delayed refs.  The backref
walking stuff locks the delayed ref head before processing, so if we have it
locked we are safe to merge any refs inside of the sequence number.  If
there is no sequence number we can merge all refs.  Doing this not only
fixes our bug but keeps the delayed ref code from adding and removing
useless refs and batching together multiple refs into one search instead of
one search per delayed ref, which will really help our commit times.  I ran
this with Daniels test and 276 and I haven't seen any problems.  Thanks,

Reported-by: Daniel J Blueman <daniel@quora.org>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
11 years agoBtrfs: fix enospc problems when deleting a subvol
Josef Bacik [Wed, 8 Aug 2012 16:12:59 +0000 (10:12 -0600)]
Btrfs: fix enospc problems when deleting a subvol

Subvol delete is a special kind of awful where we use the global reserve to
cover the ENOSPC requirements.  The problem is once we're done removing
everything we do a btrfs_update_inode(), which by default will try to do the
delayed update stuff which will use it's own reserve.  There will be no
space in this reserve and we'll return ENOSPC.  So instead use
btrfs_update_inode_fallback() which will just fallback to updating the inode
item in the case of enospc.  This is fine because the global reserve covers
the space requirements for this.  With this patch I can now delete a subvol
on a problem image Dave Sterba sent me.  Thanks,

Reported-by: David Sterba <dave@jikos.cz>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
11 years agoBtrfs: fix wrong mtime and ctime when creating snapshots
Miao Xie [Thu, 9 Aug 2012 03:39:36 +0000 (21:39 -0600)]
Btrfs: fix wrong mtime and ctime when creating snapshots

When we created a new snapshot, the mtime and ctime of its parent directory
were not updated. Fix it.

Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
11 years agoBtrfs: fix race in run_clustered_refs
Arne Jansen [Thu, 9 Aug 2012 06:16:53 +0000 (00:16 -0600)]
Btrfs: fix race in run_clustered_refs

With commit

commit d1270cd91f308c9d22b2804720c36ccd32dbc35e
Author: Arne Jansen <sensille@gmx.net>
Date:   Tue Sep 13 15:16:43 2011 +0200

     Btrfs: put back delayed refs that are too new

I added a window where the delayed_ref's head->ref_mod code can diverge
from the sum of the remaining refs, because we release the head->mutex
in the middle. This leads to btrfs_lookup_extent_info returning wrong
numbers. This patch fixes this by adjusting the head's ref_mod with each
delayed ref we run.

Signed-off-by: Arne Jansen <sensille@gmx.net>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
11 years agoBtrfs: don't run __tree_mod_log_free_eb on leaves
Chris Mason [Tue, 7 Aug 2012 19:34:49 +0000 (15:34 -0400)]
Btrfs: don't run __tree_mod_log_free_eb on leaves

When we split a leaf, we may end up inserting a new root on top of that
leaf.  The reflog code was incorrectly assuming the old root was always
a node.  This makes sure we skip over leaves.

Signed-off-by: Chris Mason <chris.mason@fusionio.com>
11 years agoBtrfs: increase the size of the free space cache
Josef Bacik [Mon, 6 Aug 2012 19:46:38 +0000 (13:46 -0600)]
Btrfs: increase the size of the free space cache

Arne was complaining about the space cache having mismatching generation
numbers when debugging a deadlock.  This is because we can run out of space
in our preallocated range for our space cache if you have a pretty
fragmented amount of space in your pinned space.  So just increase the
amount of space we preallocate for space cache so we can be sure to have
enough space.  This will only really affect data ranges since their the only
chunks that end up larger than 256MB.  Thanks,

Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
11 years agoBtrfs: barrier before waitqueue_active
Josef Bacik [Wed, 1 Aug 2012 19:36:24 +0000 (15:36 -0400)]
Btrfs: barrier before waitqueue_active

We need a barrir before calling waitqueue_active otherwise we will miss
wakeups.  So in places that do atomic_dec(); then atomic_read() use
atomic_dec_return() which imply a memory barrier (see memory-barriers.txt)
and then add an explicit memory barrier everywhere else that need them.
Thanks,

Signed-off-by: Josef Bacik <jbacik@fusionio.com>
11 years agoBtrfs: fix deadlock in wait_for_more_refs
Arne Jansen [Mon, 6 Aug 2012 20:18:51 +0000 (14:18 -0600)]
Btrfs: fix deadlock in wait_for_more_refs

Commit a168650c introduced a waiting mechanism to prevent busy waiting in
btrfs_run_delayed_refs. This can deadlock with btrfs_run_ordered_operations,
where a tree_mod_seq is held while waiting for the io to complete, while
the end_io calls btrfs_run_delayed_refs.
This whole mechanism is unnecessary. If not enough runnable refs are
available to satisfy count, just return as count is more like a guideline
than a strict requirement.
In case we have to run all refs, commit transaction makes sure that no
other threads are working in the transaction anymore, so we just assert
here that no refs are blocked.

Signed-off-by: Arne Jansen <sensille@gmx.net>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
11 years agobtrfs: fix second lock in btrfs_delete_delayed_items()
Fengguang Wu [Sat, 4 Aug 2012 07:45:02 +0000 (01:45 -0600)]
btrfs: fix second lock in btrfs_delete_delayed_items()

Fix a real bug caught by coccinelle.

fs/btrfs/delayed-inode.c:1013:1-11: second lock on line 1013

Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
11 years agoBtrfs: don't allocate a seperate csums array for direct reads
Josef Bacik [Fri, 3 Aug 2012 20:49:19 +0000 (16:49 -0400)]
Btrfs: don't allocate a seperate csums array for direct reads

We've been allocating a big array for csums instead of storing them in the
io_tree like we do for buffered reads because previously we were locking the
entire range, so we didn't have an extent state for each sector of the
range.  But now that we do the range locking as we map the buffers we can
limit the mapping lenght to sectorsize and use the private part of the
io_tree for our csums.  This allows us to avoid an extra memory allocation
for direct reads which could incur latency.  Thanks,

Signed-off-by: Josef Bacik <jbacik@fusionio.com>
11 years agoBtrfs: do not strdup non existent strings
Josef Bacik [Thu, 2 Aug 2012 14:23:59 +0000 (10:23 -0400)]
Btrfs: do not strdup non existent strings

When we close devices we add back empty devices for some reason that escapes
me.  In the case of a missing dev we don't allocate an rcu_string for it's
name, so check to see if the device has a name and if it doesn't don't
bother strdup()'ing it.  Thanks,

Signed-off-by: Josef Bacik <jbacik@fusionio.com>
11 years agoBtrfs: do not use missing devices when showing devname
Josef Bacik [Thu, 2 Aug 2012 14:22:20 +0000 (10:22 -0400)]
Btrfs: do not use missing devices when showing devname

If you do the following

mkfs.btrfs /dev/sdb /dev/sdc
rmmod btrfs
dd if=/dev/zero of=/dev/sdb bs=1M count=1
mount -o degraded /dev/sdc /mnt/btrfs-test

the box will panic trying to deref the name for the missing dev since it is
the lower numbered devid.  So fix show_devname to not use missing devices.
Thanks,

Signed-off-by: Josef Bacik <jbacik@fusionio.com>
11 years agoBtrfs: fix that error value is changed by mistake
Stefan Behrens [Wed, 1 Aug 2012 10:28:01 +0000 (04:28 -0600)]
Btrfs: fix that error value is changed by mistake

In iterate_inodes_from_logical() the error result from
extent_from_logical() is patched by mistake. Typically ENOENT is
patched to EINVAL because (-ENOENT & BTRFS_EXTENT_FLAG_TREE_BLOCK)
evaluates to true.

Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de>
11 years agoBtrfs: lock extents as we map them in DIO
Josef Bacik [Tue, 31 Jul 2012 20:28:48 +0000 (16:28 -0400)]
Btrfs: lock extents as we map them in DIO

A deadlock in xfstests 113 was uncovered by commit

d187663ef24cd3d033f0cbf2867e70b36a3a90b8

This is because we would not return EIOCBQUEUED for short AIO reads, instead
we'd wait for the DIO to complete and then return the amount of data we
transferred, which would allow our stuff to unlock the remaning amount.  But
with this change this no longer happens, so if we have a short AIO read (for
example if we try to read past EOF), we could leave the section from EOF to
the end of where we tried to read locked.  Fixing this is tricky since there
is no clear way to know exactly how much data DIO truly submitted for IO, so
to make this less hard on ourselves and less combersome we need to lock the
extents as we try to map them, and then we unlock any areas we didn't
actually map.  This makes us completely safe from deadlocks and reliance on
a particular behavior of the DIO code.  This also lays the groundwork for
allowing us to use the normal csum storage method for reads which means we
can remove an allocation.  Thanks,

Signed-off-by: Josef Bacik <jbacik@fusionio.com>
11 years agoBtrfs: fix some endian bugs handling the root times
Dan Carpenter [Mon, 30 Jul 2012 08:10:44 +0000 (02:10 -0600)]
Btrfs: fix some endian bugs handling the root times

"trans->transid" is cpu endian but we want to store the data as little
endian.  "item->ctime.nsec" is only 32 bits, not 64.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
11 years agoBtrfs: unlock on error in btrfs_delalloc_reserve_metadata()
Dan Carpenter [Mon, 30 Jul 2012 08:15:15 +0000 (02:15 -0600)]
Btrfs: unlock on error in btrfs_delalloc_reserve_metadata()

We should release this mutex before returning the error code.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
11 years agoBtrfs: checking for NULL instead of IS_ERR
Dan Carpenter [Mon, 30 Jul 2012 08:15:43 +0000 (02:15 -0600)]
Btrfs: checking for NULL instead of IS_ERR

add_qgroup_rb() never returns NULL, only error pointers.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
11 years agoBtrfs: fix some error codes in btrfs_qgroup_inherit()
Dan Carpenter [Mon, 30 Jul 2012 08:16:10 +0000 (02:16 -0600)]
Btrfs: fix some error codes in btrfs_qgroup_inherit()

These are returning zero when it should be returning a negative error
code.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
11 years agoBtrfs: fix a misplaced address operator in a condition
Stefan Behrens [Thu, 26 Jul 2012 09:40:35 +0000 (03:40 -0600)]
Btrfs: fix a misplaced address operator in a condition

This should obviously not be "if (&flag)" but "if (flag)".

Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de>
11 years agoALSA: emu8000: fix emu8000 DRAM sized 512 KiB too small
David Flater [Tue, 28 Aug 2012 02:25:21 +0000 (22:25 -0400)]
ALSA: emu8000: fix emu8000 DRAM sized 512 KiB too small

v2:  Fixed result still wrong in the case of 512 KiB DRAM.  Oops.

Applicable to 3.5.3 mainline.

In emu8000.c, size_dram determines the amount of memory on the sound card by
doing write/readback tests starting at 512 KiB and incrementing by 512 KiB.
On success, detected_size is updated to the successful address and testing
continues.  On failure, the loop is immediately exited.  The resulting
detected_size is 512 KiB too small except in two special cases:

1. If there is no memory, the initial 0 value of detected_size is used, which
   is correct.
2. If the address space wraps around, detected_size is updated before the
   bailout, so the result is correct.

The patch corrects all cases and was tested with an AWE64 Gold.  Before:
  EMU8000 [0x620]: 3584 Kb on-board memory detected
  asfxload 4GMGSMT.SF2 (4174814 B) fails.
After:
  EMU8000 [0x620]: 4096 Kb on-board memory detected
  asfxload 4GMGSMT.SF2 succeeds.

I do not have a card with 512 KiB to test with, but by forcibly enabling the
added conditional I verified on the AWE64 Gold that it detects 512 KiB
(successfully reading from the first memory location) and does not hang the
card.

C.f. Bug 46451 https://bugzilla.kernel.org/show_bug.cgi?id=46451

Signed-off-by: David Flater <dave@flaterco.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoMerge branch 'for-linus' into for-next
Takashi Iwai [Tue, 28 Aug 2012 16:26:59 +0000 (09:26 -0700)]
Merge branch 'for-linus' into for-next

Need to merge the fixes regarding EPSS.

Conflicts:
sound/pci/hda/hda_codec.c

11 years agoALSA: hda - Don't trust codec EPSS bit for IDT 92HD83xx & co
Takashi Iwai [Tue, 28 Aug 2012 16:20:13 +0000 (09:20 -0700)]
ALSA: hda - Don't trust codec EPSS bit for IDT 92HD83xx & co

These codecs seem reporting EPSS but require longer delay for the
proper D3 transition.  For example, D3_STOP_CLOCK_OK bit won't be set
correctly even after D3.

In this patch, codec->epss flag is overridden for avoid the
misbehavior.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Avoid unnecessary parameter read for EPSS
Takashi Iwai [Tue, 28 Aug 2012 16:18:01 +0000 (09:18 -0700)]
ALSA: hda - Avoid unnecessary parameter read for EPSS

EPSS parameter should be static, so we can read it once and remember.
This also allows more easily to override the wrong EPSS capability
reported from a codec by changing the flag in the codec
initialization step.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Make clear built-in driver optimization
Takashi Iwai [Fri, 24 Aug 2012 16:40:10 +0000 (18:40 +0200)]
ALSA: hda - Make clear built-in driver optimization

Use unsigned int to make clear that the codes required only for
modules will be reduced by the compiler optimization.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: pcxhr: Add 8 new sound cards
Markus Bollinger [Fri, 24 Aug 2012 12:54:57 +0000 (14:54 +0200)]
ALSA: pcxhr: Add 8 new sound cards

add new sound cards VX442HR VX442e PCX442HR PCX442e VX822HR VX822e PCX822HR and PCX822e

Signed-off-by: Markus Bollinger <bollinger@digigram.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoMerge tag 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck...
Linus Torvalds [Sun, 26 Aug 2012 20:02:51 +0000 (13:02 -0700)]
Merge tag 'hwmon-for-linus' of git://git./linux/kernel/git/groeck/linux-staging

Pull a hwmon fix from Guenter Roeck:
 "Fix sensor readings for Asus M5A78L in asus_atk0110 driver."

* tag 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging:
  hwmon: (asus_atk0110) Add quirk for Asus M5A78L

11 years agoMerge tag 'for-linus' of git://github.com/prasad-joshi/logfs_upstream
Linus Torvalds [Sun, 26 Aug 2012 17:14:11 +0000 (10:14 -0700)]
Merge tag 'for-linus' of git://github.com/prasad-joshi/logfs_upstream

Pull LogFS bugfixes from Prasad Joshi:

 - "logfs: query block device for number of pages to send with bio"

This BUG was found when LogFS was used on KVM. The patch fixes
the problem by asking for underlaying block device the number
of pages to send with each BIO.

 - "logfs: maintain the ordering of meta-inode destruction"

LogFS maintains file system meta-data in special inodes. These
inodes are releated to each other, therefore they must be
destroyed in a proper order.

 - "logfs: initialize the number of iovecs in bio"

LogFS used to panic when it was created on an encrypted LVM
volume. The patch fixes the problem by properly initializing
the BIO.

Plus a couple more:
 - logfs: create a pagecache page if it is not present
 - logfs: destroy the reserved inodes while unmounting

* tag 'for-linus' of git://github.com/prasad-joshi/logfs_upstream:
  logfs: query block device for number of pages to send with bio
  logfs: maintain the ordering of meta-inode destruction
  logfs: create a pagecache page if it is not present
  logfs: initialize the number of iovecs in bio
  logfs: destroy the reserved inodes while unmounting

11 years agoMerge tag 'fixes-3.6-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Linus Torvalds [Sun, 26 Aug 2012 00:33:33 +0000 (17:33 -0700)]
Merge tag 'fixes-3.6-rc3' of git://git./linux/kernel/git/arm/arm-soc

Pull arm-soc fixes from Arnd Bergmann:
 "Bug fixes for various ARM platforms.  About half of these are for OMAP
  and submitted before but did not make it into v3.6-rc2."

* tag 'fixes-3.6-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (39 commits)
  ARM: ux500: don't select LEDS_GPIO for snowball
  ARM: imx: build i.MX6 functions only when needed
  ARM: imx: select CPU_FREQ_TABLE when needed
  ARM: imx: fix ksz9021rn_phy_fixup
  ARM: imx: build pm-imx5 code only when PM is enabled
  ARM: omap: allow building omap44xx without SMP
  ARM: dts: imx51-babbage: fix esdhc cd/wp properties
  ARM: imx6: spin the cpu until hardware takes it down
  ARM: ux500: Ensure probing of Audio devices when Device Tree is enabled
  ARM: ux500: Fix merge error, no matching driver name for 'snd_soc_u8500'
  ARM i.MX6q: Add virtual 1/3.5 dividers in the LDB clock path
  ARM: Kirkwood: fix Makefile.boot
  ARM: Kirkwood: Fix iconnect leds
  ARM: Orion: Set eth packet size csum offload limit
  ARM: mv78xx0: fix win_cfg_base prototype
  ARM: OMAP: dmtimers: Fix locking issue in omap_dm_timer_request*()
  ARM: mmp: fix potential NULL dereference
  ARM: OMAP4: Register the OPP table only for 4430 device
  cpufreq: OMAP: Handle missing frequency table on SMP systems
  ARM: OMAP4: sleep: Save the complete used register stack frame
  ...

11 years agoMerge tag 'stable/for-linus-3.6-rc3-tag' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 26 Aug 2012 00:31:59 +0000 (17:31 -0700)]
Merge tag 'stable/for-linus-3.6-rc3-tag' of git://git./linux/kernel/git/konrad/xen

Pull three xen bug-fixes from Konrad Rzeszutek Wilk:
 - Revert the kexec fix which caused on non-kexec shutdowns a race.
 - Reuse existing P2M leafs - instead of requiring to allocate a large
   area of bootup virtual address estate.
 - Fix a one-off error when adding PFNs for balloon pages.

* tag 'stable/for-linus-3.6-rc3-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen:
  xen/setup: Fix one-off error when adding for-balloon PFNs to the P2M.
  xen/p2m: Reuse existing P2M leafs if they are filled with 1:1 PFNs or INVALID.
  Revert "xen PVonHVM: move shared_info to MMIO before kexec"

11 years agoMerge branch 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc
Linus Torvalds [Sun, 26 Aug 2012 00:30:18 +0000 (17:30 -0700)]
Merge branch 'merge' of git://git./linux/kernel/git/benh/powerpc

Pull powerpc fixes from Benjamin Herrenschmidt:
 "I meant to sent that earlier but got swamped with other things, so
  here are some powerpc fixes for 3.6.  A few regression fixes and some
  bug fixes that I deemed should still make it.

  There's a FSL update from Kumar with a bunch of defconfig updates
  along with a few embedded fixes.

  I also reverted my g5_defconfig update that I merged earlier as it was
  completely busted, not too sure what happened there, I'll do a new one
  later."

* 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc:
  Revert "powerpc: Update g5_defconfig"
  powerpc/perf: Use pmc_overflow() to detect rolled back events
  powerpc: Fix VMX in interrupt check in POWER7 copy loops
  powerpc: POWER7 copy_to_user/copy_from_user patch applied twice
  powerpc: Fix personality handling in ppc64_personality()
  powerpc/dma-iommu: Fix IOMMU window check
  powerpc: Remove unnecessary ifdefs
  powerpc/kgdb: Restore current_thread_info properly
  powerpc/kgdb: Bail out of KGDB when we've been triggered
  powerpc/kgdb: Do not set kgdb_single_step on ppc
  powerpc/mpic_msgr: Add missing includes
  powerpc: Fix null pointer deref in perf hardware breakpoints
  powerpc: Fixup whitespace in xmon
  powerpc: Fix xmon dl command for new printk implementation
  powerpc/fsl: fix "Failed to mount /dev: No such device" errors
  powerpc/fsl: update defconfigs
  booke/wdt: some ioctls do not return values properly
  powerpc/p4080ds: dts - add usb controller version info and port0
  powerpc/85xx: mpc85xx_defconfig - add VIA PATA support for MPC85xxCDS
  powerpc/fsl-pci: Only scan PCI bus if configured as a host

11 years agoMerge git://git.kernel.org/pub/scm/virt/kvm/kvm
Linus Torvalds [Sun, 26 Aug 2012 00:27:17 +0000 (17:27 -0700)]
Merge git://git.kernel.org/pub/scm/virt/kvm/kvm

Pull kvm fixes from Marcelo Tosatti.

* git://git.kernel.org/pub/scm/virt/kvm/kvm:
  KVM: x86 emulator: use stack size attribute to mask rsp in stack ops
  KVM: MMU: Fix mmu_shrink() so that it can free mmu pages as intended
  ppc: e500_tlb memset clears nothing
  KVM: PPC: Add cache flush on page map
  KVM: PPC: Book3S HV: Fix incorrect branch in H_CEDE code
  KVM: x86: update KVM_SAVE_MSRS_BEGIN to correct value

11 years agoMerge tag 'for-linus-v3.6-rc4' of git://oss.sgi.com/xfs/xfs
Linus Torvalds [Sat, 25 Aug 2012 18:47:06 +0000 (11:47 -0700)]
Merge tag 'for-linus-v3.6-rc4' of git://oss.sgi.com/xfs/xfs

Pull xfs bugfixes from Ben Myers:
 - fix uninitialised variable in xfs_rtbuf_get()
 - unlock the AGI buffer when looping in xfs_dialloc
 - check for possible overflow in xfs_ioc_trim

* tag 'for-linus-v3.6-rc4' of git://oss.sgi.com/xfs/xfs:
  xfs: check for possible overflow in xfs_ioc_trim
  xfs: unlock the AGI buffer when looping in xfs_dialloc
  xfs: fix uninitialised variable in xfs_rtbuf_get()

11 years agoMerge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus
Linus Torvalds [Sat, 25 Aug 2012 18:45:04 +0000 (11:45 -0700)]
Merge branch 'upstream' of git://git.linux-mips.org/ralf/upstream-linus

Pull MIPS fixes from Ralf Baechle:
 "Random fixes across the MIPS tree.  The two hotspots are several bugs
  in the module loader and the ath79 SOC support; also noteworthy is the
  restructuring of the code to synchronize CPU timers across CPUs on
  startup; the old code recently ceased to work due to unrelated
  changes.

  All except one of these patches have sat for a significant time in
  linux-next for testing."

* 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus:
  MIPS: pci-ar724x: avoid data bus error due to a missing PCIe module
  MIPS: Malta: Delete duplicate PCI fixup.
  MIPS: ath79: don't hardcode the unavailability of the DSP ASE
  MIPS: Synchronize MIPS count one CPU at a time
  MIPS: BCM63xx: Fix SPI message control register handling for BCM6338/6348.
  MIPS: Module: Deal with malformed HI16/LO16 relocation sequences.
  MIPS: Fix race condition in module relocation code.
  MIPS: Fix memory leak in error path of HI16/LO16 relocation handling.
  MIPS: MTX-1: Add udelay to mtx1_pci_idsel
  MIPS: ath79: select HAVE_CLK
  MIPS: ath79: Use correct IRQ number for the OHCI controller on AR7240
  MIPS: ath79: Fix number of GPIO lines for AR724[12]
  MIPS: Octeon: Fix broken interrupt controller code.

11 years agoMerge branch 'for-3.6' of git://linux-nfs.org/~bfields/linux
Linus Torvalds [Sat, 25 Aug 2012 18:43:41 +0000 (11:43 -0700)]
Merge branch 'for-3.6' of git://linux-nfs.org/~bfields/linux

Pull nfsd bugfixes from J. Bruce Fields:
 "Particular thanks to Michael Tokarev, Malahal Naineni, and Jamie
  Heilman for their testing and debugging help."

* 'for-3.6' of git://linux-nfs.org/~bfields/linux:
  svcrpc: fix svc_xprt_enqueue/svc_recv busy-looping
  svcrpc: sends on closed socket should stop immediately
  svcrpc: fix BUG() in svc_tcp_clear_pages
  nfsd4: fix security flavor of NFSv4.0 callback

11 years agoMerge branch 'for-linus' of git://git.kernel.dk/linux-block
Linus Torvalds [Sat, 25 Aug 2012 18:36:43 +0000 (11:36 -0700)]
Merge branch 'for-linus' of git://git.kernel.dk/linux-block

Pull block-related fixes from Jens Axboe:

 - Improvements to the buffered and direct write IO plugging from
   Fengguang.

 - Abstract out the mapping of a bio in a request, and use that to
   provide a blk_bio_map_sg() helper.  Useful for mapping just a bio
   instead of a full request.

 - Regression fix from Hugh, fixing up a patch that went into the
   previous release cycle (and marked stable, too) attempting to prevent
   a loop in __getblk_slow().

 - Updates to discard requests, fixing up the sizing and how we align
   them.  Also a change to disallow merging of discard requests, since
   that doesn't really work properly yet.

 - A few drbd fixes.

 - Documentation updates.

* 'for-linus' of git://git.kernel.dk/linux-block:
  block: replace __getblk_slow misfix by grow_dev_page fix
  drbd: Write all pages of the bitmap after an online resize
  drbd: Finish requests that completed while IO was frozen
  drbd: fix drbd wire compatibility for empty flushes
  Documentation: update tunable options in block/cfq-iosched.txt
  Documentation: update tunable options in block/cfq-iosched.txt
  Documentation: update missing index files in block/00-INDEX
  block: move down direct IO plugging
  block: remove plugging at buffered write time
  block: disable discard request merge temporarily
  bio: Fix potential memory leak in bio_find_or_create_slab()
  block: Don't use static to define "void *p" in show_partition_start()
  block: Add blk_bio_map_sg() helper
  block: Introduce __blk_segment_map_sg() helper
  fs/block-dev.c:fix performance regression in O_DIRECT writes to md block devices
  block: split discard into aligned requests
  block: reorganize rounding of max_discard_sectors

11 years agoMerge tag 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik...
Linus Torvalds [Sat, 25 Aug 2012 17:28:19 +0000 (10:28 -0700)]
Merge tag 'upstream-linus' of git://git./linux/kernel/git/jgarzik/libata-dev

Pull libata fixes from Jeff Garzik:
 - libata-acpi regression fix
 - additional or corrected drive quirks for ata_blacklist
 - Kconfig text tweaking
 - new PCI IDs
 - pata_atiixp: quirk for MSI motherboard
 - export ahci_dev_classify for an ahci_platform driver

* tag 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev:
  libata: Add a space to " 2GB ATA Flash Disk" DMA blacklist entry
  [libata] new quirk, lift bridge limits for Buffalo DriveStation Quattro
  [libata] Kconfig: Elaborate that SFF is meant for legacy and PATA stuff
  [libata] acpi: call ata_acpi_gtm during ata port init time
  ata_piix: Add Device IDs for Intel Lynx Point-LP PCH
  ahci: Add Device IDs for Intel Lynx Point-LP PCH
  pata_atiixp: override cable detection on MSI E350DM-E33
  ahci: un-staticize ahci_dev_classify

11 years agolibata: Add a space to " 2GB ATA Flash Disk" DMA blacklist entry
Prarit Bhargava [Thu, 23 Aug 2012 19:11:52 +0000 (15:11 -0400)]
libata: Add a space to " 2GB ATA Flash Disk" DMA blacklist entry

commit d70e551c8e1ecb6f20422f8db6bfe6a0049edcb8, Add " 2GB ATA Flash
Disk"/"ADMA428M" to DMA blacklist, should have added a space before 2GB.

Signed-off-by: Prarit Bhargava <prarit@redhat.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
11 years agoRevert "powerpc: Update g5_defconfig"
Benjamin Herrenschmidt [Fri, 24 Aug 2012 10:55:55 +0000 (20:55 +1000)]
Revert "powerpc: Update g5_defconfig"

This reverts commit b1acf1bb544cf28c1f4be0a45620fa899c74b7e9.

Something went horribly wrong when I did savedefconfig, not sure what,
but what's in there is busted so let's revert it.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agopowerpc/perf: Use pmc_overflow() to detect rolled back events
Sukadev Bhattiprolu [Tue, 7 Aug 2012 15:07:19 +0000 (15:07 +0000)]
powerpc/perf: Use pmc_overflow() to detect rolled back events

For certain speculative events on Power7, 'perf stat' reports far higher
event count than 'perf record' for the same event.

As described in following commit, a performance monitor exception is raised
even when the the performance events are rolled back.

        commit 0837e3242c73566fc1c0196b4ec61779c25ffc93
        Author: Anton Blanchard <anton@samba.org>
        Date:   Wed Mar 9 14:38:42 2011 +1100

perf_event_interrupt() records an event only when an overflow occurs. But
this check for overflow is a simple 'if (val < 0)'.

Because the events are rolled back, this check for overflow fails and the
event is not recorded. perf_event_interrupt() later uses pmc_overflow() to
detect the overflow and resets the counters and the events are lost completely.

To properly detect the overflow of rolled back events, use pmc_overflow()
even when recording events.

To reproduce:
        $ cat strcpy.c
        #include <stdio.h>
        #include <string.h>
        main()
        {
                char buf[256];

                alarm(5);
                while(1)
                        strcpy(buf, "string1");
        }

        $ perf record -e r20014 ./strcpy
        $ perf report -n > report.1
        $ perf stat -e r20014 > report.2
        # Compare report.1 and report.2

Reported-by: Maynard Johnson <mpjohn@us.ibm.com>
Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agopowerpc: Fix VMX in interrupt check in POWER7 copy loops
Anton Blanchard [Tue, 7 Aug 2012 17:51:41 +0000 (17:51 +0000)]
powerpc: Fix VMX in interrupt check in POWER7 copy loops

The enhanced prefetch hint patches corrupt the condition register
that was used to check if we are in interrupt. Fix this by using cr1.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agopowerpc: POWER7 copy_to_user/copy_from_user patch applied twice
Anton Blanchard [Tue, 7 Aug 2012 17:50:46 +0000 (17:50 +0000)]
powerpc: POWER7 copy_to_user/copy_from_user patch applied twice

"powerpc: Use enhanced touch instructions in POWER7
copy_to_user/copy_from_user" was applied twice. Remove one.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agopowerpc: Fix personality handling in ppc64_personality()
Jiri Kosina [Mon, 13 Aug 2012 03:18:28 +0000 (03:18 +0000)]
powerpc: Fix personality handling in ppc64_personality()

Directly comparing current->personality against PER_LINUX32 doesn't work
in cases when any of the personality flags stored in the top three bytes
are used.

Directly forcefully setting personality to PER_LINUX32 or PER_LINUX
discards any flags stored in the top three bytes

Use personality() macro to compare only PER_MASK bytes and make sure that
we are setting only the bits that should be set, instead of overwriting
the whole value.

Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agopowerpc/dma-iommu: Fix IOMMU window check
Aaro Koskinen [Sat, 18 Aug 2012 07:34:15 +0000 (07:34 +0000)]
powerpc/dma-iommu: Fix IOMMU window check

Checking for device mask to cover the whole IOMMU table is too strict.
IOMMU allocators should handle mask constraint properly for each
allocation.

The patch enables to use old AirPort Extreme cards on PowerMacs with
more than 1GB of memory; without the patch the driver init fails with:

  b43-pci-bridge 0001:01:01.0: Warning: IOMMU window too big for device mask
  b43-pci-bridge 0001:01:01.0: mask: 0x3fffffff, table end: 0x80000000
  b43-phy0 ERROR: The machine/kernel does not support the required 30-bit DMA mask

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agopowerpc: Remove unnecessary ifdefs
Michael Neuling [Tue, 21 Aug 2012 21:22:22 +0000 (21:22 +0000)]
powerpc: Remove unnecessary ifdefs

Signed-off-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agopowerpc/kgdb: Restore current_thread_info properly
Tiejun Chen [Wed, 22 Aug 2012 16:10:20 +0000 (16:10 +0000)]
powerpc/kgdb: Restore current_thread_info properly

For powerpc BooKE and e200, singlestep is handled on the critical/dbg
exception stack. This causes current_thread_info() to fail for kgdb
internal, so previously We work around this issue by copying
the thread_info from the kernel stack before calling kgdb_handle_exception,
and copying it back afterwards.

But actually we don't do this properly. We should backup current_thread_info
then restore that when exit.

Signed-off-by: Tiejun Chen <tiejun.chen@windriver.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agopowerpc/kgdb: Bail out of KGDB when we've been triggered
Tiejun Chen [Wed, 22 Aug 2012 16:10:19 +0000 (16:10 +0000)]
powerpc/kgdb: Bail out of KGDB when we've been triggered

We need to skip a breakpoint exception when it occurs after
a breakpoint has already been removed.

Signed-off-by: Tiejun Chen <tiejun.chen@windriver.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agopowerpc/kgdb: Do not set kgdb_single_step on ppc
Tiejun Chen [Wed, 22 Aug 2012 16:10:18 +0000 (16:10 +0000)]
powerpc/kgdb: Do not set kgdb_single_step on ppc

The kgdb_single_step flag has the possibility to indefinitely
hang the system on an SMP system.

The x86 arch have the same problem, and that problem was fixed by
commit 8097551d9ab9b9e3630(kgdb,x86: do not set kgdb_single_step
on x86). This patch does the same behaviors as x86's patch.

Signed-off-by: Dongdong Deng <dongdong.deng@windriver.com>
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agopowerpc/mpic_msgr: Add missing includes
Scott Wood [Wed, 22 Aug 2012 15:35:47 +0000 (15:35 +0000)]
powerpc/mpic_msgr: Add missing includes

Add several #includes that mpic_msgr relies on being pulled implicitly,
which only happens on certain configs.

Signed-off-by: Scott Wood <scottwood@freescale.com>
Cc: Meador Inge <meador_inge@mentor.com>
Cc: Jia Hongtao <B38951@freescale.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agopowerpc: Fix null pointer deref in perf hardware breakpoints
Michael Neuling [Wed, 22 Aug 2012 20:30:43 +0000 (20:30 +0000)]
powerpc: Fix null pointer deref in perf hardware breakpoints

Currently if you are doing a global perf recording with hardware
breakpoints (ie perf record -e mem:0xdeadbeef -a), you can oops with:

  Faulting instruction address: 0xc000000000738890
  cpu 0xc: Vector: 300 (Data Access) at [c0000003f76af8d0]
      pc: c000000000738890: .hw_breakpoint_handler+0xa0/0x1e0
      lr: c000000000738830: .hw_breakpoint_handler+0x40/0x1e0
      sp: c0000003f76afb50
     msr: 8000000000001032
     dar: 6f0
   dsisr: 42000000
    current = 0xc0000003f765ac00
    paca    = 0xc00000000f262a00   softe: 0        irq_happened: 0x01
    pid   = 6810, comm = loop-read
  enter ? for help
  [c0000003f76afbe0c00000000073cd04 .notifier_call_chain.isra.0+0x84/0xe0
  [c0000003f76afc80c00000000073cdbc .notify_die+0x3c/0x60
  [c0000003f76afd20c0000000000139f0 .do_dabr+0x40/0xf0
  [c0000003f76afe30c000000000005a9c handle_dabr_fault+0x14/0x48
  --- Exception: 300 (Data Access) at 0000000010000480
  SP (ff8679e0) is in userspace

This is because we don't check to see if the break point is associated
with task before we deference the task_struct pointer.

This changes the update to use current.

Signed-off-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agopowerpc: Fixup whitespace in xmon
Michael Ellerman [Thu, 23 Aug 2012 22:09:13 +0000 (22:09 +0000)]
powerpc: Fixup whitespace in xmon

There are a few whitespace goolies in xmon.c, some of them appear to
be my fault. Fix them all in one go.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agopowerpc: Fix xmon dl command for new printk implementation
Michael Ellerman [Thu, 23 Aug 2012 22:09:12 +0000 (22:09 +0000)]
powerpc: Fix xmon dl command for new printk implementation

Since the printk internals were reworked the xmon 'dl' command which
dumps the content of __log_buf has stopped working.

It is now a structured buffer, so just dumping it doesn't really work.

Use the helpers added for kgdb to print out the content.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>