From: "Leon Woestenberg" <leon.woestenberg@gmail.com>
To: "FUJITA Tomonori" <fujita.tomonori@lab.ntt.co.jp>
Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
James.Bottomley@hansenpartnership.com, tj@kernel.org
Subject: Re: pci_map_sg() does not coalesce adjacent physical memory? x86
Date: Wed, 19 Nov 2008 07:22:31 +0100 [thread overview]
Message-ID: <c384c5ea0811182222l7f0e3131tc1cc20ffba5175c@mail.gmail.com> (raw)
In-Reply-To: <20081119142016E.fujita.tomonori@lab.ntt.co.jp>
Hello,
On Wed, Nov 19, 2008 at 6:19 AM, FUJITA Tomonori
<fujita.tomonori@lab.ntt.co.jp> wrote:
> On Mon, 17 Nov 2008 19:15:32 -0800
>> > pci_map_sg() does not coalesce the scattergather list for me on x86.
>> [ Marked as Bogus Report ]
>>
>> > Is this expected? Documentation mentions that coalescing is typically
>> > done by pci_map_sg().
>
> Hm, what document did you read? We might need to fix it.
>
http://lxr.linux.no/linux+v2.6.27.6/Documentation/DMA-API.txt
316 pci_map_sg(struct pci_dev *hwdev, struct scatterlist *sg,
317 int nents, int direction)
318
319Maps a scatter gather list from the block layer.
320
321Returns: the number of physical segments mapped (this may be shorter
322than <nents> passed in if the block layer determines that some
323elements of the scatter/gather list are physically adjacent and thus
324may be mapped with a single entry).
Also it is mentioned elsewhere, such a Linux Device Driver 3rd
Edition, page 451.
> pci_map_sg() is not a typical place to coalesce the entries of the sg
> list are physically adjacent. The block layer is the typical place.
>
Hmmm, why not?
In my case I am using the following flow:
virtual user buffer -> scatterlist -> pci_map_sg -> device specific
scatterlist table
Of course, I could write my own (tm) and map my pages into PCI using
pci_map_single, but I thought I was being the good kid by using what
was there.
> The dma operations are free to coalesce the entries that physically
> and virtually adjacent but there are not many that does.
>
> For example, by default, on x86, only AMD GART (x86_64) dma operation
> coalesces such entries.
>
> What's kinda of your driver? If it's a SCSI (or block) driver, you
> don't need this trick.
>
Not a block driver.
A data acquisition driver through PCI Express.
> I don't think that inventing a homegrown function to coalesce sg
> entries in a driver is a good idea. If you really need this, it's
> would be better to have a generic function to coalesce sg entries and
> modify the block layer to use it (and your driver can use it too).
>
+1 for this idea, *iff* it does not belong in pci_map_sg.
However, I think it *does* belong in pci_map_sg, because pci_map_sg
can perform virtual coalescing exploiting IOMMU's if I am not
mistaken.
Regards,
--
Leon
next prev parent reply other threads:[~2008-11-19 6:22 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-17 21:54 Leon Woestenberg
2008-11-18 3:15 ` Andrew Morton
2008-11-18 5:21 ` James Bottomley
2008-11-18 9:37 ` Leon Woestenberg
2008-11-19 5:19 ` FUJITA Tomonori
2008-11-19 6:22 ` Leon Woestenberg [this message]
2008-11-19 6:58 ` FUJITA Tomonori
2008-11-19 7:05 ` FUJITA Tomonori
2008-11-19 7:58 ` FUJITA Tomonori
2008-11-19 9:45 ` Leon Woestenberg
2008-11-19 10:05 ` Tejun Heo
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=c384c5ea0811182222l7f0e3131tc1cc20ffba5175c@mail.gmail.com \
--to=leon.woestenberg@gmail.com \
--cc=James.Bottomley@hansenpartnership.com \
--cc=akpm@linux-foundation.org \
--cc=fujita.tomonori@lab.ntt.co.jp \
--cc=linux-kernel@vger.kernel.org \
--cc=tj@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®