12 Dec, 2011

1 commit

  • The old PowerMac swim3 driver has some "interesting" locking issues,
    using a private lock and failing to lock the queue before completing
    requests, which triggered WARN_ONs among others.

    This rips out the private lock, makes everything operate under the
    block queue lock, and generally makes things simpler.

    We used to also share a queue between the two possible instances which
    was problematic since we might pick the wrong controller in some cases,
    so make the queue and the current request per-instance and use
    queuedata to point to our private data which is a lot cleaner.

    We still share the queue lock but then, it's nearly impossible to actually
    use 2 swim3's simultaneously: one would need to have a Wallstreet
    PowerBook, the only machine afaik with two of these on the motherboard,
    and populate both hotswap bays with a floppy drive (the machine ships
    only with one), so nobody cares...

    While at it, add a little fix to clear up stale interrupts when loading
    the driver or plugging a floppy drive in a bay.

    Signed-off-by: Benjamin Herrenschmidt
    Signed-off-by: Jens Axboe

    Benjamin Herrenschmidt
     

03 Aug, 2011

1 commit


22 Apr, 2011

1 commit

  • In-kernel disk event polling doesn't matter for legacy/fringe drivers
    and may lead to infinite event loop if ->check_events() implementation
    generates events on level condition instead of edge.

    Now that block layer supports suppressing exporting unlisted events,
    simply leaving disk->events cleared allows these drivers to keep the
    internal revalidation behavior intact while avoiding weird
    interactions with userland event handler.

    Signed-off-by: Tejun Heo
    Cc: Kay Sievers
    Signed-off-by: Jens Axboe

    Tejun Heo
     

10 Mar, 2011

1 commit

  • Convert from ->media_changed() to ->check_events().

    Both swim and swim3 buffer media changed state and clear it on
    revalidation. They will behave correctly with kernel event polling.

    Signed-off-by: Tejun Heo
    Cc: Jens Axboe
    Cc: Kay Sievers
    Cc: Laurent Vivier
    Cc: Benjamin Herrenschmidt

    Tejun Heo
     

05 Oct, 2010

1 commit

  • The block device drivers have all gained new lock_kernel
    calls from a recent pushdown, and some of the drivers
    were already using the BKL before.

    This turns the BKL into a set of per-driver mutexes.
    Still need to check whether this is safe to do.

    file=$1
    name=$2
    if grep -q lock_kernel ${file} ; then
    if grep -q 'include.*linux.mutex.h' ${file} ; then
    sed -i '/include.*/d' ${file}
    else
    sed -i 's/include.*.*$/include /g' ${file}
    fi
    sed -i ${file} \
    -e "/^#include.*linux.mutex.h/,$ {
    1,/^\(static\|int\|long\)/ {
    /^\(static\|int\|long\)/istatic DEFINE_MUTEX(${name}_mutex);

    } }" \
    -e "s/\(un\)*lock_kernel\>[ ]*()/mutex_\1lock(\&${name}_mutex)/g" \
    -e '/[ ]*cycle_kernel_lock();/d'
    else
    sed -i -e '/include.*\/d' ${file} \
    -e '/cycle_kernel_lock()/d'
    fi

    Signed-off-by: Arnd Bergmann

    Arnd Bergmann
     

08 Aug, 2010

2 commits

  • The open and release block_device_operations are currently
    called with the BKL held. In order to change that, we must
    first make sure that all drivers that currently rely
    on this have no regressions.

    This blindly pushes the BKL into all .open and .release
    operations for all block drivers to prepare for the
    next step. The drivers can subsequently replace the BKL
    with their own locks or remove it completely when it can
    be shown that it is not needed.

    The functions blkdev_get and blkdev_put are the only
    remaining users of the big kernel lock in the block
    layer, besides a few uses in the ioctl code, none
    of which need to serialize with blkdev_{get,put}.

    Most of these two functions is also under the protection
    of bdev->bd_mutex, including the actual calls to
    ->open and ->release, and the common code does not
    access any global data structures that need the BKL.

    Signed-off-by: Arnd Bergmann
    Acked-by: Christoph Hellwig
    Signed-off-by: Jens Axboe

    Arnd Bergmann
     
  • As a preparation for the removal of the big kernel
    lock in the block layer, this removes the BKL
    from the common ioctl handling code, moving it
    into every single driver still using it.

    Signed-off-by: Arnd Bergmann
    Acked-by: Christoph Hellwig
    Signed-off-by: Jens Axboe

    Arnd Bergmann
     

02 Jun, 2010

1 commit

  • Grant patches added an of mach table to struct device_driver. However,
    while he changed the macio device code to use that, he left the match
    table pointer in struct macio_driver and didn't update drivers to use
    the "new" one, thus breaking the probing.

    This completes the change by moving all drivers to setup the "new"
    one, removing all traces of the old one, and while at it (since it
    changes the exact same locations), I also remove two other duplicates
    from struct driver which are the name and owner fields.

    Signed-off-by: Benjamin Herrenschmidt

    Benjamin Herrenschmidt
     

19 May, 2010

1 commit


09 Dec, 2009

1 commit

  • The hotplug mediabay has tendrils deep into drivers/ide code
    which makes a libata port reather difficult. In addition it's
    ugly and could be done better.

    This reworks the interface between the mediabay and the rest
    of the world so that:

    - Any macio_driver can now have a mediabay_event callback
    which will be called when that driver sits on a mediabay and
    it's been either plugged or unplugged. The device type is
    passed as an argument. We can now move all the IDE cruft
    into the IDE driver itself

    - A check_media_bay() function can be used to take a peek
    at the type of device currently in the bay if any, a cleaner
    variant of the previous function with the same name.

    - A pair of lock/unlock functions are exposed to allow the
    IDE driver to block the hotplug callbacks during the initial
    setup and probing of the bay in order to avoid nasty race
    conditions.

    - The mediabay code no longer needs to spin on the status
    register of the IDE interface when it detects an IDE device,
    this is done just fine by the IDE code itself

    Overall, less code, simpler, and allows for another driver
    than our old drivers/ide based one.

    Signed-off-by: Benjamin Herrenschmidt

    Benjamin Herrenschmidt
     

22 Sep, 2009

2 commits

  • * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (34 commits)
    trivial: fix typo in aic7xxx comment
    trivial: fix comment typo in drivers/ata/pata_hpt37x.c
    trivial: typo in kernel-parameters.txt
    trivial: fix typo in tracing documentation
    trivial: add __init/__exit macros in drivers/gpio/bt8xxgpio.c
    trivial: add __init macro/ fix of __exit macro location in ipmi_poweroff.c
    trivial: remove unnecessary semicolons
    trivial: Fix duplicated word "options" in comment
    trivial: kbuild: remove extraneous blank line after declaration of usage()
    trivial: improve help text for mm debug config options
    trivial: doc: hpfall: accept disk device to unload as argument
    trivial: doc: hpfall: reduce risk that hpfall can do harm
    trivial: SubmittingPatches: Fix reference to renumbered step
    trivial: fix typos "man[ae]g?ment" -> "management"
    trivial: media/video/cx88: add __init/__exit macros to cx88 drivers
    trivial: fix typo in CONFIG_DEBUG_FS in gcov doc
    trivial: fix missing printk space in amd_k7_smp_check
    trivial: fix typo s/ketymap/keymap/ in comment
    trivial: fix typo "to to" in multiple files
    trivial: fix typos in comments s/DGBU/DBGU/
    ...

    Linus Torvalds
     
  • Signed-off-by: Alexey Dobriyan
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexey Dobriyan
     

21 Sep, 2009

1 commit


11 May, 2009

3 commits

  • Till now block layer allowed two separate modes of request execution.
    A request is always acquired from the request queue via
    elv_next_request(). After that, drivers are free to either dequeue it
    or process it without dequeueing. Dequeue allows elv_next_request()
    to return the next request so that multiple requests can be in flight.

    Executing requests without dequeueing has its merits mostly in
    allowing drivers for simpler devices which can't do sg to deal with
    segments only without considering request boundary. However, the
    benefit this brings is dubious and declining while the cost of the API
    ambiguity is increasing. Segment based drivers are usually for very
    old or limited devices and as converting to dequeueing model isn't
    difficult, it doesn't justify the API overhead it puts on block layer
    and its more modern users.

    Previous patches converted all block low level drivers to dequeueing
    model. This patch completes the API transition by...

    * renaming elv_next_request() to blk_peek_request()

    * renaming blkdev_dequeue_request() to blk_start_request()

    * adding blk_fetch_request() which is combination of peek and start

    * disallowing completion of queued (not started) requests

    * applying new API to all LLDs

    Renamings are for consistency and to break out of tree code so that
    it's apparent that out of tree drivers need updating.

    [ Impact: block request issue API cleanup, no functional change ]

    Signed-off-by: Tejun Heo
    Cc: Rusty Russell
    Cc: James Bottomley
    Cc: Mike Miller
    Cc: unsik Kim
    Cc: Paul Clements
    Cc: Tim Waugh
    Cc: Geert Uytterhoeven
    Cc: David S. Miller
    Cc: Laurent Vivier
    Cc: Jeff Garzik
    Cc: Jeremy Fitzhardinge
    Cc: Grant Likely
    Cc: Adrian McMenamin
    Cc: Stephen Rothwell
    Cc: Bartlomiej Zolnierkiewicz
    Cc: Borislav Petkov
    Cc: Sergei Shtylyov
    Cc: Alex Dubov
    Cc: Pierre Ossman
    Cc: David Woodhouse
    Cc: Markus Lidel
    Cc: Stefan Weinhuber
    Cc: Martin Schwidefsky
    Cc: Pete Zaitcev
    Cc: FUJITA Tomonori
    Signed-off-by: Jens Axboe

    Tejun Heo
     
  • swim3 has at most single request in flight and already tracks it using
    fd_req. Convert it to dequeuing model by updating request fetching
    and wrapping completion function.

    [ Impact: dequeue in-flight request ]

    Signed-off-by: Tejun Heo
    Signed-off-by: Jens Axboe

    Tejun Heo
     
  • With recent cleanups, there is no place where low level driver
    directly manipulates request fields. This means that the 'hard'
    request fields always equal the !hard fields. Convert all
    rq->sectors, nr_sectors and current_nr_sectors references to
    accessors.

    While at it, drop superflous blk_rq_pos() < 0 test in swim.c.

    [ Impact: use pos and nr_sectors accessors ]

    Signed-off-by: Tejun Heo
    Acked-by: Geert Uytterhoeven
    Tested-by: Grant Likely
    Acked-by: Grant Likely
    Tested-by: Adrian McMenamin
    Acked-by: Adrian McMenamin
    Acked-by: Mike Miller
    Cc: James Bottomley
    Cc: Bartlomiej Zolnierkiewicz
    Cc: Borislav Petkov
    Cc: Sergei Shtylyov
    Cc: Eric Moore
    Cc: Alan Stern
    Cc: FUJITA Tomonori
    Cc: Pete Zaitcev
    Cc: Stephen Rothwell
    Cc: Paul Clements
    Cc: Tim Waugh
    Cc: Jeff Garzik
    Cc: Jeremy Fitzhardinge
    Cc: Alex Dubov
    Cc: David Woodhouse
    Cc: Martin Schwidefsky
    Cc: Dario Ballabio
    Cc: David S. Miller
    Cc: Rusty Russell
    Cc: unsik Kim
    Cc: Laurent Vivier
    Signed-off-by: Jens Axboe

    Tejun Heo
     

28 Apr, 2009

2 commits

  • swim3 curiously tries to update request parameters before calling
    __blk_end_request() when __blk_end_request() will do it anyway, and it
    updates request for partial completion manually instead of using
    blk_update_request(). Also, it does some spurious checks on rq such
    as testing whether rq->sector is negative or current_nr_sectors is
    zero right after fetching.

    Drop unnecessary stuff and use standard block layer mechanisms.

    [ Impact: cleanup ]

    Signed-off-by: Tejun Heo
    Cc: Benjamin Herrenschmidt
    Signed-off-by: Jens Axboe

    Tejun Heo
     
  • end_request() has been kept around for backward compatibility;
    however, it's about time for it to go away.

    * There aren't too many users left.

    * Its use of @updtodate is pretty confusing.

    * In some cases, newer code ends up using mixture of end_request() and
    [__]blk_end_request[_all](), which is way too confusing.

    So, add [__]blk_end_request_cur() and replace end_request() with it.
    Most conversions are straightforward. Noteworthy ones are...

    * paride/pcd: next_request() updated to take 0/-errno instead of 1/0.

    * paride/pf: pf_end_request() and next_request() updated to take
    0/-errno instead of 1/0.

    * xd: xd_readwrite() updated to return 0/-errno instead of 1/0.

    * mtd/mtd_blkdevs: blktrans_discard_request() updated to return
    0/-errno instead of 1/0. Unnecessary local variable res
    initialization removed from mtd_blktrans_thread().

    [ Impact: cleanup ]

    Signed-off-by: Tejun Heo
    Acked-by: Joerg Dorchain
    Acked-by: Geert Uytterhoeven
    Acked-by: Grant Likely
    Acked-by: Laurent Vivier
    Cc: Tim Waugh
    Cc: Stephen Rothwell
    Cc: Paul Mackerras
    Cc: Jeremy Fitzhardinge
    Cc: Markus Lidel
    Cc: David Woodhouse
    Cc: Pete Zaitcev
    Cc: unsik Kim

    Tejun Heo
     

21 Oct, 2008

4 commits

  • Signed-off-by: Al Viro

    Al Viro
     
  • To keep the size of changesets sane we split the switch by drivers;
    to keep the damn thing bisectable we do the following:
    1) rename the affected methods, add ones with correct
    prototypes, make (few) callers handle both. That's this changeset.
    2) for each driver convert to new methods. *ALL* drivers
    are converted in this series.
    3) kill the old (renamed) methods.

    Note that it _is_ a flagday; all in-tree drivers are converted and by the
    end of this series no trace of old methods remain. The only reason why
    we do that this way is to keep the damn thing bisectable and allow per-driver
    debugging if anything goes wrong.

    New methods:
    open(bdev, mode)
    release(disk, mode)
    ioctl(bdev, mode, cmd, arg) /* Called without BKL */
    compat_ioctl(bdev, mode, cmd, arg)
    locked_ioctl(bdev, mode, cmd, arg) /* Called with BKL, legacy */

    Signed-off-by: Al Viro

    Al Viro
     
  • store needed information in f_mode

    Signed-off-by: Al Viro

    Al Viro
     
  • Signed-off-by: Al Viro

    Al Viro
     

15 Feb, 2008

1 commit

  • The current pmac32_defconfig fails to build with the following error:

    Building modules, stage 2.
    ERROR: "check_media_bay" [drivers/block/swim3.ko] undefined!
    WARNING: modpost: Found 23 section mismatch(es).
    To see full details build your kernel with:
    'make CONFIG_DEBUG_SECTION_MISMATCH=y'
    make[2]: *** [__modpost] Error 1

    This patch fixes that.

    Signed-off-by: Tony Breeds
    Acked-by: Benjamin Herrenschmidt
    Cc: Paul Mackerras
    Acked-by: Bartlomiej Zolnierkiewicz
    Cc: Josh Boyer
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Tony Breeds
     

24 Jul, 2007

1 commit

  • Some of the code has been gradually transitioned to using the proper
    struct request_queue, but there's lots left. So do a full sweet of
    the kernel and get rid of this typedef and replace its uses with
    the proper type.

    Signed-off-by: Jens Axboe

    Jens Axboe
     

05 Oct, 2006

1 commit

  • Maintain a per-CPU global "struct pt_regs *" variable which can be used instead
    of passing regs around manually through all ~1800 interrupt handlers in the
    Linux kernel.

    The regs pointer is used in few places, but it potentially costs both stack
    space and code to pass it around. On the FRV arch, removing the regs parameter
    from all the genirq function results in a 20% speed up of the IRQ exit path
    (ie: from leaving timer_interrupt() to leaving do_IRQ()).

    Where appropriate, an arch may override the generic storage facility and do
    something different with the variable. On FRV, for instance, the address is
    maintained in GR28 at all times inside the kernel as part of general exception
    handling.

    Having looked over the code, it appears that the parameter may be handed down
    through up to twenty or so layers of functions. Consider a USB character
    device attached to a USB hub, attached to a USB controller that posts its
    interrupts through a cascaded auxiliary interrupt controller. A character
    device driver may want to pass regs to the sysrq handler through the input
    layer which adds another few layers of parameter passing.

    I've build this code with allyesconfig for x86_64 and i386. I've runtested the
    main part of the code on FRV and i386, though I can't test most of the drivers.
    I've also done partial conversion for powerpc and MIPS - these at least compile
    with minimal configurations.

    This will affect all archs. Mostly the changes should be relatively easy.
    Take do_IRQ(), store the regs pointer at the beginning, saving the old one:

    struct pt_regs *old_regs = set_irq_regs(regs);

    And put the old one back at the end:

    set_irq_regs(old_regs);

    Don't pass regs through to generic_handle_irq() or __do_IRQ().

    In timer_interrupt(), this sort of change will be necessary:

    - update_process_times(user_mode(regs));
    - profile_tick(CPU_PROFILING, regs);
    + update_process_times(user_mode(get_irq_regs()));
    + profile_tick(CPU_PROFILING);

    I'd like to move update_process_times()'s use of get_irq_regs() into itself,
    except that i386, alone of the archs, uses something other than user_mode().

    Some notes on the interrupt handling in the drivers:

    (*) input_dev() is now gone entirely. The regs pointer is no longer stored in
    the input_dev struct.

    (*) finish_unlinks() in drivers/usb/host/ohci-q.c needs checking. It does
    something different depending on whether it's been supplied with a regs
    pointer or not.

    (*) Various IRQ handler function pointers have been moved to type
    irq_handler_t.

    Signed-Off-By: David Howells
    (cherry picked from 1b16e7ac850969f38b375e511e3fa2f474a33867 commit)

    David Howells
     

04 Oct, 2006

1 commit

  • drivers/block/swim3.c: In function 'swim3_interrupt':
    drivers/block/swim3.c:640: warning: format '%lx' expects type 'long unsigned int', but argument 3 has type 'unsigned int'
    drivers/block/swim3.c:746: warning: format '%lx' expects type 'long unsigned int', but argument 3 has type 'unsigned int'

    Update printk format string after blkdev.h change:
    Split struct request ->flags into two parts

    Signed-off-by: Olaf Hering
    Signed-off-by: Paul Mackerras

    Olaf Hering
     

01 Oct, 2006

1 commit

  • After Christophs SCSI change, the only usage left is RQ_ACTIVE
    and RQ_INACTIVE. The block layer sets RQ_INACTIVE right before freeing
    the request, so any check for RQ_INACTIVE in a driver is a bug and
    indicates use-after-free.

    So kill/clean the remaining users, straight forward.

    Signed-off-by: Jens Axboe

    Jens Axboe
     

03 Jul, 2006

1 commit


01 Jul, 2006

1 commit


27 Jun, 2006

3 commits


09 Jan, 2006

1 commit

  • The pre-parsed addrs/n_addrs fields in struct device_node are finally
    gone. Remove the dodgy heuristics that did that parsing at boot and
    remove the fields themselves since we now have a good replacement with
    the new OF parsing code. This patch also fixes a bunch of drivers to use
    the new code instead, so that at least pmac32, pseries, iseries and g5
    defconfigs build.

    Signed-off-by: Benjamin Herrenschmidt
    Signed-off-by: Paul Mackerras

    Benjamin Herrenschmidt
     

08 Nov, 2005

1 commit


11 Sep, 2005

1 commit


28 Jun, 2005

1 commit

  • This patch removes CONFIG_PMAC_PBOOK (PowerBook support). This is now
    split into CONFIG_PMAC_MEDIABAY for the actual hotswap bay that some
    powerbooks have, CONFIG_PM for power management related code, and just left
    out of any CONFIG_* option for some generally useful stuff that can be used
    on non-laptops as well.

    Signed-off-by: Benjamin Herrenschmidt
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Benjamin Herrenschmidt
     

17 Apr, 2005

1 commit

  • Initial git repository build. I'm not bothering with the full history,
    even though we have it. We can create a separate "historical" git
    archive of that later if we want to, and in the meantime it's about
    3.2GB when imported into git - space that would just make the early
    git days unnecessarily complicated, when we don't have a lot of good
    infrastructure for it.

    Let it rip!

    Linus Torvalds