James Bottomley [Tue, 19 Feb 2008 10:36:57 +0000 (11:36 +0100)]
libata: implement drain buffers
This just updates the libata slave configure routine to take advantage
of the block layer drain buffers. It also adjusts the size lengths in
the atapi code to add the drain buffer to the DMA length so the driver
knows it can rely on it.
I suspect I should also be checking for AHCI as well as ATA_DEV_ATAPI,
but I couldn't see how to do that easily.
tj: * atapi_drain_needed() added such that draining is applied to only
misc ATAPI commands.
* q->bounce_gfp used when allocating drain buffer.
* Now duplicate ATAPI PIO drain logic dropped.
* ata_dev_printk() used instead of sdev_printk().
James Bottomley [Tue, 19 Feb 2008 10:36:56 +0000 (11:36 +0100)]
libata: eliminate the home grown dma padding in favour of
that provided by the block layer
ATA requires that all DMA transfers begin and end on word boundaries.
Because of this, a large amount of machinery grew up in ide to adjust
scatterlists on this basis. However, as of 2.5, the block layer has a
dma_alignment variable which ensures both the beginning and length of a
DMA transfer are aligned on the dma_alignment boundary. Although the
block layer does adjust the beginning of the transfer to ensure this
happens, it doesn't actually adjust the length, it merely makes sure
that space is allocated for transfers beyond the declared length. The
upshot of this is that scatterlists may be padded to any size between
the actual length and the length adjusted to the dma_alignment safely
knowing that memory is allocated in this region.
Right at the moment, SCSI takes the default dma_aligment which is on a
512 byte boundary. Note that this aligment only applies to transfers
coming in from user space. However, since all kernel allocations are
automatically aligned on a minimum of 32 byte boundaries, it is safe to
adjust them in this manner as well.
tj: * Adjusting sg after padding is done in block layer. Make libata
set queue alignment correctly for ATAPI devices and drop broken
sg mangling from ata_sg_setup().
* Use request->raw_data_len for ATAPI transfer chunk size.
* Killed qc->raw_nbytes.
* Separated out killing qc->n_iter.
Tejun Heo [Tue, 19 Feb 2008 10:36:53 +0000 (11:36 +0100)]
block: implement request_queue->dma_drain_needed
Draining shouldn't be done for commands where overflow may indicate
data integrity issues. Add dma_drain_needed callback to
request_queue. Drain buffer is appened iff this function returns
non-zero.
Tejun Heo [Tue, 19 Feb 2008 10:36:35 +0000 (11:36 +0100)]
block: add request->raw_data_len
With padding and draining moved into it, block layer now may extend
requests as directed by queue parameters, so now a request has two
sizes - the original request size and the extended size which matches
the size of area pointed to by bios and later by sgs. The latter size
is what lower layers are primarily interested in when allocating,
filling up DMA tables and setting up the controller.
Both padding and draining extend the data area to accomodate
controller characteristics. As any controller which speaks SCSI can
handle underflows, feeding larger data area is safe.
So, this patch makes the primary data length field, request->data_len,
indicate the size of full data area and add a separate length field,
request->raw_data_len, for the unmodified request size. The latter is
used to report to higher layer (userland) and where the original
request size should be fed to the controller or device.
Tejun Heo [Tue, 19 Feb 2008 10:35:38 +0000 (11:35 +0100)]
block: update bio according to DMA alignment padding
DMA start address and transfer size alignment for PC requests are
achieved using bio_copy_user() instead of bio_map_user(). This works
because bio_copy_user() always uses full pages and block DMA alignment
isn't allowed to go over PAGE_SIZE.
However, the implementation didn't update the last bio of the request
to make this padding visible to lower layers. This patch makes
blk_rq_map_user() extend the last bio such that it includes the
padding area and the size of area pointed to by the request is
properly aligned.
Tejun Heo [Tue, 19 Feb 2008 10:35:37 +0000 (11:35 +0100)]
libata: update ATAPI overflow draining
For misc ATAPI commands which transfer variable length data to the
host, overflow can occur due to application or hardware bug. Such
overflows can be ignored safely as long as overflow data is properly
drained. libata HSM implementation has this implemented in
__atapi_pio_bytes() and recently updated for 2.6.24-rc but it requires
further improvements. Improve drain logic such that...
* Report overflow errors using ehi desc mechanism instead of printing
directly.
* Properly calculate the number of bytes to be drained considering
actual number of consumed bytes for partial draining.
Signed-off-by: Tejun Heo <htejun@gmail.com> Acked-by: Albert Lee <albertcc@tw.ibm.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Jens Axboe [Tue, 19 Feb 2008 09:20:37 +0000 (10:20 +0100)]
elevator: make elevator_get() attempt to load the appropriate module
Currently we fail if someone requests a valid io scheduler, but it's
modular and not currently loaded. That can happen from a driver init
asking for a different scheduler, or online switching through sysfs
as requested by a user.
This patch makes elevator_get() request_module() to attempt to load
the appropriate module, instead of requiring that done manually.
Jens Axboe [Tue, 19 Feb 2008 09:02:29 +0000 (10:02 +0100)]
cfq-iosched: add hlist for browsing parallel to the radix tree
It's cumbersome to browse a radix tree from start to finish, especially
since we modify keys when a process exits. So add a hlist for the single
purpose of browsing over all known cfq_io_contexts, used for exit,
io prio change, etc.
This fixes http://bugzilla.kernel.org/show_bug.cgi?id=9948
[PATCH] revert blockdev direct io back to 2.6.19 version
Andrew Vasquez is reporting as-iosched oopses and a 65% throughput
slowdown due to the recent special-casing of direct-io against
blockdevs. We don't know why either of these things are occurring.
The patch minimally reverts us back to the 2.6.19 code for a 2.6.20
release.
<-- snip -->
It has since been dead code, and unless someone wants to revive it now
it's time to remove it.
This patch also makes bio_release_pages() static again and removes the
ki_bio_count member from struct kiocb, reverting changes that had been
done for this dead code.
Signed-off-by: Adrian Bunk <bunk@kernel.org> Signed-off-by: Jens Axboe <axboe@carl.home.kernel.dk>
* git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6:
ide-cd: fix missing residual count setting in DMA mode
ht6560b: force prefetch for some devices
ht6560b can only do up to PIO mode 4
linux/hdsmart.h: fix goofups (take 2)
via82cxxx: add new PCI id for cx700
falconide: locking bugfix
MAINTAINERS: update ide-cd maintainer's email address
ide/libata: ST310211A has buggy HPA too
ide: Add missing base addresses for falconide and macide
Eric Paris [Mon, 18 Feb 2008 23:23:16 +0000 (18:23 -0500)]
Audit: use == not = in if statements
Clearly this was supposed to be an == not an = in the if statement.
This patch also causes us to stop processing execve args once we have
failed rather than continuing to loop on failure over and over and over.
Signed-off-by: Eric Paris <eparis@redhat.com> Acked-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Kiyoshi Ueda [Tue, 19 Feb 2008 00:41:26 +0000 (01:41 +0100)]
ide-cd: fix missing residual count setting in DMA mode
This patch fixes the missing residual count setting in DMA mode,
which was introduced during the conversion to blk-end-request.
The residual count could be used by the request submitter.
So if it isn't set correctly, some upper layers does not work.
(e.g. wodim for CD burning.)
The bug is in only DMA mode.
In PIO mode, we are setting the residual count correctly,
so no need to fix.
Prefetch needs to be set for some ide devices to work when connected to
a ht6560b interface. This was not always done properly, causing a system
with a HD and CD on the primary interface to not work properly. Or, in
effect, hang hard.
This patch forces prefetch on devices before checking whether it
is necessary to change the settings in the interface
This patch should also be applied to 2.4. I don't currently have a
2.4 tree around.
(also change my email address)
Signed-off-by: Jan Evert van Grootheest <janevert@caiway.nl> Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
commit 8ac4ce742c66100931b6f2d7a36b0df08bc721fe ("ide: fix host drivers
depending on ide_generic to probe for interfaces (take 2)") moved probing
to falconide but forgot to take care of Atari specific locking - fix it.
ide: Add missing base addresses for falconide and macide
commit 29dd59755a849cc6475faa6a75f3b804e23a6fc2 ("ide: remove ide_setup_ports")
forgot to take into account the base addresses for the CONTROL registers for
falconide and macide, as pointed out by Michael Schmitz.
Linus Torvalds [Mon, 18 Feb 2008 23:52:40 +0000 (15:52 -0800)]
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband:
RDMA/nes: Fix possible array overrun
RDMA/nes: Fix VLAN support
RDMA/nes: Fix MAC interrupt erroneously masked on ifdown
IB: Fix return value in ib_device_register_sysfs()
* git://git.kernel.org/pub/scm/linux/kernel/git/x86/linux-2.6-x86:
x86: fix lguest build failure
x86: reenable support for system without on node0
x86: CPA: avoid double checking of alias ranges
x86: CPA no alias checking for _NX
x86: zap invalid and unused pmds in early boot
x86: CPA, fix alias checks
* git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild:
kbuild: explain why DEBUG_SECTION_MISMATCH is UNDEFINED
kbuild: fix building vmlinux.o
kbuild: allow -fstack-protector to take effect
kconfig: fix select in combination with default
Rusty Russell [Sun, 3 Feb 2008 20:11:10 +0000 (07:11 +1100)]
x86: fix lguest build failure
drivers/lguest/x86/switcher_32.S:(.text+0x3815f8):
undefined reference to `LGUEST_PAGES_regs_trapnum'
This problem was caused by asm-offsets.c only having the offsets when
lguest *guest* support was set, not lguest host (host support used to
imply guest support, so now they're separate these bugs come out).
Lguest guest support and host support are separate config options:
they used to be tied together. Sort out which parts of asm-offsets are
needed for Guest and Host.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Cc: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Thomas Gleixner [Fri, 15 Feb 2008 21:17:57 +0000 (22:17 +0100)]
x86: CPA: avoid double checking of alias ranges
When the CPA code is called with an virtual address in the range of
the direct mapping or the high alias then we do not need to run
through the alias check for this range.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Thomas Gleixner [Fri, 15 Feb 2008 16:29:12 +0000 (17:29 +0100)]
x86: zap invalid and unused pmds in early boot
The early boot code maps KERNEL_TEXT_SIZE (currently 40MB) starting
from __START_KERNEL_map. The kernel itself only needs _text to _end
mapped in the high alias. On relocatible kernels the ASM setup code
adjusts the compile time created high mappings to the relocation. This
creates invalid pmd entries for negative offsets:
0xffffffff80000000 -> pmd entry: ffffffffff2001e3
It points outside of the physical address space and is marked present.
This starts at the virtual address __START_KERNEL_map and goes up to
the point where the first valid physical address (0x0) is mapped.
Zap the mappings before _text and after _end right away in early
boot. This removes also the invalid entries.
Furthermore it simplifies the range check for high aliases.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: H. Peter Anvin <hpa@zytor.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Thomas Gleixner [Mon, 18 Feb 2008 19:54:14 +0000 (20:54 +0100)]
x86: CPA, fix alias checks
c_p_a() did not discover all aliases correctly. (such as when called
on vmalloc()-ed areas or ioremap()-ed areas)
Push the alias checks to the lower, physical level and consistently
discover all aliases that might exist: the low direct mappings and
the high linear kernel-text mappings (on 64-bit).
Thanks to Andi Kleen for pointing out that this was buggy.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Ingo Molnar <mingo@elte.hu>
which leads to an array overrun if the index is exactly equal to
NES_MAX_USER_WQ_REGIONS. Fix this by bailing out if the index is
greater than or equal to NES_MAX_USER_WQ_REGIONS.
This was spotted by the Coverity checker (CID 2162).
Acked-by: Glenn Streiff <gstreiff@neteffect.com> Signed-off-by: Roland Dreier <rolandd@cisco.com>
V4L/DVB (7219): zoran: Fix namespace conflicts with Zoran 'GPIO_MAX' enum
Thanks to Martin Michlmayr <tbm@cyrius.com> for reporting this issue:
The zoran driver fails to compile on the ARM Orion platform with:
In file included from drivers/media/video/zoran_procfs.c:50:
drivers/media/video/zoran.h:232: error: expected identifier before numeric
constant
The reason is that drivers/media/video/zoran.h defines an enum with
GPIO_MAX in it, but Orion contains a #define GPIO_MAX 32 in
include/asm-arm/arch-orion/orion.h
V4L/DVB (7201): cx88-mpeg: Fix race condition in variable access
There was a possible race condition in the increment/decrement of
the active device references counter.
Thanks to Trent Piepho (xyzzy@speakeasy.org) for bringing it up.
Jiri Slaby [Wed, 13 Feb 2008 23:04:49 +0000 (20:04 -0300)]
V4L/DVB (7198): V4L, include ioctl.h in videodev headers
Fix compilation of user processes which includes videodev*.h but
not includes linux/ioctl.h:
v4l2ext_helper.c: In function 'process_ioctl':
v4l2ext_helper.c:183: warning: implicit declaration of function '_IOWR'
v4l2ext_helper.c:183: error: expected expression before 'struct'
v4l2ext_helper.c:183: error: case label does not reduce to an integer constant
The initial work to convert the bttv driver to V4L2 "Partial conversion
from V4L1 to V4L2" (e84619b17440ccca4e4db7583d126c4189b987e5), missed
the line which set the appropriate overlay crop structure in the newly
allocated bttv_buffer. This then causes a divide error in the
bttv_calc_geo function.
Signed-off-by: Robert Fitzsimons <robfitz@273k.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Roland Stoll [Mon, 11 Feb 2008 16:00:34 +0000 (13:00 -0300)]
V4L/DVB (7194): cx88-mpeg: Allow concurrent access to cx88-mpeg devices
It currently isn't possible to open the frontend device of cx88-mpeg devices
(DVB or Blackbird) multiple times concurrently. (for instance, to attach a
signal monitoring tool while reading a stream, or to send a frequency change
ioctl) This patch fixes that condition.
Signed-off-by: Roland Stoll <roland@xindex.de> Signed-off-by: Ricardo Cerqueira <v4l@cerqueira.org> Reviewed-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Tobias Lorenz [Tue, 5 Feb 2008 01:26:08 +0000 (22:26 -0300)]
V4L/DVB (7188): radio-si470x version 1.0.6
This patch combines all the finished discussions and its resulting patches from
the mailing list.
The version 1.0.6 is mainly influenced by Oliver Neukum. He found a lot of
small issues, that are fixed with this patch now. For me the most interesting
thing is, that it's now safer to use it on other architectures.
The history for version 1.0.6 is:
- fixed coverity checker warnings in *_usb_driver_disconnect
- probe()/open() race by correct ordering in probe()
- DMA coherency rules by separate allocation of all buffers
- use of endianness macros
- abuse of spinlock, replaced by mutex
- racy handling of timer in disconnect, replaced by delayed_work
- racy interruptible_sleep_on(), replaced with wait_event_interruptible()
- handle signals in read()
The driver is tested with all Debian/testing radio programs and rdsd. The patch
is tested against checkpatch.pl v1.12.
Michael Krufky [Sun, 10 Feb 2008 23:13:25 +0000 (20:13 -0300)]
V4L/DVB (7183): radio-si470x: fix build warning
fix the following build warning:
radio-si470x.c: In function 'si470x_get_rds_registers':
radio-si470x.c:562: warning: format '%ld' expects type 'long int',
but argument 3 has type 'unsigned int'
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
So, only one board could use an USB host at the same time. After the patch, it
is possible to use more than one em28xx at the same time, on the same usb host,
if the image size is slower or equal to 345600, since those images will
require about 30% of the URBs:
Andrew Morton [Tue, 5 Feb 2008 10:37:21 +0000 (07:37 -0300)]
V4L/DVB (7156): em28xx/em28xx-core.c: fix use of potentially uninitialized variable
drivers/media/video/em28xx/em28xx-core.c: In function 'em28xx_set_audio_source':
drivers/media/video/em28xx/em28xx-core.c:276: warning: 'no_ac97' may be used uninitialized in this function
This looks like a genuine bug to me.
Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Tobias Lorenz [Tue, 29 Jan 2008 01:43:13 +0000 (22:43 -0300)]
V4L/DVB (7108): radio-si470x.c: check-after-use
Adrian used the coverity checker against radio-si470x and found this:
> The Coverity checker spotted the following check-after-use in
> drivers/media/radio/radio-si470x.c:
>
> <-- snip -->
> static void si470x_usb_driver_disconnect(struct usb_interface *intf)
> {
> struct si470x_device *radio = usb_get_intfdata(intf);
>
> del_timer_sync(&radio->timer); <------------------
> flush_scheduled_work();
>
> usb_set_intfdata(intf, NULL);
> if (radio) { <------------------
> video_unregister_device(radio->videodev);
> kfree(radio->buffer);
> kfree(radio);
> }
> }
> <-- snip -->
>
> Either "radio" can be NULL and this case has to be properly handled or
> the NULL check is not required.
These two lines should indeed better be inside the if statement.
Adrian Bunk [Tue, 29 Jan 2008 01:11:15 +0000 (22:11 -0300)]
V4L/DVB (7102): make tuner-core.c:tuner_list static
tuner_list can become static - and it's anyway a way too generic name
for a global variable - see commit b00ef4b8d8c29bfb5f6f92ee60bc04b604f36ef2
for a completely different global variable of the same name I just made
static...
Signed-off-by: Adrian Bunk <bunk@kernel.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
This patch changed the request_region() validation to avoid invalid return.
Thanks to Roland Kletzing <devzero@web.de> for bug report and data collection.
Signed-off-by: Douglas Schilling Landgraf <dougsland@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Tobias Lorenz [Sun, 27 Jan 2008 17:54:07 +0000 (14:54 -0300)]
V4L/DVB (7091): radio-si470x improvements and seldom problem fixed in tuning functions
I updated the radio-si470x driver another time. Here are the commented history entries:
- number of seek_retries changed to tune_timeout
The last versions checked for the end of frequency tuning by polling a si470x register.
Therefore polling depended on the usb utilization.
This was changed to have a constant timeout now.
- fixed problem with incomplete tune operations by own buffers
The last version used a shared buffer to assembly the USB HID reports.
It sometimes happened, that multiple functions were modifing this buffer simultanuously.
When sending such reports, the hardware returned USB stalls (-EPIPE).
Now buffers of the correct size (smaller than before) are allocated as local variables.
- optimization of variables
The size of some variables has been reduced to allow the compiler to generate more optimized code.
- improved error logging
At some important location, error checking was improved.
Especially the usb transfers to access si470x registers and the tuning functions were modified.
Hermann Pitton [Sun, 20 Jan 2008 22:42:01 +0000 (19:42 -0300)]
V4L/DVB (7084): saa7134: add support for the Medion / Creatix CTX948 card
This adds support for analog inputs and DVB-T.
Good sensitivity for DVB-T currently needs to use analog TV first.
DVB-S support is not yet completed, but is on the way.
As pointed by Adrian Bunk, with I2C=m and VIDEO_DEV=y, videodev brokes.
This patch moves the functions that videodev needs from v4l2-common. It also
fixes some Kconfig changes.
After this patch, I2C=m / VIDEO_DEV=y will make v4l2 core statically linked
into kernel. v4l2-common will be m, and all V4L drivers will also be m.
This approach is very conservative, since it is possible to have V4L drivers
that don't need I2C or v4l2-common. The better is to map what drivers really
need v4l2-common, making them to select v4l2-common, and allowing the others to
be 'y', 'm' and 'n'.