[ofa-general] Re: [PATCH] RDMA/nes: Physical memory registration is incorrect
Roland Dreier
rdreier at cisco.com
Wed Apr 8 14:06:56 PDT 2009
> Code incorrectly failed memory registration if the buffer was
> not page aligned. Also, the length field is mangled causing
> the hardware to think the registration is much larger than it
> really is.
This doesn't look quite right:
- if (buffer_list[i].addr & ~PAGE_MASK) {
- /* TODO: Unwind allocated buffers */
- nes_free_resource(nesadapter, nesadapter->allocated_mrs, stag_index);
- nes_debug(NES_DBG_MR, "Unaligned Memory Buffer: 0x%x\n",
- (unsigned int) buffer_list[i].addr);
- ibmr = ERR_PTR(-EINVAL);
- kfree(nesmr);
- goto reg_phys_err;
- }
if a buffer after the first one is not aligned, then I suspect you
can't handle the registration -- ie you want to allow:
addr len
0x1800 0x 800
0x3000 0x1000
0x5000 0x 800
but not cases like
addr len
0x1800 0x 800
0x3800 0x 800
0x5000 0x 800
you could take a look at the code in mthca_reg_phys_mr() to see what I
think is required (although I wouldn't be shocked if you spot a bug
there too)
- R.
More information about the general
mailing list