Re: 4k mbuf alignment on intel?
Re: 4k mbuf alignment on intel?
- Subject: Re: 4k mbuf alignment on intel?
- From: Josh Graessley <email@hidden>
- Date: Fri, 20 Oct 2006 18:03:22 -0700
It is not possible to maintain your own buffer list and use M_EXT..
There is no way to do this using the KPI. If you absolutely need
this, file a bug report and it may be considered for some future
release.
-josh
On Oct 20, 2006, at 5:54 PM, Terry Lambert wrote:
On Oct 20, 2006, at 10:55 AM, Andrew Gallatin wrote:
I'm trying to track down some weird mbuf corruption problems with my
driver on mac pros, without any access to mac pro hardware. One
thing
that came to my mind is that I currently assume 4k mbufs as returned
by mbuf_allocpacket(..4096..) are aligned on a 4k physical address
boundary. If the hardware attempts a DMA across a 4K boundary, it
will wrap around and scribble over the first part of the page, so
this
might explain the mbuf corruption.
4KB mbufs has been always been aligned on 4KB boundaries on ppc. Is
it true on Intel?
Sorry, the answer is not that easy, so you're probably going to
have to chase it down; the underlying primitive is vm_allocate_page
() from kernel_memory_allocate(), so it's all page aligned for this
usage.
You could check this relatively easily at runtime by ANDing the
returned address with 0x00000fff and making sure it's 0, which I
recommend if you want to reassure yourself that that's the case;
however, I think you are going to have to look elsewhere for your
problem.
If this is not true, how does one allocate one's own
external storage in the face of the mbuf kpi?
It's possible to maintain your own buffer list and use M_EXT; there
are several drivers that do this internally, if they have a limited
ability to address memory (e.g. if they don't implement all of the
address lines, don't hook them all up, or are over a bus that
doesn't support it (e.g. using a 32 bit device on a machine with
more than 4G of memory, where the DMA target would be above the 4G
physical memory boundary).
I'm not sure if there are any public examples of drivers using
this, but it's possible to do.
In general, though, you will end up taking an extra copy (e.g. for
pull up) if you end up triggering that code path, so you should
avoid this unless you don't really have a choice in the matter.
If you need to do this, FreeBSD does it exactly this same way as
well (e.g. that's how "sendfile" works in FreeBSD, and I believe
there are some network drivers over there that use it because of
bus limits, too).
-- Terry
Thanks,
Drew
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40apple.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40apple.com
This email sent to email@hidden
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden