From: James Bottomley <James.Bottomley@HansenPartnership.com>
To: paulus@samba.org
Cc: "David S. Miller" <davem@redhat.com>,
jes@sunsite.dk, James.Bottomley@HansenPartnership.com,
linuxopinion@yahoo.com, linux-kernel@vger.kernel.org
Subject: Re: how to get virtual address from dma address
Date: Sat, 06 Oct 2001 09:45:05 -0500 [thread overview]
Message-ID: <200110061445.f96Ej5S01591@localhost.localdomain> (raw)
In-Reply-To: Message from Paul Mackerras <paulus@samba.org> of "Sat, 06 Oct 2001 22:18:42 +1000." <15294.63138.941581.771248@cargo.ozlabs.ibm.com>
paulus@samba.org said:
> I look at all the hash-table stuff in the usb-ohci driver and I think
> to myself about all the complexity that is there (and I haven't
> managed to convince myself yet that it is actually SMP-safe) and all
> the time wasted doing that stuff, when on probably 95% of the machines
> that use the usb-ohci driver, the hashing stuff is totally
> unnecessary. I am talking about powermacs, which don't have an iommu,
> and where the reverse mapping is as simple as adding a constant.
> That was my second argument, which you didn't reply to - that doing
> the reverse mapping is very simple on some platforms, and so the right
> place to do reverse mapping is in the platform-aware code, not in the
> drivers. On other platforms the reverse mapping is more complex, but
> the complexity is bounded by the complexity that is already there in
> drivers like the usb-ohci driver.
This is precisely my point as well: You've made all the drivers that must be
able to do this type of mapping assume the worst case because we cannot now
have any window into the iommu if there is one.
Worse still, every driver that needs this feature is doing it on its own, so
the code for doing this in usb-ohci is different from the code in the
sym53c8xx driver etc. We're now duplicating this fairly subtle and complex
code all over the driver base.
At the very least, providing an API to do this will get us away from all the
error prone duplication. And if it's going to be an API, it might as well be
architecture specific and iommu aware so it functions in the simplest and
fastest way.
davem@redhat.com said:
> The argument against it is that if you provide such an easy way out,
> people will just blindly transform bus_to_virt/virt_to_bus without
> considering more straightforward methods when they exist.
> I can not even count on one hand how many people I've helped
> converting, who wanted a bus_to_virt() and when I showed them how to
> do it with information the device provided already they said "oh wow,
> I never would have thought of that". That process won't happen as
> often with the suggested feature.
I agree that some people are very prone to abusing the tools provided to them.
I cannot agree that this is a good reason not to provide the tools in the
first place. This is the type of argument usually heard from lawmakers and
politicians. The linux community is better than that: we have a review
process for new drivers. We even have a bunch of people who trawl through the
old code looking for mistakes and problems who would probably be more that
willing to send in patches for abuse of this API. Can we not educate the
community (document the API properly) and rely on it to make the correct
choices?
James Bottomley
next prev parent reply other threads:[~2001-10-06 14:45 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-10-03 22:44 how to get virtual address from dma address James Bottomley
2001-10-04 0:24 ` David S. Miller
2001-10-04 10:11 ` BALBIR SINGH
2001-10-04 11:16 ` David S. Miller
2001-10-04 15:37 ` James Bottomley
2001-10-05 14:06 ` Jes Sorensen
2001-10-06 8:06 ` Paul Mackerras
2001-10-06 8:38 ` David S. Miller
2001-10-06 12:18 ` Paul Mackerras
2001-10-06 14:45 ` James Bottomley [this message]
2001-10-06 16:51 ` Gérard Roudier
2001-10-06 17:23 ` Jes Sorensen
2001-10-07 2:13 ` Paul Mackerras
2001-10-07 17:40 ` Jes Sorensen
2001-10-07 7:21 ` Gérard Roudier
2001-10-07 16:23 ` James Bottomley
2001-10-07 18:24 ` Gérard Roudier
2001-10-07 23:02 ` James Bottomley
2001-10-08 21:06 ` Gérard Roudier
[not found] ` <mailman.1002371041.9232.linux-kernel2news@redhat.com>
2001-10-06 18:19 ` Pete Zaitcev
[not found] ` <mailman.1002355920.6872.linux-kernel2news@redhat.com>
2001-10-06 18:04 ` Pete Zaitcev
[not found] <Pine.LNX.4.21.0110031525370.14852-100000@pogo.esscom.com>
2001-10-03 21:48 ` Linux Bigot
2001-10-03 22:03 ` Ben Collins
2001-10-05 14:04 ` Jes Sorensen
-- strict thread matches above, loose matches on Subject: below --
2001-10-03 21:30 Manfred Spraul
2001-10-03 16:37 Linux Bigot
2001-10-03 19:32 ` Ben Collins
2001-10-03 21:11 ` Linux Bigot
2001-10-03 21:23 ` Ben Collins
2001-10-03 14:11 Linux Bigot
2001-10-03 15:25 ` Jes Sorensen
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=200110061445.f96Ej5S01591@localhost.localdomain \
--to=james.bottomley@hansenpartnership.com \
--cc=davem@redhat.com \
--cc=jes@sunsite.dk \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxopinion@yahoo.com \
--cc=paulus@samba.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