lkml.org 
[lkml]   [2008]   [Mar]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] avoid endless loops in lib/swiotlb.c
From
On Fri, 14 Mar 2008 10:18:09 +0000
"Jan Beulich" <jbeulich@novell.com> wrote:

> >> - if the number of slots requested fits into a swiotlb segment, but is
> >> too large for the part of a segment which remains after considering
> >> offset_slots
> >
> >Sorry, I'm not sure what you mean. Can you give me an actual example
> >numbers that leads to that?
>
> For one part, it can happen if nslots > max_slots (which is a driver
> error [except for the case above where max_slots erroneously got set
> to zero], but shouldn't lead to a silent hang, especially as it didn't do so
> before).
>
> For another part, requesting e.g. a transfer of 128k with a segment
> mask of 128k when the IOTLB isn't aligned to a 128k boundary would
> again lead to a silent hang, as would various cases where the request
> exceeds the segment size (and the segment mask is sufficiently small).
> Neither of these cases got stuck in the old code.
>
> Beyond that, maybe I was too quick in concluding this could happen
> even in less unusual cases - I think I didn't pay close enough attention
> to the fact that offset_slots + index gets masked by max_slots - 1.
> But even then I think the code looks simpler/safer and is smaller with
> the adjusted logic.

I don't think that the old code hits the problems (endless loops or
silent hang) that you explained, but I agree that the patch made the
code simpler a bit.

Thanks,


\
 
 \ /
  Last update: 2008-03-16 12:59    [W:0.063 / U:0.776 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site