1. 25 1月, 2017 2 次提交
  2. 13 1月, 2017 4 次提交
  3. 25 12月, 2016 1 次提交
  4. 15 12月, 2016 9 次提交
  5. 14 12月, 2016 6 次提交
  6. 04 12月, 2016 4 次提交
  7. 18 11月, 2016 1 次提交
    • A
      netns: make struct pernet_operations::id unsigned int · c7d03a00
      Alexey Dobriyan 提交于
      Make struct pernet_operations::id unsigned.
      
      There are 2 reasons to do so:
      
      1)
      This field is really an index into an zero based array and
      thus is unsigned entity. Using negative value is out-of-bound
      access by definition.
      
      2)
      On x86_64 unsigned 32-bit data which are mixed with pointers
      via array indexing or offsets added or subtracted to pointers
      are preffered to signed 32-bit data.
      
      "int" being used as an array index needs to be sign-extended
      to 64-bit before being used.
      
      	void f(long *p, int i)
      	{
      		g(p[i]);
      	}
      
        roughly translates to
      
      	movsx	rsi, esi
      	mov	rdi, [rsi+...]
      	call 	g
      
      MOVSX is 3 byte instruction which isn't necessary if the variable is
      unsigned because x86_64 is zero extending by default.
      
      Now, there is net_generic() function which, you guessed it right, uses
      "int" as an array index:
      
      	static inline void *net_generic(const struct net *net, int id)
      	{
      		...
      		ptr = ng->ptr[id - 1];
      		...
      	}
      
      And this function is used a lot, so those sign extensions add up.
      
      Patch snipes ~1730 bytes on allyesconfig kernel (without all junk
      messing with code generation):
      
      	add/remove: 0/0 grow/shrink: 70/598 up/down: 396/-2126 (-1730)
      
      Unfortunately some functions actually grow bigger.
      This is a semmingly random artefact of code generation with register
      allocator being used differently. gcc decides that some variable
      needs to live in new r8+ registers and every access now requires REX
      prefix. Or it is shifted into r12, so [r12+0] addressing mode has to be
      used which is longer than [r8]
      
      However, overall balance is in negative direction:
      
      	add/remove: 0/0 grow/shrink: 70/598 up/down: 396/-2126 (-1730)
      	function                                     old     new   delta
      	nfsd4_lock                                  3886    3959     +73
      	tipc_link_build_proto_msg                   1096    1140     +44
      	mac80211_hwsim_new_radio                    2776    2808     +32
      	tipc_mon_rcv                                1032    1058     +26
      	svcauth_gss_legacy_init                     1413    1429     +16
      	tipc_bcbase_select_primary                   379     392     +13
      	nfsd4_exchange_id                           1247    1260     +13
      	nfsd4_setclientid_confirm                    782     793     +11
      		...
      	put_client_renew_locked                      494     480     -14
      	ip_set_sockfn_get                            730     716     -14
      	geneve_sock_add                              829     813     -16
      	nfsd4_sequence_done                          721     703     -18
      	nlmclnt_lookup_host                          708     686     -22
      	nfsd4_lockt                                 1085    1063     -22
      	nfs_get_client                              1077    1050     -27
      	tcf_bpf_init                                1106    1076     -30
      	nfsd4_encode_fattr                          5997    5930     -67
      	Total: Before=154856051, After=154854321, chg -0.00%
      Signed-off-by: NAlexey Dobriyan <adobriyan@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c7d03a00
  8. 17 11月, 2016 7 次提交
  9. 12 11月, 2016 1 次提交
  10. 19 10月, 2016 2 次提交
  11. 18 10月, 2016 1 次提交
  12. 08 10月, 2016 2 次提交
    • S
      IB/core: correctly handle rdma_rw_init_mrs() failure · b6bc1c73
      Steve Wise 提交于
      Function ib_create_qp() was failing to return an error when
      rdma_rw_init_mrs() fails, causing a crash further down in ib_create_qp()
      when trying to dereferece the qp pointer which was actually a negative
      errno.
      
      The crash:
      
      crash> log|grep BUG
      [  136.458121] BUG: unable to handle kernel NULL pointer dereference at 0000000000000098
      crash> bt
      PID: 3736   TASK: ffff8808543215c0  CPU: 2   COMMAND: "kworker/u64:2"
       #0 [ffff88084d323340] machine_kexec at ffffffff8105fbb0
       #1 [ffff88084d3233b0] __crash_kexec at ffffffff81116758
       #2 [ffff88084d323480] crash_kexec at ffffffff8111682d
       #3 [ffff88084d3234b0] oops_end at ffffffff81032bd6
       #4 [ffff88084d3234e0] no_context at ffffffff8106e431
       #5 [ffff88084d323530] __bad_area_nosemaphore at ffffffff8106e610
       #6 [ffff88084d323590] bad_area_nosemaphore at ffffffff8106e6f4
       #7 [ffff88084d3235a0] __do_page_fault at ffffffff8106ebdc
       #8 [ffff88084d323620] do_page_fault at ffffffff8106f057
       #9 [ffff88084d323660] page_fault at ffffffff816e3148
          [exception RIP: ib_create_qp+427]
          RIP: ffffffffa02554fb  RSP: ffff88084d323718  RFLAGS: 00010246
          RAX: 0000000000000004  RBX: fffffffffffffff4  RCX: 000000018020001f
          RDX: ffff880830997fc0  RSI: 0000000000000001  RDI: ffff88085f407200
          RBP: ffff88084d323778   R8: 0000000000000001   R9: ffffea0020bae210
          R10: ffffea0020bae218  R11: 0000000000000001  R12: ffff88084d3237c8
          R13: 00000000fffffff4  R14: ffff880859fa5000  R15: ffff88082eb89800
          ORIG_RAX: ffffffffffffffff  CS: 0010  SS: 0018
      #10 [ffff88084d323780] rdma_create_qp at ffffffffa0782681 [rdma_cm]
      #11 [ffff88084d3237b0] nvmet_rdma_create_queue_ib at ffffffffa07c43f3 [nvmet_rdma]
      #12 [ffff88084d323860] nvmet_rdma_alloc_queue at ffffffffa07c5ba9 [nvmet_rdma]
      #13 [ffff88084d323900] nvmet_rdma_queue_connect at ffffffffa07c5c96 [nvmet_rdma]
      #14 [ffff88084d323980] nvmet_rdma_cm_handler at ffffffffa07c6450 [nvmet_rdma]
      #15 [ffff88084d3239b0] iw_conn_req_handler at ffffffffa0787480 [rdma_cm]
      #16 [ffff88084d323a60] cm_conn_req_handler at ffffffffa0775f06 [iw_cm]
      #17 [ffff88084d323ab0] process_event at ffffffffa0776019 [iw_cm]
      #18 [ffff88084d323af0] cm_work_handler at ffffffffa0776170 [iw_cm]
      #19 [ffff88084d323cb0] process_one_work at ffffffff810a1483
      #20 [ffff88084d323d90] worker_thread at ffffffff810a211d
      #21 [ffff88084d323ec0] kthread at ffffffff810a6c5c
      #22 [ffff88084d323f50] ret_from_fork at ffffffff816e1ebf
      
      Fixes: 632bc3f6 ("IB/core, RDMA RW API: Do not exceed QP SGE send limit")
      Signed-off-by: NSteve Wise <swise@opengridcomputing.com>
      Cc: stable@vger.kernel.org
      Reviewed-by: NBart Van Assche <bart.vanassche@sandisk.com>
      Signed-off-by: NDoug Ledford <dledford@redhat.com>
      b6bc1c73
    • B
      IB/core: Improve ib_map_mr_sg() documentation · 52746129
      Bart Van Assche 提交于
      Document that ib_map_mr_sg() is able to map physically discontiguous
      sg-lists as a single MR. Change IB_MR_TYPE_SG_GAPS_REG into
      IB_MR_TYPE_SG_GAPS.
      Signed-off-by: NBart Van Assche <bart.vanassche@sandisk.com>
      Cc: Sagi Grimberg <sagi@grimberg.me>
      Cc: Christoph Hellwig <hch@lst.de>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Reviewed-by: NSagi Grimberg <sagi@rimberg.me>
      Signed-off-by: NDoug Ledford <dledford@redhat.com>
      52746129