Re: [PATCH for-next] RDMA/core: Fix best page size finding when it can cross SG entries

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Feb 13, 2025 at 07:55:17PM +0200, Leon Romanovsky wrote:
> On Thu, Feb 13, 2025 at 01:40:43PM -0400, Jason Gunthorpe wrote:
> > On Thu, Feb 13, 2025 at 07:35:10PM +0200, Leon Romanovsky wrote:
> >  
> > > Initially curr_base is 0xFF.....FF and curr_len is 0.
> > 
> > curr base can't be so unaligned can it?
> 
> It is only for first iteration where it is compared with
> sg_dma_address(), immediately after that it is overwritten.

But this is all working with inherently page aligned stuff, cur_base +
len1 + len2 + len3 + len_n should be page aligned for interior segments..

> > > So if this "if ..." is skipped (not possible but static checkers don't know),
> > > we will advance curr_len and curr_base + curr_len will overflow.
> > > 
> > > I don't want to take original patch.
> > 
> > Subtracting is no better, it will just randomly fail for low dma addrs
> > instead of high.
> 
> Aren't sg_dma_address placed in increasing order?

Not necessarily, dma direct produces something random

> If not, whole if loop is not correct.

The point is to detect cases where they happen to be in order because
they were split up due to the 32 bit limit in the sgl.

Jason




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux