1. 28 2月, 2013 1 次提交
    • S
      hlist: drop the node parameter from iterators · b67bfe0d
      Sasha Levin 提交于
      I'm not sure why, but the hlist for each entry iterators were conceived
      
              list_for_each_entry(pos, head, member)
      
      The hlist ones were greedy and wanted an extra parameter:
      
              hlist_for_each_entry(tpos, pos, head, member)
      
      Why did they need an extra pos parameter? I'm not quite sure. Not only
      they don't really need it, it also prevents the iterator from looking
      exactly like the list iterator, which is unfortunate.
      
      Besides the semantic patch, there was some manual work required:
      
       - Fix up the actual hlist iterators in linux/list.h
       - Fix up the declaration of other iterators based on the hlist ones.
       - A very small amount of places were using the 'node' parameter, this
       was modified to use 'obj->member' instead.
       - Coccinelle didn't handle the hlist_for_each_entry_safe iterator
       properly, so those had to be fixed up manually.
      
      The semantic patch which is mostly the work of Peter Senna Tschudin is here:
      
      @@
      iterator name hlist_for_each_entry, hlist_for_each_entry_continue, hlist_for_each_entry_from, hlist_for_each_entry_rcu, hlist_for_each_entry_rcu_bh, hlist_for_each_entry_continue_rcu_bh, for_each_busy_worker, ax25_uid_for_each, ax25_for_each, inet_bind_bucket_for_each, sctp_for_each_hentry, sk_for_each, sk_for_each_rcu, sk_for_each_from, sk_for_each_safe, sk_for_each_bound, hlist_for_each_entry_safe, hlist_for_each_entry_continue_rcu, nr_neigh_for_each, nr_neigh_for_each_safe, nr_node_for_each, nr_node_for_each_safe, for_each_gfn_indirect_valid_sp, for_each_gfn_sp, for_each_host;
      
      type T;
      expression a,c,d,e;
      identifier b;
      statement S;
      @@
      
      -T b;
          <+... when != b
      (
      hlist_for_each_entry(a,
      - b,
      c, d) S
      |
      hlist_for_each_entry_continue(a,
      - b,
      c) S
      |
      hlist_for_each_entry_from(a,
      - b,
      c) S
      |
      hlist_for_each_entry_rcu(a,
      - b,
      c, d) S
      |
      hlist_for_each_entry_rcu_bh(a,
      - b,
      c, d) S
      |
      hlist_for_each_entry_continue_rcu_bh(a,
      - b,
      c) S
      |
      for_each_busy_worker(a, c,
      - b,
      d) S
      |
      ax25_uid_for_each(a,
      - b,
      c) S
      |
      ax25_for_each(a,
      - b,
      c) S
      |
      inet_bind_bucket_for_each(a,
      - b,
      c) S
      |
      sctp_for_each_hentry(a,
      - b,
      c) S
      |
      sk_for_each(a,
      - b,
      c) S
      |
      sk_for_each_rcu(a,
      - b,
      c) S
      |
      sk_for_each_from
      -(a, b)
      +(a)
      S
      + sk_for_each_from(a) S
      |
      sk_for_each_safe(a,
      - b,
      c, d) S
      |
      sk_for_each_bound(a,
      - b,
      c) S
      |
      hlist_for_each_entry_safe(a,
      - b,
      c, d, e) S
      |
      hlist_for_each_entry_continue_rcu(a,
      - b,
      c) S
      |
      nr_neigh_for_each(a,
      - b,
      c) S
      |
      nr_neigh_for_each_safe(a,
      - b,
      c, d) S
      |
      nr_node_for_each(a,
      - b,
      c) S
      |
      nr_node_for_each_safe(a,
      - b,
      c, d) S
      |
      - for_each_gfn_sp(a, c, d, b) S
      + for_each_gfn_sp(a, c, d) S
      |
      - for_each_gfn_indirect_valid_sp(a, c, d, b) S
      + for_each_gfn_indirect_valid_sp(a, c, d) S
      |
      for_each_host(a,
      - b,
      c) S
      |
      for_each_host_safe(a,
      - b,
      c, d) S
      |
      for_each_mesh_entry(a,
      - b,
      c, d) S
      )
          ...+>
      
      [akpm@linux-foundation.org: drop bogus change from net/ipv4/raw.c]
      [akpm@linux-foundation.org: drop bogus hunk from net/ipv6/raw.c]
      [akpm@linux-foundation.org: checkpatch fixes]
      [akpm@linux-foundation.org: fix warnings]
      [akpm@linux-foudnation.org: redo intrusive kvm changes]
      Tested-by: NPeter Senna Tschudin <peter.senna@gmail.com>
      Acked-by: NPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      Signed-off-by: NSasha Levin <sasha.levin@oracle.com>
      Cc: Wu Fengguang <fengguang.wu@intel.com>
      Cc: Marcelo Tosatti <mtosatti@redhat.com>
      Cc: Gleb Natapov <gleb@redhat.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      b67bfe0d
  2. 24 2月, 2013 1 次提交
  3. 22 10月, 2012 1 次提交
  4. 11 7月, 2012 1 次提交
  5. 11 6月, 2012 1 次提交
  6. 22 5月, 2012 1 次提交
    • S
      9p: disconnect channel when PCI device is removed · 991ad9ec
      Sasha Levin 提交于
      When a virtio_9p pci device is being removed, we should close down any
      active channels and free up resources, we're not supposed to BUG() if there's
      still an open channel since it's a valid case when removing the PCI device.
      
      Otherwise, removing the PCI device with an open channel would cause the
      following BUG():
      
      [ 1184.671416] ------------[ cut here ]------------
      [ 1184.672057] kernel BUG at net/9p/trans_virtio.c:618!
      [ 1184.672057] invalid opcode: 0000 [#1] PREEMPT SMP
      [ 1184.672057] CPU 3
      [ 1184.672057] Pid: 5, comm: kworker/u:0 Tainted: G        W    3.4.0-rc2-next-20120413-sasha-dirty #76
      [ 1184.672057] RIP: 0010:[<ffffffff825c9116>]  [<ffffffff825c9116>] p9_virtio_remove+0x16/0x90
      [ 1184.672057] RSP: 0018:ffff88000d653ac0  EFLAGS: 00010202
      [ 1184.672057] RAX: ffffffff836bfb40 RBX: ffff88000c9b2148 RCX: ffff88000d658978
      [ 1184.672057] RDX: 0000000000000006 RSI: 0000000000000000 RDI: ffff880028868000
      [ 1184.672057] RBP: ffff88000d653ad0 R08: 0000000000000000 R09: 0000000000000000
      [ 1184.672057] R10: 0000000000000000 R11: 0000000000000001 R12: ffff880028868000
      [ 1184.672057] R13: ffffffff835aa7c0 R14: ffff880041630000 R15: ffff88000d653da0
      [ 1184.672057] FS:  0000000000000000(0000) GS:ffff880035a00000(0000) knlGS:0000000000000000
      [ 1184.672057] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
      [ 1184.672057] CR2: 0000000001181000 CR3: 000000000eba1000 CR4: 00000000000406e0
      [ 1184.672057] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      x000000000117a190 *[ 1184.672057] DR3: 00000000000000**
      00 DR6: 00000000ffff0ff0 DR7: 0000000000000400
      [ 1184.672057] Process kworker/u:0 (pid: 5, threadinfo ffff88000d652000, task ffff88000d658000)
      [ 1184.672057] Stack:
      [ 1184.672057]  ffff880028868000 ffffffff836bfb40 ffff88000d653af0 ffffffff8193661b
      [ 1184.672057]  ffff880028868008 ffffffff836bfb40 ffff88000d653b10 ffffffff81af1c81
      [ 1184.672057]  ffff880028868068 ffff880028868008 ffff88000d653b30 ffffffff81af257a
      [ 1184.795301] Call Trace:
      [ 1184.795301]  [<ffffffff8193661b>] virtio_dev_remove+0x1b/0x60
      [ 1184.795301]  [<ffffffff81af1c81>] __device_release_driver+0x81/0xd0
      [ 1184.795301]  [<ffffffff81af257a>] device_release_driver+0x2a/0x40
      [ 1184.795301]  [<ffffffff81af0d48>] bus_remove_device+0x138/0x150
      [ 1184.795301]  [<ffffffff81aef08d>] device_del+0x14d/0x1b0
      [ 1184.795301]  [<ffffffff81aef138>] device_unregister+0x48/0x60
      [ 1184.795301]  [<ffffffff8193694d>] unregister_virtio_device+0xd/0x10
      [ 1184.795301]  [<ffffffff8265fc74>] virtio_pci_remove+0x2a/0x6c
      [ 1184.795301]  [<ffffffff818a95ad>] pci_device_remove+0x4d/0x110
      [ 1184.795301]  [<ffffffff81af1c81>] __device_release_driver+0x81/0xd0
      [ 1184.795301]  [<ffffffff81af257a>] device_release_driver+0x2a/0x40
      [ 1184.795301]  [<ffffffff81af0d48>] bus_remove_device+0x138/0x150
      [ 1184.795301]  [<ffffffff81aef08d>] device_del+0x14d/0x1b0
      [ 1184.795301]  [<ffffffff81aef138>] device_unregister+0x48/0x60
      [ 1184.795301]  [<ffffffff818a36fa>] pci_stop_bus_device+0x6a/0x90
      [ 1184.795301]  [<ffffffff818a3791>] pci_stop_and_remove_bus_device+0x11/0x20
      [ 1184.795301]  [<ffffffff818c21d9>] remove_callback+0x9/0x10
      [ 1184.795301]  [<ffffffff81252d91>] sysfs_schedule_callback_work+0x21/0x60
      [ 1184.795301]  [<ffffffff810cb1a1>] process_one_work+0x281/0x430
      [ 1184.795301]  [<ffffffff810cb140>] ? process_one_work+0x220/0x430
      [ 1184.795301]  [<ffffffff81252d70>] ? sysfs_read_file+0x1c0/0x1c0
      [ 1184.795301]  [<ffffffff810cc613>] worker_thread+0x1f3/0x320
      [ 1184.795301]  [<ffffffff810cc420>] ? manage_workers.clone.13+0x130/0x130
      [ 1184.795301]  [<ffffffff810d30b2>] kthread+0xb2/0xc0
      [ 1184.795301]  [<ffffffff826783f4>] kernel_thread_helper+0x4/0x10
      [ 1184.795301]  [<ffffffff810deb18>] ? finish_task_switch+0x78/0xf0
      [ 1184.795301]  [<ffffffff82676574>] ? retint_restore_args+0x13/0x13
      [ 1184.795301]  [<ffffffff810d3000>] ? kthread_flush_work_fn+0x10/0x10
      [ 1184.795301]  [<ffffffff826783f0>] ? gs_change+0x13/0x13
      [ 1184.795301] Code: c1 9e 0a 00 48 83 c4 08 5b c9 c3 66 2e 0f 1f 84 00 00 00 00 00 55 48 89 e5 41 54 49 89 fc 53 48 8b 9f a8 04 00 00 80 3b 00 74 0a <0f> 0b 0f 1f 84 00 00 00 00 00 48 8b 87 88 04 00 00 ff 50 30 31
      [ 1184.795301] RIP  [<ffffffff825c9116>] p9_virtio_remove+0x16/0x90
      [ 1184.795301]  RSP <ffff88000d653ac0>
      [ 1184.952618] ---[ end trace a307b3ed40206b4c ]---
      Signed-off-by: NSasha Levin <levinsasha928@gmail.com>
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      991ad9ec
  7. 12 1月, 2012 1 次提交
  8. 06 1月, 2012 1 次提交
    • J
      9p: Reduce object size with CONFIG_NET_9P_DEBUG · 5d385153
      Joe Perches 提交于
      Reduce object size by deduplicating formats.
      
      Use vsprintf extension %pV.
      Rename P9_DPRINTK uses to p9_debug, align arguments.
      Add function for _p9_debug and macro to add __func__.
      Add missing "\n"s to p9_debug uses.
      Remove embedded function names as p9_debug adds it.
      Remove P9_EPRINTK macro and convert use to pr_<level>.
      Add and use pr_fmt and pr_<level>.
      
      $ size fs/9p/built-in.o*
         text	   data	    bss	    dec	    hex	filename
        62133	    984	  16000	  79117	  1350d	fs/9p/built-in.o.new
        67342	    984	  16928	  85254	  14d06	fs/9p/built-in.o.old
      $ size net/9p/built-in.o*
         text	   data	    bss	    dec	    hex	filename
        88792	   4148	  22024	 114964	  1c114	net/9p/built-in.o.new
        94072	   4148	  23232	 121452	  1da6c	net/9p/built-in.o.old
      Signed-off-by: NJoe Perches <joe@perches.com>
      Signed-off-by: NEric Van Hensbergen <ericvh@gmail.com>
      5d385153
  9. 25 10月, 2011 1 次提交
    • A
      fs/9p: Update zero-copy implementation in 9p · abfa034e
      Aneesh Kumar K.V 提交于
      * remove lot of update to different data structure
      * add a seperate callback for zero copy request.
      * above makes non zero copy code path simpler
      * remove conditionalizing TREAD/TREADDIR/TWRITE in the zero copy path
      * Fix the dotu p9_check_errors with zero copy. Add sufficient doc around
      * Add support for both in and output buffers in zero copy callback
      * pin and unpin pages in the same context
      * use helpers instead of defining page offset and rest of page ourself
      * Fix mem leak in p9_check_errors
      * Remove 'E' and 'F' in p9pdu_vwritef
      Signed-off-by: NAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
      Signed-off-by: NEric Van Hensbergen <ericvh@gmail.com>
      abfa034e
  10. 06 9月, 2011 1 次提交
  11. 23 7月, 2011 2 次提交
  12. 16 4月, 2011 1 次提交
  13. 23 3月, 2011 4 次提交
  14. 15 3月, 2011 2 次提交
  15. 28 10月, 2010 2 次提交
  16. 28 9月, 2010 1 次提交
    • S
      net/9p: Mount only matching virtio channels · 0b20406c
      Sven Eckelmann 提交于
      p9_virtio_create will only compare the the channel's tag characters
      against the device name till the end of the channel's tag but not till
      the end of the device name. This means that if a user defines channels
      with the tags foo and foobar then he would mount foo when he requested
      foonot and may mount foo when he requested foobar.
      
      Thus it is necessary to check both string lengths against each other in
      case of a successful partial string match.
      Signed-off-by: NSven Eckelmann <sven.eckelmann@gmx.de>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      0b20406c
  17. 19 5月, 2010 1 次提交
  18. 30 3月, 2010 1 次提交
    • T
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking... · 5a0e3ad6
      Tejun Heo 提交于
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
      
      percpu.h is included by sched.h and module.h and thus ends up being
      included when building most .c files.  percpu.h includes slab.h which
      in turn includes gfp.h making everything defined by the two files
      universally available and complicating inclusion dependencies.
      
      percpu.h -> slab.h dependency is about to be removed.  Prepare for
      this change by updating users of gfp and slab facilities include those
      headers directly instead of assuming availability.  As this conversion
      needs to touch large number of source files, the following script is
      used as the basis of conversion.
      
        http://userweb.kernel.org/~tj/misc/slabh-sweep.py
      
      The script does the followings.
      
      * Scan files for gfp and slab usages and update includes such that
        only the necessary includes are there.  ie. if only gfp is used,
        gfp.h, if slab is used, slab.h.
      
      * When the script inserts a new include, it looks at the include
        blocks and try to put the new include such that its order conforms
        to its surrounding.  It's put in the include block which contains
        core kernel includes, in the same order that the rest are ordered -
        alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
        doesn't seem to be any matching order.
      
      * If the script can't find a place to put a new include (mostly
        because the file doesn't have fitting include block), it prints out
        an error message indicating which .h file needs to be added to the
        file.
      
      The conversion was done in the following steps.
      
      1. The initial automatic conversion of all .c files updated slightly
         over 4000 files, deleting around 700 includes and adding ~480 gfp.h
         and ~3000 slab.h inclusions.  The script emitted errors for ~400
         files.
      
      2. Each error was manually checked.  Some didn't need the inclusion,
         some needed manual addition while adding it to implementation .h or
         embedding .c file was more appropriate for others.  This step added
         inclusions to around 150 files.
      
      3. The script was run again and the output was compared to the edits
         from #2 to make sure no file was left behind.
      
      4. Several build tests were done and a couple of problems were fixed.
         e.g. lib/decompress_*.c used malloc/free() wrappers around slab
         APIs requiring slab.h to be added manually.
      
      5. The script was run on all .h files but without automatically
         editing them as sprinkling gfp.h and slab.h inclusions around .h
         files could easily lead to inclusion dependency hell.  Most gfp.h
         inclusion directives were ignored as stuff from gfp.h was usually
         wildly available and often used in preprocessor macros.  Each
         slab.h inclusion directive was examined and added manually as
         necessary.
      
      6. percpu.h was updated not to include slab.h.
      
      7. Build test were done on the following configurations and failures
         were fixed.  CONFIG_GCOV_KERNEL was turned off for all tests (as my
         distributed build env didn't work with gcov compiles) and a few
         more options had to be turned off depending on archs to make things
         build (like ipr on powerpc/64 which failed due to missing writeq).
      
         * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
         * powerpc and powerpc64 SMP allmodconfig
         * sparc and sparc64 SMP allmodconfig
         * ia64 SMP allmodconfig
         * s390 SMP allmodconfig
         * alpha SMP allmodconfig
         * um on x86_64 SMP allmodconfig
      
      8. percpu.h modifications were reverted so that it could be applied as
         a separate patch and serve as bisection point.
      
      Given the fact that I had only a couple of failures from tests on step
      6, I'm fairly confident about the coverage of this conversion patch.
      If there is a breakage, it's likely to be something in one of the arch
      headers which should be easily discoverable easily on most builds of
      the specific arch.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Guess-its-ok-by: NChristoph Lameter <cl@linux-foundation.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
      5a0e3ad6
  19. 13 3月, 2010 2 次提交
  20. 06 3月, 2010 3 次提交
  21. 09 2月, 2010 2 次提交
    • A
      9p: Fix the kernel crash on a failed mount · fb786100
      Aneesh Kumar K.V 提交于
      The patch fix the crash repoted below
      
      [   15.149907] BUG: unable to handle kernel NULL pointer dereference at 00000001
      [   15.150806] IP: [<c140b886>] p9_virtio_close+0x18/0x24
      .....
      ....
      [   15.150806] Call Trace:
      [   15.150806]  [<c1408e78>] ? p9_client_destroy+0x3f/0x163
      [   15.150806]  [<c1409342>] ? p9_client_create+0x25f/0x270
      [   15.150806]  [<c1063b72>] ? trace_hardirqs_on+0xb/0xd
      [   15.150806]  [<c11ed4e8>] ? match_token+0x64/0x164
      [   15.150806]  [<c1175e8d>] ? v9fs_session_init+0x2f1/0x3c8
      [   15.150806]  [<c109cfc9>] ? kmem_cache_alloc+0x98/0xb8
      [   15.150806]  [<c1063b72>] ? trace_hardirqs_on+0xb/0xd
      [   15.150806]  [<c1173dd1>] ? v9fs_get_sb+0x47/0x1e8
      [   15.150806]  [<c1173dea>] ? v9fs_get_sb+0x60/0x1e8
      [   15.150806]  [<c10a2e77>] ? vfs_kern_mount+0x81/0x11a
      [   15.150806]  [<c10a2f55>] ? do_kern_mount+0x33/0xbe
      [   15.150806]  [<c10b40b9>] ? do_mount+0x654/0x6b3
      [   15.150806]  [<c1038949>] ? do_page_fault+0x0/0x284
      [   15.150806]  [<c10b28ec>] ? copy_mount_options+0x73/0xd2
      [   15.150806]  [<c10b4179>] ? sys_mount+0x61/0x94
      [   15.150806]  [<c14284e9>] ? syscall_call+0x7/0xb
      ....
      [   15.203562] ---[ end trace 1dd159357709eb4b ]---
      [
      Signed-off-by: NAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
      Signed-off-by: NEric Van Hensbergen <ericvh@gmail.com>
      fb786100
    • E
      net/9p: fix virtio transport to correctly update status on connect · 562ada61
      Eric Van Hensbergen 提交于
      The 9p virtio transport was not updating its connection status correctly
      preventing it from being able to mount the server.
      Signed-off-by: NEric Van Hensbergen <ericvh@gmail.com>
      562ada61
  22. 22 10月, 2009 1 次提交
    • C
      virtio: let header files include virtio_ids.h · e95646c3
      Christian Borntraeger 提交于
      Rusty,
      
      commit 3ca4f5ca
          virtio: add virtio IDs file
      moved all device IDs into a single file. While the change itself is
      a very good one, it can break userspace applications. For example
      if a userspace tool wanted to get the ID of virtio_net it used to
      include virtio_net.h. This does no longer work, since virtio_net.h
      does not include virtio_ids.h.
      This patch moves all "#include <linux/virtio_ids.h>" from the C
      files into the header files, making the header files compatible with
      the old ones.
      
      In addition, this patch exports virtio_ids.h to userspace.
      
      CC: Fernando Luis Vazquez Cao <fernando@oss.ntt.co.jp>
      Signed-off-by: NChristian Borntraeger <borntraeger@de.ibm.com>
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      e95646c3
  23. 23 9月, 2009 3 次提交
  24. 18 8月, 2009 1 次提交
  25. 12 6月, 2009 2 次提交
  26. 06 4月, 2009 1 次提交
  27. 18 10月, 2008 1 次提交
    • E
      9p: make rpc code common and rework flush code · 91b8534f
      Eric Van Hensbergen 提交于
      This code moves the rpc function to the common client base,
      reorganizes the flush code to be more simple and stable, and
      makes the necessary adjustments to the underlying transports
      to adapt to the new structure.
      
      This reduces the overall amount of code duplication between the
      transports and should make adding new transports more straightforward.
      Signed-off-by: NEric Van Hensbergen <ericvh@gmail.com>
      91b8534f