public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
To: jbeulich@novell.com
Cc: tomof@acm.org, fujita.tomonori@lab.ntt.co.jp,
	akpm@linux-foundation.org, torvalds@linux-foundation.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] avoid endless loops in lib/swiotlb.c
Date: Sun, 16 Mar 2008 20:55:03 +0900	[thread overview]
Message-ID: <20080316205441G.tomof@acm.org> (raw)
In-Reply-To: <47DA5EF1.76E4.0078.0@novell.com>

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,

      reply	other threads:[~2008-03-16 11:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-13  9:13 [PATCH] avoid endless loops in lib/swiotlb.c Jan Beulich
2008-03-14  9:35 ` FUJITA Tomonori
2008-03-14 10:18   ` Jan Beulich
2008-03-16 11:55     ` FUJITA Tomonori [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080316205441G.tomof@acm.org \
    --to=fujita.tomonori@lab.ntt.co.jp \
    --cc=akpm@linux-foundation.org \
    --cc=jbeulich@novell.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tomof@acm.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox