Just do the right thing. Consider the perspectives, your customer, your salesman, the administator, the environment your driver is going into. What may be right for a general purpose machine, may be the wrong approach for a dedicated function machine. Try a variety of approaches, polling, polling and waiting, waiting only. See which one works best. Have your driver support them all. Don’t dictate policy in your driver. Defer policy to higher level functions. Let them decide how best to utilize the services that you provide.
Duane.
-----Original Message-----
From: Jamey Kirby [mailto:xxxxx@storagecraft.com]
Sent: Tuesday, January 21, 2003 6:06 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Driver Design and Data Integrity
You can do the same and use several IOCTLS. With multiple threads, you
do not need to serialize data coming from the driver to one thread. Each
IOCTL that completes can contain as much data as it can pull from a
queue in the driver.
Hey, it looks like we are all in the same neighborhood… I am sure he
will find a solution in the past few posts ![:slight_smile: :slight_smile:](/images/emoji/twitter/slight_smile.png?v=12)
Jamey
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Volker Moebius
Sent: Tuesday, January 21, 2003 2:52 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Driver Design and Data Integrity
The driver could accumulate sector count internally to hand it out to
the
application on next poll without waiting for interrupt possibly. This
would
remove the need to emit several IOCTLs. (Driver would wait for next
interrupt before completing the IRP if no interrupt occured since last
poll.)
An argument *for* ‘polling’ by IOCTLs: UM app has to wait until a
specific
sector count is reached anyway. With counter in shared memory it has to
implement this itself by polling the memory location. Using IOCTL the
synchronization is ‘for free’.
----- Original Message -----
From: “Michal Vodicka”
To: “NT Developers Interest List”
Sent: Tuesday, January 21, 2003 11:23 PM
Subject: [ntdev] Re: Driver Design and Data Integrity
> Yes but one UM thread is enough. Several overlapped IOCTLs (up to 64)
can
be
> passed to driver and WaitForMultipleObjects can be used for waiting
for
> overlapped events. When driver completes an IRP, UM thread processed
it,
> passes new request to driver and waits again.
>
> Best regards,
>
> Michal Vodicka
> STMicroelectronics Design and Application s.r.o.
> [michal.vodicka@st.com, http:://www.st.com]
>
> > ----------
> > From: xxxxx@storagecraft.com[SMTP:xxxxx@storagecraft.com]
> > Reply To: xxxxx@lists.osr.com
> > Sent: Tuesday, January 21, 2003 9:09 PM
> > To: xxxxx@lists.osr.com
> > Subject: [ntdev] Re: Driver Design and Data Integrity
> >
> >
> > I would consider pending multiple overlapped IOCTLs to the driver
and
> > have UM threads (start with something like 16 threads) to wait on
these
> > pended IOCTLs. When the driver has some data, it should fill in a
data
> > structure (your sector number) and complete one of the pended
IOCTLs.
> > Since you data is very small, you can send multiple sector numbers
in
> > one IOCTL. Suppose that you get several sectors of data before you
go
> > and post the data to the IOCTL and complete it… If you send in a
MAX
> > count sized buffer on the pended IOCTL, you can send a chunk of
sectors
> > numbers in one operation.
> >
> > You will find that this is a very efficient and manageable mechanism
to
> > accomplish your desired task. It is half of your design and half the
> > ugly user design.
> >
> > Jamey
> >
> >
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com] On Behalf Of Gary G. Little
> > Sent: Tuesday, January 21, 2003 11:45 AM
> > To: NT Developers Interest List
> > Subject: [ntdev] Re: Driver Design and Data Integrity
> >
> > Actually, on second thought, rather a dumb idea thought up by a
rather
> > lazy
> > application geek who couldn’t find his/her/its ass if he/she/it were
> > sitting
> > on it. And you may quote me.
> >
> > Yes … you writing to it in a DPC will ensure you’re
synchronization.
> > But
> > there is nothing he/she/it can do that will ensure that you can’t
> > clobber
> > the value while he/she/it is accessing it. There are no “spinlocks”
they
> > can
> > hold that will prevent IRQL from going to DIRQL, then falling back
to
> > DISPATCH_LEVEL which will then allow your DPC to run where you will
> > merrily
> > dump all over the data he/she/it was accessing. What is worse is
this
> > …
> > you update it and the app then writes over your update. He/she/it
will
> > then
> > run around mewling and whining about how you missed an interrupt.
> >
> > Oh … and there was no mention I saw about cache lines getting
royally
> > hosed.
> >
> > The best idea is using a asyncrnous IO in a device IOCTL. But App
> > probably
> > won;t like that since he/she/it will have some work to do. ![:slight_smile: :slight_smile:](/images/emoji/twitter/slight_smile.png?v=12)
> >
> > –
> > Gary G. Little
> > Have Computer, Will Travel …
> > 909-698-3191
> > 909-551-2105
> >
> > “John Reilly” wrote in message
> > news:xxxxx@ntdev…
> > >
> > > I have a board that reads radar image data. The radar sweep is
> > divided
> > > into 2048 sectors. Each time a new sector is ready, the board
> > interrupts
> > > and my driver DMAs that sector’s data into a buffer provided by
the
> > > application. It all works.
> > >
> > > The board has a register containing the number of the sector whose
> > data
> > > was just DMA’d. My driver provides an IOCTL to read this
register.
> > All
> > > well and good.
> > >
> > > EXCEPT, the ugly user, who is in my company and thus thinks he can
> > > influence the driver design, doesn’t want to poll this register.
He
> > wants
> > > to pass my driver a pointer to a memory location, and wants the
driver
> > to
> > > write the 4-byte sector number during each DPC for ISR.
> > >
> > > Who else thinks this is a crummy design? Or a good idea? Is
there
> > any
> > > danger of the app getting a bad value because it reads part of the
> > value
> > > and the driver updates the other part?
> > >
> > > Thanks for any ammunition to use against the user!
> > > john.
> > >
> > >
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: michal.vodicka@st.com
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@epost.de
> To unsubscribe send a blank email to xxxxx@lists.osr.com
—
You are currently subscribed to ntdev as: xxxxx@storagecraft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com
—
You are currently subscribed to ntdev as: xxxxx@infiniconsys.com
To unsubscribe send a blank email to xxxxx@lists.osr.com