From: "Adam J. Richter" <adam@yggdrasil.com>
To: davem@redhat.com
Cc: akpm@zip.com.au, axboe@suse.de, linux-kernel@vger.kernel.org
Subject: Re: RFC: turn scatterlist into a linked list, eliminate bio_vec
Date: Mon, 24 Jun 2002 04:42:45 -0700 [thread overview]
Message-ID: <200206241142.EAA04136@adam.yggdrasil.com> (raw)
>From: "David S. Miller" <davem@redhat.com>
>Date: Sun, 23 Jun 2002 23:24:16 -0700 (PDT)
>> /* Let's assume the new pci_map_sg will free unused scatterlists. */
>> while (sg != NULL && count--) {
>> sg->driver_priv = mempool_alloc(q->sgpriv_pool, GFP_KERNEL);
>>
>> sg->driver_priv_dma =
>> pci_map_single(req->dma_map_dev, sg->driver_priv, len,
>> PCI_DMA_TODEVICE);
>> if (sg_dma->dma_add_priv == 0);
>> failed = fail_value;
>> }
>> }
>Driver descriptors are not supposed to be done using pci_map_*()
>and friends. You are supposed to use consistent DMA memory for
>this purpose. Please read DMA-mapping.txt a few more times Adam :-)
Sorry if I was not clear enough about the purpose of of
the new scatterlist->driver_priv field. It is a "streaming" data
structure to use the terminology of DMA-maping.txt (i.e., one that
would typically only be allocated for a few microseconds as an IO is
built up and sent). Its purpose is to hold the hardware-specific
gather-scatter segment descriptor, which typically look something like this:
struct foo_corporation_scsi_controller_sg_element {
u64 data_addr;
u64 next_addr;
u16 data_len;
u16 reserved;
u32 various_flags;
}
I probably should not have mentioned adding sg->driver_priv{,_dma}
in my proposal, because it is largely independent. The reason that
it is related is that it should allow the "mid-layer" device driver code
(scsi.c, usb.c, etc.) to do all of the streaming DMA mapping for
typical DMA-based device drivers.
Come to think of it, my use of pci_map_single is incorrect
after all, because the driver has not yet filled in that data structure
at that point. Since the data structures are being allocated from a
single contiguous block that spans a couple of pages that is being used
only for this purpose, perhaps I would be fastest to pci_alloc_consistent
the whole memory pool for those little descriptors at initialization time
and then change that loop to do the following.
sg->driver_priv = mempool_alloc(q->sgpriv_pol, GFP_KERNEL);
sg->driver_priv_dma = (sg->driver_priv - q->driver_priv_start)+
sg->driver_priv_start_dma_addr;
>Also, this while loop never terminates :-)
Oops! Sorry. The bottom of that loop needs
sg = sg->next;
Adam J. Richter __ ______________ 575 Oroville Road
adam@yggdrasil.com \ / Milpitas, California 95035
+1 408 309-6081 | g g d r a s i l United States of America
"Free Software For The Rest Of Us."
next reply other threads:[~2002-06-24 12:41 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-06-24 11:42 Adam J. Richter [this message]
2002-06-24 12:39 ` David S. Miller
-- strict thread matches above, loose matches on Subject: below --
2002-06-25 21:27 Adam J. Richter
2002-06-25 14:35 Adam J. Richter
2002-06-24 20:44 Adam J. Richter
2002-06-25 13:58 ` David S. Miller
2002-06-23 23:58 Adam J. Richter
2002-06-24 6:24 ` David S. Miller
2002-06-24 19:29 ` William Lee Irwin III
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=200206241142.EAA04136@adam.yggdrasil.com \
--to=adam@yggdrasil.com \
--cc=akpm@zip.com.au \
--cc=axboe@suse.de \
--cc=davem@redhat.com \
--cc=linux-kernel@vger.kernel.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
all inboxes | Powered by JetHome®