Takashi Iwai [Wed, 19 Dec 2012 12:01:54 +0000 (13:01 +0100)]
ALSA: hda - Add EAPD control to generic parser
Enable EAPD in output path initializations automatically unless the
new flag spec->own_eapd_ctl is set.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 19 Dec 2012 11:52:06 +0000 (12:52 +0100)]
ALSA: hda - Merge Realtek parser code to generic parser
Finally the whole generic parser code in Realtek driver is moved into
hda_generic.c so that it can be used for generic codec driver.
The old dumb generic driver is replaced. Yay.
The future plan is to adapt this generic parser for other codecs,
i.e. the codec driver calls the exported functions in generic driver
but adds some codec-specific fixes and setups.
As of this commit, the complete driver code is still duplicated in
Realtek codec driver. The big code reduction will come from now on.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 19 Dec 2012 11:24:03 +0000 (12:24 +0100)]
ALSA: hda/realtek - Remove redundant argument from alc_mux_select()
The argument "force" is always false in the recent code.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Thu, 29 Nov 2012 08:56:50 +0000 (09:56 +0100)]
ALSA: hda - More generic auto-mic switching for Realtek codecs
This patch extends the capability of the auto-mic feature.
Instead of limiting the automatic input-source selection only to the
mics (internal, external and dock mics), allow it for generic inputs,
e.g. switching between the rear line-in and the front mic.
The logic is to check the attribute and location of input pins, and
enable the automatic selection feature only if all such pins are in
different locations (e.g. internal, front, rear, etc) and line-in or
mic pins. That is, if multiple input pins are assigned to a single
location, the feature isn't enabled because we don't know the
priority.
(You may wonder why this restriction doesn't exist for the headphone
automute. The reason is that the output case is different from the
input: the input source is an exclusive selection while the output
can be multiplexed.)
Note that, for avoiding regressions, the line-in auto switching
feature isn't activated as default. It has to be set explicitly via
spec->line_in_auto_switch flag in a fixup code.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 28 Nov 2012 17:11:59 +0000 (18:11 +0100)]
ALSA: hda - Rearrange INPUT_PIN_ATTR_*
Put INPUT_PIN_ATTR_FRONT after INPUT_PIN_ATTR_REAR, and define
INPUT_PIN_ATTR_LAST to point to the last element.
This is a preliminary work for cleaning up Realtek auto-mic parser.
In the auto-mic implementation, the front panel is preferred over the
rear panel. By arranging the attr definitions like in this commit, we
can simply use sort() for figuring out the priority order.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 19 Dec 2012 10:39:00 +0000 (11:39 +0100)]
ALSA: hda/realtek - Fix split stereo dmic code
The previous commit passed an utterly wrong value for checking the
split inv dmic pin. This patch fixes it and also tries to remove
inv_dmic_split_idx field.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 18 Dec 2012 17:12:44 +0000 (18:12 +0100)]
ALSA: hda - Move fixup code into struct hda_codec
Since the fixup code is used commonly, it's worth to move it to the
common place, struct hda_codec, instead of keeping in hda_gen_spec.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 18 Dec 2012 16:24:25 +0000 (17:24 +0100)]
ALSA: hda/realtek - Add conexant-style inverted dmic handling
To make the parser more generic, a few codes to handle the inverted
stereo dmic in a way Conexant parser does is added in this patch.
The caller should set spec->inv_dmic_split flag appropriately.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 18 Dec 2012 16:18:21 +0000 (17:18 +0100)]
ALSA: hda/realtek - Allow multiple individual capture volume/switch controls
So far we create only "Capture Volume" and "Capture Switch" controls
for binding all possible amps, but we'd prefer creating individual
capture volume and switch controls per input in some cases
(e.g. conexant parser does it).
Add a new flag, spec->multi_cap_vol, to follow that policy.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 18 Dec 2012 14:35:11 +0000 (15:35 +0100)]
ALSA: hda/realtek - Allow passing name=NULL to alc_kcontrol_new()
This prevents stupid typos.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 18 Dec 2012 14:30:41 +0000 (15:30 +0100)]
ALSA: hda/realtek - Merge a few split functions
Merge a few functions that have been split due to historical reasons
to single functions. Splitting too much (and placing too far away)
actually worsens the readability.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 18 Dec 2012 16:33:04 +0000 (17:33 +0100)]
ALSA: hda/realtek - Assign Master mixer when possible
There are a few more cases where we can assign "Master" mixer element
safely, e.g. when a single DAC is used in the whole output paths.
Also, when vmaster hook is present, avoid "Master" but assign "PCM"
instead. Otherwise vmaster hook won't work properly.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 18 Dec 2012 13:57:09 +0000 (14:57 +0100)]
ALSA: hda/realtek - Handle vmaster hook in the parser side
... so that the fixup just needs to set the hook function in
FIXUP_ACT_PROBE. This will make easier to port for other codecs,
too.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 18 Dec 2012 13:33:21 +0000 (14:33 +0100)]
ALSA: hda/realtek - Remove unused fields and macro definitions
Also arranged alc_spec definitions to optimize bit fields.
Use a bit field for spec->need_dac_fix, too.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 18 Dec 2012 13:29:52 +0000 (14:29 +0100)]
ALSA: hda/realtek - Drop auto_mic_valid_imux flag
This flag is superfluous now and it's always as same as
spec->auto_mic. Let's drop.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 18 Dec 2012 13:22:45 +0000 (14:22 +0100)]
ALSA: hda/realtek - Allow different pins for shared hp/mic vref check
Add a new field to indicate the possible pin NID for alternative vref
setup for the shared hp/mic. Although 0x18 is valid for all Realtek
codecs, it'll be different on other vendor's codecs.
Also, drop the sanity check in update_shared_mic_hp() since the
reference pin is set explicitly in the caller side.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 18 Dec 2012 10:55:53 +0000 (11:55 +0100)]
ALSA: hda/realtek - Parse digital input path
This was the last forgotten path. Now it's parsed via the same path
parser.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 18 Dec 2012 10:46:37 +0000 (11:46 +0100)]
ALSA: hda/realtek - Rename add_new_out_path() with add_new_nid_path()
Make the function more generic for both input and output directions,
and returns the assigned path pointer. The argument order is changed
to follow the standard (from, to) way.
Now this new function is used for analog input and loopback path
parser codes, too.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 18 Dec 2012 08:06:01 +0000 (09:06 +0100)]
ALSA: hda/realtek - Remove superfluous input amp init
The amps will be initialized via activate_path(), thus it's
superfluous to set in alc_auto_init_analog_input().
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 18 Dec 2012 07:57:05 +0000 (08:57 +0100)]
ALSA: hda/realtek - Clean up some spec fields
Remove some fields from struct alc_spec, and clean up the usage.
Namely,
- spec->input_mux becomes a single element, private_imux[] is removed
- spec->adc_nids becomes an array by itself, and private_adc_nids[]
gets removed, too
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Mon, 17 Dec 2012 19:29:29 +0000 (20:29 +0100)]
ALSA: hda/realtek - Make input path parser more generic
Now we reached to the final big piece of parser rewrite: the input
paths. While the old parser code assumes the more-or-less direct and
similar connections from input pin to ADC, the new code handles the
complete input paths. The capture source is switched by simple calls
of activate_path() function.
The parsing of capture volume and capture switches is, however, not
fully generalized. It assumes that amps are available in the vicinity
of ADCs (in three depth). This isn't perfect but it should cover all
codecs I know of.
Also, this commit removes some NID mapping of capture-related controls
temporarily for simplicity. It'll be restored in later commits.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Mon, 17 Dec 2012 17:00:02 +0000 (18:00 +0100)]
ALSA: hda/realtek - Don't change connection at path deactivation
The widget connection selection must be changed only when the path is
enabled.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Fri, 14 Dec 2012 17:26:02 +0000 (18:26 +0100)]
ALSA: hda/realtek - Initialize loopback paths properly
Now we have a complete list of loopback paths, thus we can initialize
the paths more completely based on it, instead of assuming a direct
connection from pin to mixer.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Fri, 14 Dec 2012 17:19:04 +0000 (18:19 +0100)]
ALSA: hda/realtek - Add boost volumes to path list
Don't forget to take boost volumes into account in the managed path
list. Since it's an additional volume, we need to extend the ctls[]
array.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Fri, 14 Dec 2012 17:04:37 +0000 (18:04 +0100)]
ALSA: hda/realtek - Add missing initialization of multi-io routes
The paths used for multi-io haven't been initialized properly, so
far. It's usually no big matter because the pins are set to input as
default, but it's still cleaner to initialize the paths properly.
Now with the path active/inactive check, we can do it easily.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Fri, 14 Dec 2012 16:53:29 +0000 (17:53 +0100)]
ALSA: hda/realtek - Fix the initialization of pin amp-in
The pin widget has only a single amp value for the input even if it
has multiple "sources". Handle the situation in activate_path().
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Fri, 14 Dec 2012 16:34:51 +0000 (17:34 +0100)]
ALSA: hda/realtek - Rename get_out_path() to get_nid_path()
The function can be used not only for output paths but generically.
Also swap the argument order.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Fri, 14 Dec 2012 15:54:44 +0000 (16:54 +0100)]
ALSA: hda/realtek - Use path-based parser for digital outputs
Similar like analog output paths, use the path list for parsing and
initializing digital outputs as well.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Fri, 14 Dec 2012 15:39:22 +0000 (16:39 +0100)]
ALSA: hda/realtek - Consolidate to a single path list
We don't have to keep three individual path lists for input, output
and loopback.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Fri, 14 Dec 2012 15:15:56 +0000 (16:15 +0100)]
ALSA: hda/realtek - Consolidate is_reachable_path()
alc_auto_is_dac_reachable() can be replaced fully with
is_reachable_path(). The only difference is the order of arguments.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Fri, 14 Dec 2012 15:09:29 +0000 (16:09 +0100)]
ALSA: hda/realtek - Add path active flag
... and rewrite the initialization of output paths as a generic
function that is applicable for both i/o directions.
The new flag, active, is introduced to each nid_path entry. This
indicates whether the given path is active, and it's used for checking
whether a certain widget can be turned off or changed when a path is
no longer used or newly enabled.
It's still used only in the output paths. More wider adaption for
input and loopback paths will be achieved in the later patch.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Fri, 14 Dec 2012 13:20:34 +0000 (14:20 +0100)]
ALSA: hda/realtek - Remove non-standard automute mode
We are using only AUTOMUTE_MODE_PIN in patch_realtek.c and all others
have been already dropped. Let's remove the old superfluous codes.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Fri, 14 Dec 2012 09:32:21 +0000 (10:32 +0100)]
ALSA: hda - Introduce snd_hda_codec_amp_init*()
The new function snd_hda_codec_amp_init() (and the stereo variant)
initializes the amp value only once at the first access. If the amp
was already initialized or updated, this won't do anything more.
It's useful for initializing the input amps that are in the part of
the path but never used.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Thu, 13 Dec 2012 17:30:04 +0000 (18:30 +0100)]
ALSA: hda - Introduce cache & flush cmd / amp writes
For optimizing the verb executions, a new mechanism to cache the verbs
and amp update commands is introduced. With the new "write to cache
and flush" way, you can reduce the same verbs that have been written
multiple times.
When codec->cached_write flag is set, the further
snd_hda_codec_write_cache() and snd_hda_codec_amp_stereo() calls will
be performed only on the command or amp cache table, but not sent to
the hardware yet. Once after you call all commands and update amps,
call snd_hda_codec_resume_amp() and snd_hda_codec_resume_cache().
Then all cached writes and amp updates will be written to the
hardware, and the dirty flags are cleared.
In this implementation, the existing cache table is reused, so
actually no big code change is seen here. Each cache entry has a new
dirty flag now (so the cache key is now reduced to 31bit).
As a good side-effect by this change, snd_hda_codec_resume_*() will no
longer execute verbs that have been already issued during the resume
phase by checking the dirty flags.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Thu, 13 Dec 2012 16:03:30 +0000 (17:03 +0100)]
ALSA: hda - Remove snd_hda_codec_amp_update() call from patch_*.c
It's used only in one place in patch_analog.c, and it can be replaced
with others better.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Thu, 13 Dec 2012 15:43:52 +0000 (16:43 +0100)]
ALSA: hda/realtek - Fix initialization of input amps in output paths
When initializing the output paths, we assumed the input amps have
almost two inputs blindly. It's not only generic but even incorrect
for some codecs like ALC268 & co. Also, the same assumption (two
sources) exists for the bind input-amp controls.
This patch changes the codes in these places to handle the input
connections in a more generic way.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 12 Dec 2012 17:08:52 +0000 (18:08 +0100)]
ALSA: hda/realtek - Check amp capabilities of aa-mixer widget
For handling the analog-loopback paths more generically, check the amp
capabilities of the aa-mixer widget, and create only the appropriate
mixer elements.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 12 Dec 2012 17:02:41 +0000 (18:02 +0100)]
ALSA: hda/realtek - Parse analog loopback paths more generically
Improve the parser of analog loopback paths and handle in a more
generic way. The following changes are included in this patch:
- Instead of assuming direct connections between pins and
the mixer widget, track the whole path between them. This fixes
some missing connections like ALC660.
- Introduce the path list for loopback paths like input and output
path lists. Currently it's not used for any real purposes, yet.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 12 Dec 2012 16:25:00 +0000 (17:25 +0100)]
ALSA: hda/realtek - Parse input paths
Just like the output paths, parse the whole paths for inputs as well
and store in a path list. For that purpose, rewrite the output parser
code to be generically usable.
The input path list is not referred at all in this patch. It'll be
used to replace the fixed adc/capsrc array in later patches for more
flexible input path selections.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Mon, 10 Dec 2012 16:27:57 +0000 (17:27 +0100)]
ALSA: hda/realtek - Make path->idx[] and path->multi[] consistent
So far, idx[i] and multi[i] indicate the attribute of the widget
path[i - 1]. This was just for simplifying the code in
__parse_output_path(), but this is rather confusing for later use.
It's more natural if both idx[i] and multi[i] point to the same widget
of path[i]. This patch changes to that way.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Mon, 10 Dec 2012 16:07:16 +0000 (17:07 +0100)]
ALSA: hda/realtek - Simplify the output volume initialization
Simplify the output path initialization using the existing path
information instead of assuming the topology specific to Realtek
codecs. This is also implicitly a fix for some amp values on output
pins where the old parser missed (e.g. ALC260 output pins).
The same function alc_auto_set_output_and_unmute() can be used now for
the multi-io activation, since the output selection means nothing but
activating the given output path.
And, finally at this stage, we can get rid of alc_go_down_to_selector()
and other functions that are codec really specifically to Realtek
codecs.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Mon, 10 Dec 2012 15:04:30 +0000 (16:04 +0100)]
ALSA: hda/realtek - Reduce vol/mute ctl lookups at parsing codec
So far, Realtek codec driver evaluates the NIDs for volume and mute
controls twice, once while parsing the DACs and evaluating the
assignment, and another while creating the mixer elements. This is
utterly redundant and even fragile, as it's assuming that the ctl
element evaluation is identical between both parsing DACs and creating
mixer elements.
This patch simplifies the code flow by doing the volume / mute
controls evaluation only once while parsing the DACs. The patch ended
up in larger changes than expected because of some cleanups became
mandatory.
As a gratis bonus, this patch also fixes some cases where the stereo
channels are used wrongly for mono amps.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Mon, 10 Dec 2012 14:58:34 +0000 (15:58 +0100)]
ALSA: hda - Fix mono amp values in proc output
The mono widget is always connected to the left channel, thus the left
channel amp value also should be referred for mono widgets instead of
the right channel.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Thu, 6 Dec 2012 17:06:23 +0000 (18:06 +0100)]
ALSA: hda/realtek - Manage mixer controls in out_path list
As we parse the output paths more precisely now, we can use this path
list for parsing the widgets for volume and mute mixer controls.
The spec->vol_ctls[] and sw_ctls[] bitmasks are replaced with the
ctls[] in each output path instance.
Interestingly, this move alone automagically fixes some bugs that the
conflicting volume or mute NIDs weren't properly detected.
Also, by parsing the whole path, there are more chances to get a free
widget for volume/mute controls.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Thu, 6 Dec 2012 14:45:38 +0000 (15:45 +0100)]
ALSA: hda/realtek - Add output path parser
Add the output path parser to Realtek codec driver as we already have
in patch_via.c. The nid_path struct represents the complete output
path from a DAC to a pin. The alc_spec contains an array of these
paths, and a new path is added at each time when a new DAC is
assigned.
So far, this path list is used only in limited codes: namely in this
patch, only alc_is_dac_already_used() checks the list instead of dac
arrays in all possible outputs. In the later development, the path
list will be referred from more places, such as the mixer control
assignment / check, the mute/unmute of active routes, etc.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 5 Dec 2012 13:17:37 +0000 (14:17 +0100)]
ALSA: hda/realtek - List up all available DACs
In the probing phase, create a list of all available DACs in the codec
and use it for checking the single DAC connections.
This list will be used in more other places in the later commits, too.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 5 Dec 2012 13:08:45 +0000 (14:08 +0100)]
ALSA: hda/realtek - Simplify alc_auto_is_dac_reachable()
Use the helper function snd_hda_get_conn_index() instead of open
codes. This also improves the detection of some routes to DAC on
ALC260 (although the difference doesn't influence on the end
results of the mapping).
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Kailang Yang [Thu, 10 Jan 2013 09:25:48 +0000 (10:25 +0100)]
ALSA: hda - Add support of new codec ALC284
Added the support for a new codec ALC284, which is compatible with
ALC269. Also add more codec variants to handle the SSID check
properly.
Signed-off-by: Kailang Yang <kailang@realtek.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Sachin Kamat [Thu, 10 Jan 2013 05:49:14 +0000 (11:19 +0530)]
ALSA: usb-audio: Make ebox44_table static
Fixes the following sparse warning:
sound/usb/mixer_quirks.c:1209:23: warning:
symbol 'ebox44_table' was not declared. Should it be static?
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Andre Schramm [Wed, 9 Jan 2013 13:40:18 +0000 (14:40 +0100)]
ALSA: hdspm - Fix wordclock status on AES32
Use correct bitmask for AES32 cards to determine wordclock lock state,
add missing bitmask for sync check and make output of the corresponding
control and /proc coherent.
Signed-off-by: Andre Schramm <andre.schramm@iosono-sound.com>
Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
David Henningsson [Wed, 19 Dec 2012 08:44:47 +0000 (09:44 +0100)]
Revert "ALSA: hda - Shut up pins at power-saving mode with Conexnat codecs"
This reverts commit
697c373e34613609cb5450f98b91fefb6e910588.
The original patch was meant to remove clicking, but in fact caused even
more clicking instead.
Thanks to c4pp4 for doing most of the work with this bug.
BugLink: https://bugs.launchpad.net/bugs/886975
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 8 Jan 2013 12:51:30 +0000 (13:51 +0100)]
ALSA: hda - Disable runtime D3 for Intel CPT & co
We've got a few bug reports that the runtime D3 results in the dead
HD-audio controller. It seems that the problem is in a deeper level
than the sound driver itself, so as a temporal solution, disable the
feature for these controllers again.
Reported-and-tested-by: Vincent Blut <vincent.debian@free.fr>
Reported-and-tested-by: Maurizio Avogadro <mavoga@gmail.com>
Cc: <stable@vger.kernel.org> [v3.7]
Signed-off-by: Takashi Iwai <tiwai@suse.de>
David Henningsson [Mon, 7 Jan 2013 11:03:47 +0000 (12:03 +0100)]
ALSA: hda - add mute LED for HP Pavilion 17 (Realtek codec)
The mute LED is in this case connected to the Mic1 VREF.
The machine also exposes the following string in BIOS:
"HP_Mute_LED_0_A", so if more machines are coming, it probably
makes sense to try to do something more generic, like for the
IDT codec.
Cc: stable@vger.kernel.org
BugLink: https://bugs.launchpad.net/bugs/1096789
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Nickolai Zeldovich [Sat, 5 Jan 2013 19:14:08 +0000 (14:14 -0500)]
ALSA: au88x0: fix incorrect left shift
vortex_wt_setdsout performs bit-negation on the bit position (wt&0x1f)
rather than on the resulting bitmask. This code is never actually
invoked (vortex_wt_setdsout is always called with en=1), so this does
not currently cause any problem, and this patch is simply cleanup.
Signed-off-by: Nickolai Zeldovich <nickolai@csail.mit.edu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Asim Kadav [Thu, 3 Jan 2013 17:47:26 +0000 (11:47 -0600)]
sound: oss/pas2: Fix possible access out of array
Added a fix for hardware dependence bug where a sound card failure
should not result in reading beyond array memory index.
Signed-off-by: Asim Kadav <kadav@cs.wisc.edu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Damien Zammit [Fri, 4 Jan 2013 08:51:44 +0000 (09:51 +0100)]
ALSA: usb-audio: Fix kernel panic of Digidesign Mbox2 quirk
This patch is based on 3.8-rc1. It fixes two things:
1) A kernel panic caused by incorrect allocation of a u8 variable
"bootresponse".
2) A noisy dmesg (urb status -32) caused by broken pipe to an
invalid midi endpoint.
It is also a little cleaner because there is no need for a new
QUIRK_MIDI type as suggested by kernel developers, since the device
follows exactly the MIDIMAN protocol.
Signed-off-by: Damien Zammit <damien@zamaudio.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Alexander Schremmer [Thu, 3 Jan 2013 11:59:07 +0000 (12:59 +0100)]
ALSA: usb-audio: Add support for Creative BT-D1 via usb sound quirks
Support the Creative BT-D1 Bluetooth USB audio device. Before this
patch, Linux had trouble finding the correct USB descriptors and bailed
out with these messages:
no or invalid class specific endpoint descriptor
Now it still prints these messages on hotplug:
snd-usb-audio: probe of ...:1.0 failed with error -5
snd-usb-audio: probe of ...:1.2 failed with error -5
snd-usb-audio: probe of ...:1.3 failed with error -5
But the device works correctly, including the HID support.
The patch is diff'ed against 3.8-rc1 but should apply to older kernels
as well.
Signed-off-by: Alexander Schremmer <alex@alexanderweb.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
David Henningsson [Thu, 3 Jan 2013 13:12:29 +0000 (14:12 +0100)]
ALSA: hda - Switch "On" and "Off" for "Mute-LED Mode" kcontrol
The vmaster hook sends 1 for enabled/unmuted and 0 for disabled/muted,
but "Mute-LED Mode" being "On" refers to the LED being on, not the
volume being on.
Therefore "On" and "Off" should be switched.
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Linus Torvalds [Sat, 22 Dec 2012 01:19:00 +0000 (17:19 -0800)]
Linux 3.8-rc1
Linus Torvalds [Sat, 22 Dec 2012 01:10:29 +0000 (17:10 -0800)]
Merge git://www.linux-watchdog.org/linux-watchdog
Pull watchdog updates from Wim Van Sebroeck:
"This includes some fixes and code improvements (like
clk_prepare_enable and clk_disable_unprepare), conversion from the
omap_wdt and twl4030_wdt drivers to the watchdog framework, addition
of the SB8x0 chipset support and the DA9055 Watchdog driver and some
OF support for the davinci_wdt driver."
* git://www.linux-watchdog.org/linux-watchdog: (22 commits)
watchdog: mei: avoid oops in watchdog unregister code path
watchdog: Orion: Fix possible null-deference in orion_wdt_probe
watchdog: sp5100_tco: Add SB8x0 chipset support
watchdog: davinci_wdt: add OF support
watchdog: da9052: Fix invalid free of devm_ allocated data
watchdog: twl4030_wdt: Change TWL4030_MODULE_PM_RECEIVER to TWL_MODULE_PM_RECEIVER
watchdog: remove depends on CONFIG_EXPERIMENTAL
watchdog: Convert dev_printk(KERN_<LEVEL> to dev_<level>(
watchdog: DA9055 Watchdog driver
watchdog: omap_wdt: eliminate goto
watchdog: omap_wdt: delete redundant platform_set_drvdata() calls
watchdog: omap_wdt: convert to devm_ functions
watchdog: omap_wdt: convert to new watchdog core
watchdog: WatchDog Timer Driver Core: fix comment
watchdog: s3c2410_wdt: use clk_prepare_enable and clk_disable_unprepare
watchdog: imx2_wdt: Select the driver via ARCH_MXC
watchdog: cpu5wdt.c: add missing del_timer call
watchdog: hpwdt.c: Increase version string
watchdog: Convert twl4030_wdt to watchdog core
davinci_wdt: preparation for switch to common clock framework
...
Linus Torvalds [Sat, 22 Dec 2012 01:09:07 +0000 (17:09 -0800)]
Merge branch 'for-next' of git://git.samba.org/sfrench/cifs-2.6
Pull CIFS fixes from Steve French:
"Misc small cifs fixes"
* 'for-next' of git://git.samba.org/sfrench/cifs-2.6:
cifs: eliminate cifsERROR variable
cifs: don't compare uniqueids in cifs_prime_dcache unless server inode numbers are in use
cifs: fix double-free of "string" in cifs_parse_mount_options
Linus Torvalds [Sat, 22 Dec 2012 01:08:06 +0000 (17:08 -0800)]
Merge tag 'dm-3.8-fixes' of git://git./linux/kernel/git/agk/linux-dm
Pull dm update from Alasdair G Kergon:
"Miscellaneous device-mapper fixes, cleanups and performance
improvements.
Of particular note:
- Disable broken WRITE SAME support in all targets except linear and
striped. Use it when kcopyd is zeroing blocks.
- Remove several mempools from targets by moving the data into the
bio's new front_pad area(which dm calls 'per_bio_data').
- Fix a race in thin provisioning if discards are misused.
- Prevent userspace from interfering with the ioctl parameters and
use kmalloc for the data buffer if it's small instead of vmalloc.
- Throttle some annoying error messages when I/O fails."
* tag 'dm-3.8-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/agk/linux-dm: (36 commits)
dm stripe: add WRITE SAME support
dm: remove map_info
dm snapshot: do not use map_context
dm thin: dont use map_context
dm raid1: dont use map_context
dm flakey: dont use map_context
dm raid1: rename read_record to bio_record
dm: move target request nr to dm_target_io
dm snapshot: use per_bio_data
dm verity: use per_bio_data
dm raid1: use per_bio_data
dm: introduce per_bio_data
dm kcopyd: add WRITE SAME support to dm_kcopyd_zero
dm linear: add WRITE SAME support
dm: add WRITE SAME support
dm: prepare to support WRITE SAME
dm ioctl: use kmalloc if possible
dm ioctl: remove PF_MEMALLOC
dm persistent data: improve improve space map block alloc failure message
dm thin: use DMERR_LIMIT for errors
...
J. Bruce Fields [Sat, 22 Dec 2012 00:48:59 +0000 (19:48 -0500)]
Revert "nfsd: warn on odd reply state in nfsd_vfs_read"
This reverts commit
79f77bf9a4e3dd5ead006b8f17e7c4ff07d8374e.
This is obviously wrong, and I have no idea how I missed seeing the
warning in testing: I must just not have looked at the right logs. The
caller bumps rq_resused/rq_next_page, so it will always be hit on a
large enough read.
Reported-by: Dave Jones <davej@redhat.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Linus Torvalds [Sat, 22 Dec 2012 00:40:26 +0000 (16:40 -0800)]
Merge tag 'rdma-for-linus' of git://git./linux/kernel/git/roland/infiniband
Pull more infiniband changes from Roland Dreier:
"Second batch of InfiniBand/RDMA changes for 3.8:
- cxgb4 changes to fix lookup engine hash collisions
- mlx4 changes to make flow steering usable
- fix to IPoIB to avoid pinning dst reference for too long"
* tag 'rdma-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband:
RDMA/cxgb4: Fix bug for active and passive LE hash collision path
RDMA/cxgb4: Fix LE hash collision bug for passive open connection
RDMA/cxgb4: Fix LE hash collision bug for active open connection
mlx4_core: Allow choosing flow steering mode
mlx4_core: Adjustments to Flow Steering activation logic for SR-IOV
mlx4_core: Fix error flow in the flow steering wrapper
mlx4_core: Add QPN enforcement for flow steering rules set by VFs
cxgb4: Add LE hash collision bug fix path in LLD driver
cxgb4: Add T4 filter support
IPoIB: Call skb_dst_drop() once skb is enqueued for sending
Linus Torvalds [Sat, 22 Dec 2012 00:39:08 +0000 (16:39 -0800)]
Merge tag 'asm-generic' of git://git./linux/kernel/git/arnd/asm-generic
Pull asm-generic cleanup from Arnd Bergmann:
"These are a few cleanups for asm-generic:
- a set of patches from Lars-Peter Clausen to generalize asm/mmu.h
and use it in the architectures that don't need any special
handling.
- A patch from Will Deacon to remove the {read,write}s{b,w,l} as
discussed during the arm64 review
- A patch from James Hogan that helps with the meta architecture
series."
* tag 'asm-generic' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic:
xtensa: Use generic asm/mmu.h for nommu
h8300: Use generic asm/mmu.h
c6x: Use generic asm/mmu.h
asm-generic/mmu.h: Add support for FDPIC
asm-generic/mmu.h: Remove unused vmlist field from mm_context_t
asm-generic: io: remove {read,write} string functions
asm-generic/io.h: remove asm/cacheflush.h include
Kukjin Kim [Fri, 21 Dec 2012 18:02:13 +0000 (10:02 -0800)]
ARM: dts: fix duplicated build target and alphabetical sort out for exynos
Commit
db5b0ae00712 ("Merge tag 'dt' of git://git.kernel.org/.../arm-soc")
causes a duplicated build target. This patch fixes it and sorts out the
build target alphabetically so that we can recognize something wrong
easily.
Cc: Olof Johansson <olof@lixom.net>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Mike Snitzer [Fri, 21 Dec 2012 20:23:41 +0000 (20:23 +0000)]
dm stripe: add WRITE SAME support
Rename stripe_map_discard to stripe_map_range and reuse it for WRITE
SAME bio processing.
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Mikulas Patocka [Fri, 21 Dec 2012 20:23:41 +0000 (20:23 +0000)]
dm: remove map_info
This patch removes map_info from bio-based device mapper targets.
map_info is still used for request-based targets.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Mikulas Patocka [Fri, 21 Dec 2012 20:23:41 +0000 (20:23 +0000)]
dm snapshot: do not use map_context
Eliminate struct map_info from dm-snap.
map_info->ptr was used in dm-snap to indicate if the bio was tracked.
If map_info->ptr was non-NULL, the bio was linked in tracked_chunk_hash.
This patch removes the use of map_info->ptr. We determine if the bio was
tracked based on hlist_unhashed(&c->node). If hlist_unhashed is true,
the bio is not tracked, if it is false, the bio is tracked.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Mikulas Patocka [Fri, 21 Dec 2012 20:23:40 +0000 (20:23 +0000)]
dm thin: dont use map_context
This patch removes endio_hook_pool from dm-thin and uses per-bio data instead.
This patch removes any use of map_info in preparation for the next patch
that removes map_info from bio-based device mapper.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Mikulas Patocka [Fri, 21 Dec 2012 20:23:40 +0000 (20:23 +0000)]
dm raid1: dont use map_context
Don't use map_info any more in dm-raid1.
map_info was used for writes to hold the region number. For this purpose
we add a new field dm_bio_details to dm_raid1_bio_record.
map_info was used for reads to hold a pointer to dm_raid1_bio_record (if
the pointer was non-NULL, bio details were saved; if the pointer was
NULL, bio details were not saved). We use
dm_raid1_bio_record.details->bi_bdev for this purpose. If bi_bdev is
NULL, details were not saved, if bi_bdev is non-NULL, details were
saved.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Mikulas Patocka [Fri, 21 Dec 2012 20:23:39 +0000 (20:23 +0000)]
dm flakey: dont use map_context
Replace map_info with a per-bio structure "struct per_bio_data" in dm-flakey.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Mikulas Patocka [Fri, 21 Dec 2012 20:23:39 +0000 (20:23 +0000)]
dm raid1: rename read_record to bio_record
Rename struct read_record to bio_record in dm-raid1.
In the following patch, the structure will be used for both read and
write bios, so rename it.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Mikulas Patocka [Fri, 21 Dec 2012 20:23:39 +0000 (20:23 +0000)]
dm: move target request nr to dm_target_io
This patch moves target_request_nr from map_info to dm_target_io and
makes it accessible with dm_bio_get_target_request_nr.
This patch is a preparation for the next patch that removes map_info.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Mikulas Patocka [Fri, 21 Dec 2012 20:23:38 +0000 (20:23 +0000)]
dm snapshot: use per_bio_data
Replace tracked_chunk_pool with per_bio_data in dm-snap.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Mikulas Patocka [Fri, 21 Dec 2012 20:23:38 +0000 (20:23 +0000)]
dm verity: use per_bio_data
Replace io_mempool with per_bio_data in dm-verity.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Mikulas Patocka [Fri, 21 Dec 2012 20:23:38 +0000 (20:23 +0000)]
dm raid1: use per_bio_data
Replace read_record_pool with per_bio_data in dm-raid1.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Mikulas Patocka [Fri, 21 Dec 2012 20:23:38 +0000 (20:23 +0000)]
dm: introduce per_bio_data
Introduce a field per_bio_data_size in struct dm_target.
Targets can set this field in the constructor. If a target sets this
field to a non-zero value, "per_bio_data_size" bytes of auxiliary data
are allocated for each bio submitted to the target. These data can be
used for any purpose by the target and help us improve performance by
removing some per-target mempools.
Per-bio data is accessed with dm_per_bio_data. The
argument data_size must be the same as the value per_bio_data_size in
dm_target.
If the target has a pointer to per_bio_data, it can get a pointer to
the bio with dm_bio_from_per_bio_data() function (data_size must be the
same as the value passed to dm_per_bio_data).
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Mike Snitzer [Fri, 21 Dec 2012 20:23:37 +0000 (20:23 +0000)]
dm kcopyd: add WRITE SAME support to dm_kcopyd_zero
Add WRITE SAME support to dm-io and make it accessible to
dm_kcopyd_zero(). dm_kcopyd_zero() provides an asynchronous interface
whereas the blkdev_issue_write_same() interface is synchronous.
WRITE SAME is a SCSI command that can be leveraged for more efficient
zeroing of a specified logical extent of a device which supports it.
Only a single zeroed logical block is transfered to the target for each
WRITE SAME and the target then writes that same block across the
specified extent.
The dm thin target uses this.
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Mike Snitzer [Fri, 21 Dec 2012 20:23:37 +0000 (20:23 +0000)]
dm linear: add WRITE SAME support
The linear target can already support WRITE SAME requests so signal
this by setting num_write_same_requests to 1.
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Mike Snitzer [Fri, 21 Dec 2012 20:23:37 +0000 (20:23 +0000)]
dm: add WRITE SAME support
WRITE SAME bios have a payload that contain a single page. When
cloning WRITE SAME bios DM has no need to modify the bi_io_vec
attributes (and doing so would be detrimental). DM need only alter the
start and end of the WRITE SAME bio accordingly.
Rather than duplicate __clone_and_map_discard, factor out a common
function that is also used by __clone_and_map_write_same.
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Mike Snitzer [Fri, 21 Dec 2012 20:23:36 +0000 (20:23 +0000)]
dm: prepare to support WRITE SAME
Allow targets to opt in to WRITE SAME support by setting
'num_write_same_requests' in the dm_target structure.
A dm device will only advertise WRITE SAME support if all its
targets and all its underlying devices support it.
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Mikulas Patocka [Fri, 21 Dec 2012 20:23:36 +0000 (20:23 +0000)]
dm ioctl: use kmalloc if possible
If the parameter buffer is small enough, try to allocate it with kmalloc()
rather than vmalloc().
vmalloc is noticeably slower than kmalloc because it has to manipulate
page tables.
In my tests, on PA-RISC this patch speeds up activation 13 times.
On Opteron this patch speeds up activation by 5%.
This patch introduces a new function free_params() to free the
parameters and this uses new flags that record whether or not vmalloc()
was used and whether or not the input buffer must be wiped after use.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Mikulas Patocka [Fri, 21 Dec 2012 20:23:36 +0000 (20:23 +0000)]
dm ioctl: remove PF_MEMALLOC
When allocating memory for the userspace ioctl data, set some
appropriate GPF flags directly instead of using PF_MEMALLOC.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Joe Thornber [Fri, 21 Dec 2012 20:23:36 +0000 (20:23 +0000)]
dm persistent data: improve improve space map block alloc failure message
Improve space map error message when unable to allocate a new
metadata block.
Signed-off-by: Joe Thornber <ejt@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Mike Snitzer [Fri, 21 Dec 2012 20:23:34 +0000 (20:23 +0000)]
dm thin: use DMERR_LIMIT for errors
Throttle all errors logged from the IO path by dm thin.
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Mike Snitzer [Fri, 21 Dec 2012 20:23:34 +0000 (20:23 +0000)]
dm persistent data: use DMERR_LIMIT for errors
Nearly all of persistent-data is in the IO path so throttle error
messages with DMERR_LIMIT to limit the amount logged when
something has gone wrong.
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Mike Snitzer [Fri, 21 Dec 2012 20:23:34 +0000 (20:23 +0000)]
dm block manager: reinstate message when validator fails
Reinstate a useful error message when the block manager buffer validator fails.
This was mistakenly eliminated when the block manager was converted to use
dm-bufio.
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Jonathan Brassow [Fri, 21 Dec 2012 20:23:33 +0000 (20:23 +0000)]
dm raid: round region_size to power of two
If the user does not supply a bitmap region_size to the dm raid target,
a reasonable size is computed automatically. If this is not a power of 2,
the md code will report an error later.
This patch catches the problem early and rounds the region_size to the
next power of two.
Signed-off-by: Jonathan Brassow <jbrassow@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Joe Thornber [Fri, 21 Dec 2012 20:23:33 +0000 (20:23 +0000)]
dm thin: cleanup dead code
Remove unused @data_block parameter from cell_defer.
Change thin_bio_map to use many returns rather than setting a variable.
Signed-off-by: Joe Thornber <ejt@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Joe Thornber [Fri, 21 Dec 2012 20:23:33 +0000 (20:23 +0000)]
dm thin: rename cell_defer_except to cell_defer_no_holder
Rename cell_defer_except() to cell_defer_no_holder() which describes
its function more clearly.
Signed-off-by: Joe Thornber <ejt@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Mikulas Patocka [Fri, 21 Dec 2012 20:23:33 +0000 (20:23 +0000)]
dm snapshot: optimize track_chunk
track_chunk is always called with interrupts enabled. Consequently, we
do not need to save and restore interrupt state in "flags" variable.
This patch changes spin_lock_irqsave to spin_lock_irq and
spin_unlock_irqrestore to spin_unlock_irq.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Mikulas Patocka [Fri, 21 Dec 2012 20:23:32 +0000 (20:23 +0000)]
dm raid: use DM_ENDIO_INCOMPLETE
Use a defined macro DM_ENDIO_INCOMPLETE instead of a numeric constant.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Mikulas Patocka [Fri, 21 Dec 2012 20:23:32 +0000 (20:23 +0000)]
dm raid1: remove impossible mempool_alloc error test
mempool_alloc can't fail if __GFP_WAIT is specified, so the condition
that tests if read_record is non-NULL is always true.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Mike Snitzer [Fri, 21 Dec 2012 20:23:32 +0000 (20:23 +0000)]
dm thin: emit ignore_discard in status when discards disabled
If "ignore_discard" is specified when creating the thin pool device then
discard support is disabled for that device. The pool device's status
should reflect this fact rather than stating "no_discard_passdown"
(which implies discards are enabled but passdown is disabled).
Reported-by: Zdenek Kabelac <zkabelac@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Joe Thornber [Fri, 21 Dec 2012 20:23:32 +0000 (20:23 +0000)]
dm persistent data: fix nested btree deletion
When deleting nested btrees, the code forgets to delete the innermost
btree. The thin-metadata code serendipitously compensates for this by
claiming there is one extra layer in the tree.
This patch corrects both problems.
Signed-off-by: Joe Thornber <ejt@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Joe Thornber [Fri, 21 Dec 2012 20:23:31 +0000 (20:23 +0000)]
dm thin: wake worker when discard is prepared
When discards are prepared it is best to directly wake the worker that
will process them. The worker will be woken anyway, via periodic
commit, but there is no reason to not wake_worker here.
Signed-off-by: Joe Thornber <ejt@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Joe Thornber [Fri, 21 Dec 2012 20:23:31 +0000 (20:23 +0000)]
dm thin: fix race between simultaneous io and discards to same block
There is a race when discard bios and non-discard bios are issued
simultaneously to the same block.
Discard support is expensive for all thin devices precisely because you
have to be careful to quiesce the area you're discarding. DM thin must
handle this conflicting IO pattern (simultaneous non-discard vs discard)
even though a sane application shouldn't be issuing such IO.
The race manifests as follows:
1. A non-discard bio is mapped in thin_bio_map.
This doesn't lock out parallel activity to the same block.
2. A discard bio is issued to the same block as the non-discard bio.
3. The discard bio is locked in a dm_bio_prison_cell in process_discard
to lock out parallel activity against the same block.
4. The non-discard bio's mapping continues and its all_io_entry is
incremented so the bio is accounted for in the thin pool's all_io_ds
which is a dm_deferred_set used to track time locality of non-discard IO.
5. The non-discard bio is finally locked in a dm_bio_prison_cell in
process_bio.
The race can result in deadlock, leaving the block layer hanging waiting
for completion of a discard bio that never completes, e.g.:
INFO: task ruby:15354 blocked for more than 120 seconds.
"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
ruby D
ffffffff8160f0e0 0 15354 15314 0x00000000
ffff8802fb08bc58 0000000000000082 ffff8802fb08bfd8 0000000000012900
ffff8802fb08a010 0000000000012900 0000000000012900 0000000000012900
ffff8802fb08bfd8 0000000000012900 ffff8803324b9480 ffff88032c6f14c0
Call Trace:
[<
ffffffff814e5a19>] schedule+0x29/0x70
[<
ffffffff814e3d85>] schedule_timeout+0x195/0x220
[<
ffffffffa06b9bc1>] ? _dm_request+0x111/0x160 [dm_mod]
[<
ffffffff814e589e>] wait_for_common+0x11e/0x190
[<
ffffffff8107a170>] ? try_to_wake_up+0x2b0/0x2b0
[<
ffffffff814e59ed>] wait_for_completion+0x1d/0x20
[<
ffffffff81233289>] blkdev_issue_discard+0x219/0x260
[<
ffffffff81233e79>] blkdev_ioctl+0x6e9/0x7b0
[<
ffffffff8119a65c>] block_ioctl+0x3c/0x40
[<
ffffffff8117539c>] do_vfs_ioctl+0x8c/0x340
[<
ffffffff8119a547>] ? block_llseek+0x67/0xb0
[<
ffffffff811756f1>] sys_ioctl+0xa1/0xb0
[<
ffffffff810561f6>] ? sys_rt_sigprocmask+0x86/0xd0
[<
ffffffff814ef099>] system_call_fastpath+0x16/0x1b
The thinp-test-suite's test_discard_random_sectors reliably hits this
deadlock on fast SSD storage.
The fix for this race is that the all_io_entry for a bio must be
incremented whilst the dm_bio_prison_cell is held for the bio's
associated virtual and physical blocks. That cell locking wasn't
occurring early enough in thin_bio_map. This patch fixes this.
Care is taken to always call the new function inc_all_io_entry() with
the relevant cells locked, but they are generally unlocked before
calling issue() to try to avoid holding the cells locked across
generic_submit_request.
Also, now that thin_bio_map may lock bios in a cell, process_bio() is no
longer the only thread that will do so. Because of this we must be sure
to use cell_defer_except() to release all non-holder entries, that
were added by the other thread, because they must be deferred.
This patch depends on "dm thin: replace dm_cell_release_singleton with
cell_defer_except".
Signed-off-by: Joe Thornber <ejt@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Cc: stable@vger.kernel.org
Joe Thornber [Fri, 21 Dec 2012 20:23:31 +0000 (20:23 +0000)]
dm thin: replace dm_cell_release_singleton with cell_defer_except
Change existing users of the function dm_cell_release_singleton to share
cell_defer_except instead, and then remove the now-unused function.
Everywhere that calls dm_cell_release_singleton, the bio in question
is the holder of the cell.
If there are no non-holder entries in the cell then cell_defer_except
behaves exactly like dm_cell_release_singleton. Conversely, if there
*are* non-holder entries then dm_cell_release_singleton must not be used
because those entries would need to be deferred.
Consequently, it is safe to replace use of dm_cell_release_singleton
with cell_defer_except.
This patch is a pre-requisite for "dm thin: fix race between
simultaneous io and discards to same block".
Signed-off-by: Joe Thornber <ejt@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Mike Snitzer [Fri, 21 Dec 2012 20:23:30 +0000 (20:23 +0000)]
dm: disable WRITE SAME
WRITE SAME bios are not yet handled correctly by device-mapper so
disable their use on device-mapper devices by setting
max_write_same_sectors to zero.
As an example, a ciphertext device is incompatible because the data
gets changed according to the location at which it written and so the
dm crypt target cannot support it.
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Cc: stable@vger.kernel.org
Cc: Milan Broz <mbroz@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>