On 09/19/14 15:11, Jinpu Wang wrote: > During go through SRP FMR support, I found ib_srp pre-alloc > fmr_list/map_page in each request, > fmr_list are alloced as many as target->cmd_sg_cnt > > I add some debug message when run fio test with different settings. > Result show, state.ndesc and state.nmdesc is 1, state.npages is 0, > after srp_map_sg, > my question is : do we really need as many cmd_sg_cnt fmr_list, or I > miss something, ndesc and nmdesc could be bigger than 1? Hello Jack, The limitations for FMR / FR memory registration are more restrictive than those imposed by the SCSI core on S/G-list layout. A few examples: * Memory registered via FMR must be aligned on an FMR page boundary. * Memory registered via a single FMR / FR registration must be a contiguous virtual memory region. * The maximum size for a memory region registered via FMR or FR (dev->mr_max_size) can be below the maximum size of an S/G-list that can be passed by the SCSI core. Hence the need for multiple memory descriptors. In case you are wondering how I tested memory registration involving multiple memory descriptors: I wrote a test program that causes the SCSI core to send an S/G-list to the SRP initiator that consists of 128 elements with four bytes of data. None of these elements are aligned on a page boundary and no two S/G-list elements are contiguous in virtual memory. This test program causes the SRP initiator to allocate 128 memory descriptors. Please note that I/O requests submitted by the attached test program will only be accepted by the SRP initiator if the cmd_sg_entries kernel module parameter has been set to a value >= 128. Bart.