Re: METHOD_NEITHER and buffer alignment

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



so if the app allocates a buffer >= page_size it should be aligned as best you need it. WdfDeviceSetAlignmentRequirement effects buffer alignment for DMA. why are you using method_neither to begin with? how big is the buffer?

d

--
Please do not send e-mail directly to this alias. this alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.


"Maxim S. Shatskih" <maxim@xxxxxxxxxxxxxxxx> wrote in message news:%23v872$IWIHA.1164@xxxxxxxxxxxxxxxxxxxxxxx
Virtual to physical mapping has page granularity. So, the ( VA %
PAGE_SIZE ) value (which is Mdl->ByteOffset) is the same for all mappings of
the page and also for the physical address.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@xxxxxxxxxxxxxxxx
http://www.storagecraft.com

"Michael" <Michael@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:FAFBC328-03E1-4923-8B19-186459C5B24D@xxxxxxxxxxxxxxxx
In running some experiments, it doesn't seem to be the case that user space
virtual addresses and corresponding physical addresses have the same
alignment. Why would that be?

"Maxim S. Shatskih" wrote:

> > How can this requirement be imposed on the app?
>
> By documentation for app developers.
>
> >Is there a way for an
> > application to know the corresponding physical address of a buffer so
that it
> > can keep all of it's buffers aligned properly on 64 byte physical
addresses?
>
> Alignment within a page is the same for both physical and virtual
addresses,
> it's obvious.
>
> BTW - 8byte is the usual allocation alignment for both user- and > kernel-
> allocators. To get 64byte alignment, allocate ( N + 63 ) bytes and then
round
> the base address of the allocated block up.
>
> -- > Maxim Shatskih, Windows DDK MVP
> StorageCraft Corporation
> maxim@xxxxxxxxxxxxxxxx
> http://www.storagecraft.com
>
>


.



Relevant Pages

  • Re: Application xxx has encountered a serious error and must shut
    ... it refers to errors in buffer management code - functions like strcpy etc. ... My app is a Managed C# CF3.5 app and makes extensive use of a TCP Socket ... NB I replaced the MS SerialPort with OpenNetCF Serial and this seems to ...
    (microsoft.public.windowsce.app.development)
  • Re: mptsas hangs caused by ATA pass-through explained
    ... pass-through commands, in particular by smartctl. ... On an LSI SAS1068E B3 HBA running ... specifically set a flag to do direct IO, sg passes a buffer of its own, ... into the userspace buffer regardless of its alignment. ...
    (Linux-Kernel)
  • Re: busdma MFC broke ipfw fwd for RELENG_6
    ... alignment limitation so create dmamap without alignment ... Rx buffer still seems to require 4 bytes alignment ... During attach on some deadapters the driver sends out a test packet as ... The maxsegsz of a dma tag created in deis TULIP_DATA_PER_DESC bytes. ...
    (freebsd-stable)
  • Re: Conversion from UTF32 to UTF8 for review
    ... time, which puts a performance burden on the caller, which should be counted in the total ... you would, upon completion, put a NUL character at the end of the buffer. ... app or an MFC app; and if it were being graded on performance, I'd give it a D- at best, ... The programmer protested that "I have to do malloc each time because I ...
    (microsoft.public.vc.mfc)
  • Re: Alignment of disk-I/O from userland.
    ... On Tue, 7 Oct 2003, Harti Brandt wrote: ... > SL>Working around hardware requirements from the block layer gets messy. ... > SL>for hardware that doesn't care about the alignment. ... > large enough dmamem buffer and fiddling with the pointers. ...
    (freebsd-arch)