1. 08 12月, 2015 1 次提交
  2. 29 7月, 2015 1 次提交
    • C
      block: add a bi_error field to struct bio · 4246a0b6
      Christoph Hellwig 提交于
      Currently we have two different ways to signal an I/O error on a BIO:
      
       (1) by clearing the BIO_UPTODATE flag
       (2) by returning a Linux errno value to the bi_end_io callback
      
      The first one has the drawback of only communicating a single possible
      error (-EIO), and the second one has the drawback of not beeing persistent
      when bios are queued up, and are not passed along from child to parent
      bio in the ever more popular chaining scenario.  Having both mechanisms
      available has the additional drawback of utterly confusing driver authors
      and introducing bugs where various I/O submitters only deal with one of
      them, and the others have to add boilerplate code to deal with both kinds
      of error returns.
      
      So add a new bi_error field to store an errno value directly in struct
      bio and remove the existing mechanisms to clean all this up.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Reviewed-by: NHannes Reinecke <hare@suse.de>
      Reviewed-by: NNeilBrown <neilb@suse.com>
      Signed-off-by: NJens Axboe <axboe@fb.com>
      4246a0b6
  3. 03 2月, 2015 1 次提交
  4. 18 6月, 2014 1 次提交
  5. 28 5月, 2014 1 次提交
    • J
      floppy: do not corrupt bio.bi_flags when reading block 0 · 6314a108
      Jiri Kosina 提交于
      Commit 41a55b4d ("floppy: silence warning during disk test") caused
      bio.bi_flags being overwritten, and its initialization to BIO_UPTODATE
      in bio_init() to be lost.
      
      This was unnoticed until 7b7b68bb ("floppy: bail out in open() if
      drive is not responding to block0 read"), because the error value wasn't
      checked for in the bio completion callback.
      
      Now we are actually looking at the error, and the loss of BIO_UPTODATE
      causes EIO to be wrongly passed to the callback, which confuses the
      FD_OPEN_SHOULD_FAIL_BIT logic.
      
      Fix this by not destroying previous value of bi_flags when setting
      BIO_QUIET.
      
      Cc: Stephen Hemminger <shemminger@vyatta.com>
      Reported-by: NTakashi Iwai <tiwai@suse.de>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      6314a108
  6. 05 5月, 2014 2 次提交
  7. 16 4月, 2014 1 次提交
    • J
      block: remove struct request buffer member · b4f42e28
      Jens Axboe 提交于
      This was used in the olden days, back when onions were proper
      yellow. Basically it mapped to the current buffer to be
      transferred. With highmem being added more than a decade ago,
      most drivers map pages out of a bio, and rq->buffer isn't
      pointing at anything valid.
      
      Convert old style drivers to just use bio_data().
      
      For the discard payload use case, just reference the page
      in the bio.
      Signed-off-by: NJens Axboe <axboe@fb.com>
      b4f42e28
  8. 07 3月, 2014 1 次提交
    • T
      floppy: don't use PREPARE_[DELAYED_]WORK · 75ddb38f
      Tejun Heo 提交于
      PREPARE_[DELAYED_]WORK() are being phased out.  They have few users
      and a nasty surprise in terms of reentrancy guarantee as workqueue
      considers work items to be different if they don't have the same work
      function.
      
      floppy has been multiplexing floppy_work and fd_timer with multiple
      work functions.  Introduce floppy_work_workfn() and fd_timer_workfn()
      which invoke floppy_work_fn and fd_timer_fn respectively and always
      use the two functions as the work functions and update the users to
      set floppy_work_fn and fd_timer_fn instead of overriding work
      functions using PREPARE_[DELAYED_]WORK().
      
      It would probably be best to route this with other related updates
      through the workqueue tree.
      
      Lightly tested using qemu.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Acked-by: NJiri Kosina <jkosina@suse.cz>
      75ddb38f
  9. 17 1月, 2014 1 次提交
    • J
      floppy: bail out in open() if drive is not responding to block0 read · 7b7b68bb
      Jiri Kosina 提交于
      In case reading of block 0 during open() fails, it is not the right thing
      to let open() succeed.
      
      Fix this by introducing FD_OPEN_SHOULD_FAIL_BIT flag, and setting it in
      case the bio callback encounters an error while trying to read block 0.
      
      As a bonus, this works around certain broken userspace (blkid), which is
      not able to properly handle read()s returning IO errors. Hence be nice to
      those, and bail out during open() already; if block 0 is not readable,
      read()s are not going to provide any meaningful data anyway.
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      7b7b68bb
  10. 24 11月, 2013 2 次提交
    • K
      block: Convert bio_for_each_segment() to bvec_iter · 7988613b
      Kent Overstreet 提交于
      More prep work for immutable biovecs - with immutable bvecs drivers
      won't be able to use the biovec directly, they'll need to use helpers
      that take into account bio->bi_iter.bi_bvec_done.
      
      This updates callers for the new usage without changing the
      implementation yet.
      Signed-off-by: NKent Overstreet <kmo@daterainc.com>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: "Ed L. Cashin" <ecashin@coraid.com>
      Cc: Nick Piggin <npiggin@kernel.dk>
      Cc: Lars Ellenberg <drbd-dev@lists.linbit.com>
      Cc: Jiri Kosina <jkosina@suse.cz>
      Cc: Paul Clements <Paul.Clements@steeleye.com>
      Cc: Jim Paris <jim@jtan.com>
      Cc: Geoff Levand <geoff@infradead.org>
      Cc: Yehuda Sadeh <yehuda@inktank.com>
      Cc: Sage Weil <sage@inktank.com>
      Cc: Alex Elder <elder@inktank.com>
      Cc: ceph-devel@vger.kernel.org
      Cc: Joshua Morris <josh.h.morris@us.ibm.com>
      Cc: Philip Kelleher <pjk1939@linux.vnet.ibm.com>
      Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Cc: Jeremy Fitzhardinge <jeremy@goop.org>
      Cc: Neil Brown <neilb@suse.de>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: linux390@de.ibm.com
      Cc: Nagalakshmi Nandigama <Nagalakshmi.Nandigama@lsi.com>
      Cc: Sreekanth Reddy <Sreekanth.Reddy@lsi.com>
      Cc: support@lsi.com
      Cc: "James E.J. Bottomley" <JBottomley@parallels.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Alexander Viro <viro@zeniv.linux.org.uk>
      Cc: Steven Whitehouse <swhiteho@redhat.com>
      Cc: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Guo Chao <yan@linux.vnet.ibm.com>
      Cc: Asai Thambi S P <asamymuthupa@micron.com>
      Cc: Selvan Mani <smani@micron.com>
      Cc: Sam Bradshaw <sbradshaw@micron.com>
      Cc: Matthew Wilcox <matthew.r.wilcox@intel.com>
      Cc: Keith Busch <keith.busch@intel.com>
      Cc: Stephen Hemminger <shemminger@vyatta.com>
      Cc: Quoc-Son Anh <quoc-sonx.anh@intel.com>
      Cc: Sebastian Ott <sebott@linux.vnet.ibm.com>
      Cc: Nitin Gupta <ngupta@vflare.org>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Jerome Marchand <jmarchan@redhat.com>
      Cc: Seth Jennings <sjenning@linux.vnet.ibm.com>
      Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
      Cc: Mike Snitzer <snitzer@redhat.com>
      Cc: Vivek Goyal <vgoyal@redhat.com>
      Cc: "Darrick J. Wong" <darrick.wong@oracle.com>
      Cc: Chris Metcalf <cmetcalf@tilera.com>
      Cc: Jan Kara <jack@suse.cz>
      Cc: linux-m68k@lists.linux-m68k.org
      Cc: linuxppc-dev@lists.ozlabs.org
      Cc: drbd-user@lists.linbit.com
      Cc: nbd-general@lists.sourceforge.net
      Cc: cbe-oss-dev@lists.ozlabs.org
      Cc: xen-devel@lists.xensource.com
      Cc: virtualization@lists.linux-foundation.org
      Cc: linux-raid@vger.kernel.org
      Cc: linux-s390@vger.kernel.org
      Cc: DL-MPTFusionLinux@lsi.com
      Cc: linux-scsi@vger.kernel.org
      Cc: devel@driverdev.osuosl.org
      Cc: linux-fsdevel@vger.kernel.org
      Cc: cluster-devel@redhat.com
      Cc: linux-mm@kvack.org
      Acked-by: NGeoff Levand <geoff@infradead.org>
      7988613b
    • K
      block: Abstract out bvec iterator · 4f024f37
      Kent Overstreet 提交于
      Immutable biovecs are going to require an explicit iterator. To
      implement immutable bvecs, a later patch is going to add a bi_bvec_done
      member to this struct; for now, this patch effectively just renames
      things.
      Signed-off-by: NKent Overstreet <kmo@daterainc.com>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: "Ed L. Cashin" <ecashin@coraid.com>
      Cc: Nick Piggin <npiggin@kernel.dk>
      Cc: Lars Ellenberg <drbd-dev@lists.linbit.com>
      Cc: Jiri Kosina <jkosina@suse.cz>
      Cc: Matthew Wilcox <willy@linux.intel.com>
      Cc: Geoff Levand <geoff@infradead.org>
      Cc: Yehuda Sadeh <yehuda@inktank.com>
      Cc: Sage Weil <sage@inktank.com>
      Cc: Alex Elder <elder@inktank.com>
      Cc: ceph-devel@vger.kernel.org
      Cc: Joshua Morris <josh.h.morris@us.ibm.com>
      Cc: Philip Kelleher <pjk1939@linux.vnet.ibm.com>
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Cc: "Michael S. Tsirkin" <mst@redhat.com>
      Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Cc: Jeremy Fitzhardinge <jeremy@goop.org>
      Cc: Neil Brown <neilb@suse.de>
      Cc: Alasdair Kergon <agk@redhat.com>
      Cc: Mike Snitzer <snitzer@redhat.com>
      Cc: dm-devel@redhat.com
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: linux390@de.ibm.com
      Cc: Boaz Harrosh <bharrosh@panasas.com>
      Cc: Benny Halevy <bhalevy@tonian.com>
      Cc: "James E.J. Bottomley" <JBottomley@parallels.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: "Nicholas A. Bellinger" <nab@linux-iscsi.org>
      Cc: Alexander Viro <viro@zeniv.linux.org.uk>
      Cc: Chris Mason <chris.mason@fusionio.com>
      Cc: "Theodore Ts'o" <tytso@mit.edu>
      Cc: Andreas Dilger <adilger.kernel@dilger.ca>
      Cc: Jaegeuk Kim <jaegeuk.kim@samsung.com>
      Cc: Steven Whitehouse <swhiteho@redhat.com>
      Cc: Dave Kleikamp <shaggy@kernel.org>
      Cc: Joern Engel <joern@logfs.org>
      Cc: Prasad Joshi <prasadjoshi.linux@gmail.com>
      Cc: Trond Myklebust <Trond.Myklebust@netapp.com>
      Cc: KONISHI Ryusuke <konishi.ryusuke@lab.ntt.co.jp>
      Cc: Mark Fasheh <mfasheh@suse.com>
      Cc: Joel Becker <jlbec@evilplan.org>
      Cc: Ben Myers <bpm@sgi.com>
      Cc: xfs@oss.sgi.com
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Len Brown <len.brown@intel.com>
      Cc: Pavel Machek <pavel@ucw.cz>
      Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
      Cc: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
      Cc: Ben Hutchings <ben@decadent.org.uk>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Guo Chao <yan@linux.vnet.ibm.com>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Asai Thambi S P <asamymuthupa@micron.com>
      Cc: Selvan Mani <smani@micron.com>
      Cc: Sam Bradshaw <sbradshaw@micron.com>
      Cc: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
      Cc: "Roger Pau Monné" <roger.pau@citrix.com>
      Cc: Jan Beulich <jbeulich@suse.com>
      Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
      Cc: Ian Campbell <Ian.Campbell@citrix.com>
      Cc: Sebastian Ott <sebott@linux.vnet.ibm.com>
      Cc: Christian Borntraeger <borntraeger@de.ibm.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Jiang Liu <jiang.liu@huawei.com>
      Cc: Nitin Gupta <ngupta@vflare.org>
      Cc: Jerome Marchand <jmarchand@redhat.com>
      Cc: Joe Perches <joe@perches.com>
      Cc: Peng Tao <tao.peng@emc.com>
      Cc: Andy Adamson <andros@netapp.com>
      Cc: fanchaoting <fanchaoting@cn.fujitsu.com>
      Cc: Jie Liu <jeff.liu@oracle.com>
      Cc: Sunil Mushran <sunil.mushran@gmail.com>
      Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
      Cc: Namjae Jeon <namjae.jeon@samsung.com>
      Cc: Pankaj Kumar <pankaj.km@samsung.com>
      Cc: Dan Magenheimer <dan.magenheimer@oracle.com>
      Cc: Mel Gorman <mgorman@suse.de>6
      4f024f37
  11. 25 10月, 2013 1 次提交
  12. 07 5月, 2013 1 次提交
  13. 24 3月, 2013 1 次提交
    • K
      block: Remove bi_idx references · 4f2ac93c
      Kent Overstreet 提交于
      For immutable bvecs, all bi_idx usage needs to be audited - so here
      we're removing all the unnecessary uses.
      
      Most of these are places where it was being initialized on a bio that
      was just allocated, a few others are conversions to standard macros.
      Signed-off-by: NKent Overstreet <koverstreet@google.com>
      CC: Jens Axboe <axboe@kernel.dk>
      4f2ac93c
  14. 23 11月, 2012 1 次提交
    • J
      floppy: destroy floppy workqueue before cleaning up the queue · eac7cc52
      Jiri Kosina 提交于
      We need to first destroy the floppy_wq workqueue before cleaning up
      the queue. Otherwise we might race with still pending work with the
      workqueue, but all the block queue already gone. This might lead to
      various oopses, such as
      
       CPU 0
       Pid: 6, comm: kworker/u:0 Not tainted 3.7.0-rc4 #1 Bochs Bochs
       RIP: 0010:[<ffffffff8134eef5>]  [<ffffffff8134eef5>] blk_peek_request+0xd5/0x1c0
       RSP: 0000:ffff88000dc7dd88  EFLAGS: 00010092
       RAX: 0000000000000001 RBX: 0000000000000000 RCX: 0000000000000000
       RDX: ffff88000f602688 RSI: ffffffff81fd95d8 RDI: 6b6b6b6b6b6b6b6b
       RBP: ffff88000dc7dd98 R08: ffffffff81fd95c8 R09: 0000000000000000
       R10: ffffffff81fd9480 R11: 0000000000000001 R12: 6b6b6b6b6b6b6b6b
       R13: ffff88000dc7dfd8 R14: ffff88000dc7dfd8 R15: 0000000000000000
       FS:  0000000000000000(0000) GS:ffffffff81e21000(0000) knlGS:0000000000000000
       CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
       CR2: 0000000000000000 CR3: 0000000001e11000 CR4: 00000000000006f0
       DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
       DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
       Process kworker/u:0 (pid: 6, threadinfo ffff88000dc7c000, task ffff88000dc5ecc0)
       Stack:
        0000000000000000 0000000000000000 ffff88000dc7ddb8 ffffffff8134efee
        ffff88000dc7ddb8 0000000000000000 ffff88000dc7dde8 ffffffff814aef3c
        ffffffff81e75d80 ffff88000dc0c640 ffff88000fbfb000 ffffffff814aed90
       Call Trace:
        [<ffffffff8134efee>] blk_fetch_request+0xe/0x30
        [<ffffffff814aef3c>] redo_fd_request+0x1ac/0x400
        [<ffffffff814aed90>] ? start_motor+0x130/0x130
        [<ffffffff8106b526>] process_one_work+0x136/0x450
        [<ffffffff8106af65>] ? manage_workers+0x205/0x2e0
        [<ffffffff8106bb6d>] worker_thread+0x14d/0x420
        [<ffffffff8106ba20>] ? rescuer_thread+0x1a0/0x1a0
        [<ffffffff8107075a>] kthread+0xba/0xc0
        [<ffffffff810706a0>] ? __kthread_parkme+0x80/0x80
        [<ffffffff818b553a>] ret_from_fork+0x7a/0xb0
        [<ffffffff810706a0>] ? __kthread_parkme+0x80/0x80
       Code: 0f 84 c0 00 00 00 83 f8 01 0f 85 e2 00 00 00 81 4b 40 00 00 80 00 48 89 df e8 58 f8 ff ff be fb ff ff ff
       fe ff ff <49> 8b 1c 24 49 39 dc 0f 85 2e ff ff ff 41 0f b6 84 24 28 04 00
       RIP  [<ffffffff8134eef5>] blk_peek_request+0xd5/0x1c0
        RSP <ffff88000dc7dd88>
      Reported-by: NFengguang Wu <fengguang.wu@intel.com>
      Tested-by: NFengguang Wu <fengguang.wu@intel.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      eac7cc52
  15. 30 10月, 2012 5 次提交
  16. 22 8月, 2012 2 次提交
    • T
      workqueue: deprecate __cancel_delayed_work() · 136b5721
      Tejun Heo 提交于
      Now that cancel_delayed_work() can be safely called from IRQ handlers,
      there's no reason to use __cancel_delayed_work().  Use
      cancel_delayed_work() instead of __cancel_delayed_work() and mark the
      latter deprecated.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Acked-by: NJens Axboe <axboe@kernel.dk>
      Cc: Jiri Kosina <jkosina@suse.cz>
      Cc: Roland Dreier <roland@kernel.org>
      Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
      136b5721
    • T
      workqueue: use mod_delayed_work() instead of __cancel + queue · e7c2f967
      Tejun Heo 提交于
      Now that mod_delayed_work() is safe to call from IRQ handlers,
      __cancel_delayed_work() followed by queue_delayed_work() can be
      replaced with mod_delayed_work().
      
      Most conversions are straight-forward except for the following.
      
      * net/core/link_watch.c: linkwatch_schedule_work() was doing a quite
        elaborate dancing around its delayed_work.  Collapse it such that
        linkwatch_work is queued for immediate execution if LW_URGENT and
        existing timer is kept otherwise.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Tomi Valkeinen <tomi.valkeinen@ti.com> 
      e7c2f967
  17. 31 7月, 2012 1 次提交
  18. 04 7月, 2012 2 次提交
    • A
      floppy: Run floppy initialization asynchronous · 0cc15d03
      Andi Kleen 提交于
      floppy_init is quite slow, 3s on my test system to determine
      that there is no floppy. Run it asynchronous to the other
      init calls to improve boot time.
      
      [jkosina@suse.cz: fix modular build]
      Signed-off-by: NAndi Kleen <ak@linux.intel.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      0cc15d03
    • L
      floppy: cancel any pending fd_timeouts before adding a new one · dab058fd
      Linus Torvalds 提交于
      In commit 070ad7e7 ("floppy: convert to delayed work and
      single-thread wq") the 'fd_timeout' timer was converted to a delayed
      work.  However, the "del_timer(&fd_timeout)" was lost in the process,
      and any previous pending timeouts would stay active when we then
      re-queued the timeout.
      
      This resulted in the floppy probe sequence having a (stale) 20s timeout
      rather than the intended 3s timeout, and thus made booting with the
      floppy driver (but no actual floppy controller) take much longer than it
      should.
      
      Of course, there's little reason for most people to compile the floppy
      driver into the kernel at all, which is why most people never noticed.
      
      Canceling the delayed work where we used to do the del_timer() fixes the
      issue, and makes the floppy probing use the proper new timeout instead.
      The three second timeout is still very wasteful, but better than the 20s
      one.
      Reported-and-tested-by: NAndi Kleen <ak@linux.intel.com>
      Reported-and-tested-by: NCalvin Walton <calvin.walton@kepstin.ca>
      Cc: Jiri Kosina <jkosina@suse.cz>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      dab058fd
  19. 18 5月, 2012 2 次提交
    • J
      floppy: remove floppy-specific O_EXCL handling · bfa10b8c
      Jiri Kosina 提交于
      Block layer now handles O_EXCL in a generic way for block devices.
      
      The semantics is however different for floppy and all other block devices,
      as floppy driver contains its own O_EXCL handling.
      
      The semantics for all-but-floppy bdevs is "there can be at most one O_EXCL
      open of this file", while for floppy bdev the semantics is "if someone has
      the bdev open with O_EXCL, noone else can open it".
      
      There is actual userspace-observable change in behavior because of this
      since commit e525fd89 ("block: make blkdev_get/put() handle exclusive
      access") -- on kernels containing this commit, mount of /dev/fd0 causes
      the fd0 block device be claimed with _EXCL, preventing subsequent
      open(/dev/fd0).
      
      Bring things back into shape, i.e.  make it possible, analogically to
      other block devices, to mount the floppy and open() it afterwards --
      remove the floppy-specific handling and let the generic bdev code O_EXCL
      handling take over.
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      Acked-by: NTejun Heo <tj@kernel.org>
      Acked-by: NNeilBrown <neilb@suse.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      bfa10b8c
    • J
      floppy: convert to delayed work and single-thread wq · 070ad7e7
      Jiri Kosina 提交于
      There are several races in floppy driver between bottom half
      (scheduled_work) and timers (fd_timeout, fd_timer). Due to slowness
      of the actual floppy devices, those races are never (at least to my
      knowledge) triggered on a bare floppy metal. However on virtualized
      (emulated) floppy drives, which are of course magnitudes faster
      than the real ones, these races trigger reliably. They usually exhibit
      themselves as NULL pointer dereferences during DMA setup, such as
      
      	BUG: unable to handle kernel NULL pointer dereference at 0000000a
      	[ ... snip ... ]
      	EIP: 0060:[<c02053d5>] EFLAGS: 00010293 CPU: 0
      	EAX: ffffe000 EBX: 0000000a ECX: 00000000 EDX: 0000000a
      	ESI: c05d2718 EDI: 00000000 EBP: 00000000 ESP: f540fe44
      	 DS: 007b ES: 007b FS: 00d8 GS: 0000 SS: 0068
      	Process swapper (pid: 0, ti=f540e000 task=c082d5a0 task.ti=c0826000)
      	Stack:
      	 ffffe000 00001ffc 00000000 00000000 00000000 c05d2718 c0708b40 f540fe80
      	 c020470f c05d2718 c0708b40 00000000 f540fe80 0000000a f540fee4 00000000
      	 c0708b40 f540fee4 00000000 00000000 c020526b 00000000 c05d2718 c0708b40
      	Call Trace:
      	 [<c020470f>] dump_trace+0xaf/0x110
      	 [<c020526b>] show_trace_log_lvl+0x4b/0x60
      	 [<c0205298>] show_trace+0x18/0x20
      	 [<c05c5811>] dump_stack+0x6d/0x72
      	 [<c0248527>] warn_slowpath_common+0x77/0xb0
      	 [<c02485f3>] warn_slowpath_fmt+0x33/0x40
      	 [<f7ec593c>] setup_DMA+0x14c/0x210 [floppy]
      	 [<f7ecaa95>] setup_rw_floppy+0x105/0x190 [floppy]
      	 [<c0256d08>] run_timer_softirq+0x168/0x2a0
      	 [<c024e762>] __do_softirq+0xc2/0x1c0
      	 [<c02042ed>] do_softirq+0x7d/0xb0
      	 [<f54d8a00>] 0xf54d89ff
      
      but other instances can be easily seen as well. This can be observed at least under
      VMWare, VirtualBox and KVM.
      
      This patch converts all the timers and bottom halfs to be processed in a single
      workqueue. This aproach has been already discussed back in 2010 if I remember
      correctly, and Acked by Linus [1], but it then never made it to the tree.
      
      This all is based on original idea and code of Stephen Hemminger.  I have
      ported original Stepen's code to the current state of the floppy driver, and
      performed quite some testing (on real hardware), which didn't reveal any issues
      (this includes not only writing and reading data, but also formatting
      (unfortunately I didn't find any Double-Density disks any more)). Ability to
      handle errors properly (supplying known bad floppies) has also been verified.
      
      [1] http://kerneltrap.org/mailarchive/linux-kernel/2010/6/11/4582092Based-on-patch-by: NStephen Hemminger <shemminger@vyatta.com>
      Acked-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      070ad7e7
  20. 30 3月, 2012 1 次提交
    • L
      x86: Remove the ancient and deprecated disable_hlt() and enable_hlt() facility · f6365201
      Len Brown 提交于
      The X86_32-only disable_hlt/enable_hlt mechanism was used by the
      32-bit floppy driver. Its effect was to replace the use of the
      HLT instruction inside default_idle() with cpu_relax() - essentially
      it turned off the use of HLT.
      
      This workaround was commented in the code as:
      
       "disable hlt during certain critical i/o operations"
      
       "This halt magic was a workaround for ancient floppy DMA
        wreckage. It should be safe to remove."
      
      H. Peter Anvin additionally adds:
      
       "To the best of my knowledge, no-hlt only existed because of
        flaky power distributions on 386/486 systems which were sold to
        run DOS.  Since DOS did no power management of any kind,
        including HLT, the power draw was fairly uniform; when exposed
        to the much hhigher noise levels you got when Linux used HLT
        caused some of these systems to fail.
      
        They were by far in the minority even back then."
      
      Alan Cox further says:
      
       "Also for the Cyrix 5510 which tended to go castors up if a HLT
        occurred during a DMA cycle and on a few other boxes HLT during
        DMA tended to go astray.
      
        Do we care ? I doubt it. The 5510 was pretty obscure, the 5520
        fixed it, the 5530 is probably the oldest still in any kind of
        use."
      
      So, let's finally drop this.
      Signed-off-by: NLen Brown <len.brown@intel.com>
      Signed-off-by: NJosh Boyer <jwboyer@redhat.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Acked-by: N"H. Peter Anvin" <hpa@zytor.com>
      Acked-by: NAlan Cox <alan@lxorguk.ukuu.org.uk>
      Cc: Stephen Hemminger <shemminger@vyatta.com
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: <stable@kernel.org>
      Link: http://lkml.kernel.org/n/tip-3rhk9bzf0x9rljkv488tloib@git.kernel.org
      [ If anyone cares then alternative instruction patching could be
        used to replace HLT with a one-byte NOP instruction. Much simpler. ]
      Signed-off-by: NIngo Molnar <mingo@kernel.org>
      f6365201
  21. 29 3月, 2012 1 次提交
  22. 06 3月, 2012 1 次提交
  23. 02 3月, 2012 1 次提交
  24. 09 2月, 2012 2 次提交
  25. 04 1月, 2012 1 次提交
  26. 21 9月, 2011 1 次提交
  27. 29 5月, 2011 1 次提交
    • L
      x86 idle floppy: deprecate disable_hlt() · 3b70b2e5
      Len Brown 提交于
      Plan to remove floppy_disable_hlt in 2012, an ancient
      workaround with comments that it should be removed.
      
      This allows us to remove clutter and a run-time branch
      from the idle code.
      
      WARN_ONCE() on invocation until it is removed.
      
      cc: x86@kernel.org
      cc: stable@kernel.org # .39.x
      Signed-off-by: NLen Brown <len.brown@intel.com>
      3b70b2e5
  28. 22 4月, 2011 1 次提交
    • T
      block: unexport DISK_EVENT_MEDIA_CHANGE for legacy/fringe drivers · 9fd097b1
      Tejun Heo 提交于
      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: NTejun Heo <tj@kernel.org>
      Cc: Kay Sievers <kay.sievers@vrfy.org>
      Signed-off-by: NJens Axboe <jaxboe@fusionio.com>
      9fd097b1
  29. 10 3月, 2011 2 次提交
    • J
      block: remove per-queue plugging · 7eaceacc
      Jens Axboe 提交于
      Code has been converted over to the new explicit on-stack plugging,
      and delay users have been converted to use the new API for that.
      So lets kill off the old plugging along with aops->sync_page().
      Signed-off-by: NJens Axboe <jaxboe@fusionio.com>
      7eaceacc
    • T
      floppy,{ami|ata}flop: Convert to bdops->check_events() · 1a8a74f0
      Tejun Heo 提交于
      Convert the floppy drivers from ->media_changed() to ->check_events().
      Both floppy and ataflop buffer media changed state bit and clear them
      on revalidation and will behave correctly with kernel event polling.
      
      I can't tell how amiflop clears its event and it's possible that it
      may generate spurious events when polled.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: Kay Sievers <kay.sievers@vrfy.org>
      1a8a74f0