mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Gérard Roudier" <groudier@free.fr>
To: Dan Malek <dan@embeddededge.com>
Cc: Troy Benjegerdes <hozer@drgw.net>,
	"David S. Miller" <davem@redhat.com>,
	<linux-kernel@vger.kernel.org>, <mattl@mvista.com>
Subject: Re: pci_alloc_consistent from interrupt == BAD
Date: Fri, 18 Jan 2002 21:50:14 +0100 (CET)	[thread overview]
Message-ID: <20020118213313.R1937-100000@gerard> (raw)
In-Reply-To: <3C4875DB.9080402@embeddededge.com>


On Fri, 18 Jan 2002, Dan Malek wrote:

> Troy Benjegerdes wrote:
>
> > Somehow the docs in DMA-mappings.txt say pci_alloc_consistent is allowed from
> > interrupt, but this is a "bad thing" on at least arm and PPC non-cache
> > coherent cpus.
>
> This isn't unique to PowerPC or ARM, and has nothing to do with allocating
> page tables.
>
> I don't understand how pci_alloc_consistent could ever be claimed to work
> from an interrupt function because it actually allocates pages of memory
> for all architectures.  Anytime you call alloc_pages() (or friends) you could
> potentially block or return an error (out of memory) condition.
>
> Either option is undesirable for an interrupt function.  If your software can
> handle the case of not being able to allocate memory, then why not remove the
> complexity and do it that way all of the time?

I donnot see your point. Any software that tries to allocate from
interrupt context must be ready to handle failure, but when the allocation
does not require more than a single page, the failure should not happen
very often.

Not allocating under interrupt requires to pool everything that may be
ever needed. Speaking about Linux SCSI, you can:

1) Allocate all data structures at initialisation.
   A driver that can support 1022 IOs per HBA  for example with 2K CCB
   will allocate 2 MB even if user just uses a single CD/ROM without tagged
   commands supported.

2) Resize the CCB pool on select_queue_depth() call.
   This will allocate far less memory when only few devices will be
   attached to the BUS.

No need to say that 'sym' will never implement #1. At most I may add this
inside some #ifdef/#endif pair.

For example, on my personnal machine #1 scenario will allocate 8 MB but
actual need will be about 1 MB.

For now, I am not sure about #2 being cleanly implementable, but it looks
smarter to me. Note that I would prefer to also be able to free CCBs that
are no more needed. This will require a driver entry to be called when a
device goes away.

  Gérard.


  reply	other threads:[~2002-01-18 20:52 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.1011386221.24072.linux-kernel2news@redhat.com>
2002-01-18 19:02 ` Troy Benjegerdes
2002-01-18 19:22   ` Dan Malek
2002-01-18 20:50     ` Gérard Roudier [this message]
2002-01-21 23:52     ` Pete Zaitcev
2002-01-18 20:21   ` Gérard Roudier
2002-01-18 20:32   ` David S. Miller
2002-01-18 21:29     ` Russell King
2002-01-18 21:46       ` Dan Malek
2002-01-18 21:55         ` Russell King
2002-01-18 22:13           ` Dan Malek
2002-01-18 21:33     ` David S. Miller
2002-01-18 21:42       ` Russell King
2002-01-18 21:43     ` Dan Malek
2002-01-18 20:38   ` David S. Miller
2002-01-18 21:07     ` Gérard Roudier
2002-01-18 21:13     ` David S. Miller
2002-01-22  0:08 ` David S. Miller
2002-01-22  0:20   ` Pete Zaitcev
2002-01-19 17:21 David Brownell

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=20020118213313.R1937-100000@gerard \
    --to=groudier@free.fr \
    --cc=dan@embeddededge.com \
    --cc=davem@redhat.com \
    --cc=hozer@drgw.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mattl@mvista.com \
    /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

all inboxes | Powered by JetHome®