lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20081119165915A.fujita.tomonori@lab.ntt.co.jp>
Date:	Wed, 19 Nov 2008 16:58:30 +0900
From:	FUJITA Tomonori <fujita.tomonori@....ntt.co.jp>
To:	jens.axboe@...cle.com
Cc:	leon.woestenberg@...il.com, akpm@...ux-foundation.org,
	linux-kernel@...r.kernel.org,
	James.Bottomley@...senpartnership.com, tj@...nel.org
Subject: Re: pci_map_sg() does not coalesce adjacent physical memory? x86

On Wed, 19 Nov 2008 15:58:12 +0900
FUJITA Tomonori <fujita.tomonori@....ntt.co.jp> wrote:

> On Wed, 19 Nov 2008 07:22:31 +0100
> "Leon Woestenberg" <leon.woestenberg@...il.com> wrote:
> 
> > Hello,
> > 
> > On Wed, Nov 19, 2008 at 6:19 AM, FUJITA Tomonori
> > <fujita.tomonori@....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).
> 
> Hmm, the description looks confusing. The block layer coalesces
> physically adjacent entries before pci_map_sg(). pci_map_sg() could
> coalesces physically or virtually adjacent entries.

How about this?

=
From: FUJITA Tomonori <fujita.tomonori@....ntt.co.jp>
Subject: [PATCH] fix pci_map_sg/dma_map_sg scatterlists handling in DMA-API.txt

- pci_map_sg/dma_map_sg are used with a scatter gather list that
doesn't come from the block layer (e.g. some network drivers do).

- how IOMMUs merge adjacent elements of the scatter/gather list is
independent of how the block layer determines sees elements.


Signed-off-by: FUJITA Tomonori <fujita.tomonori@....ntt.co.jp>
---
 Documentation/DMA-API.txt |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/Documentation/DMA-API.txt b/Documentation/DMA-API.txt
index b8e8646..b462bb1 100644
--- a/Documentation/DMA-API.txt
+++ b/Documentation/DMA-API.txt
@@ -316,12 +316,10 @@ reduce current DMA mapping usage or delay and try again later).
 	pci_map_sg(struct pci_dev *hwdev, struct scatterlist *sg,
 		int nents, int direction)
 
-Maps a scatter gather list from the block layer.
-
 Returns: the number of physical segments mapped (this may be shorter
-than <nents> passed in if the block layer determines that some
-elements of the scatter/gather list are physically adjacent and thus
-may be mapped with a single entry).
+than <nents> passed in if some elements of the scatter/gather list are
+physically or virtually adjacent and an IOMMU maps them with a single
+entry).
 
 Please note that the sg cannot be mapped again if it has been mapped once.
 The mapping process is allowed to destroy information in the sg.
-- 
1.5.5.GIT

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ