SetLocalTime prevents interrupts

Hi all

I wrote a device driver on NT 4.0 for a PCI-Device that interrupts every 1
Millisecond. Every thing works fine, but when I start an application that
calls the SetLocalTime function, at least one interrupt is lost. Does
anybody know what can be the reason for this behaviour, or knows a
workaround.

Thank you very much in advance

F.X.

SetSystemTime will be processed deep inside the kernel of windows NT, and
will result in at least one IRQL raise to
SYNCH level , which is pretty much higher than any device IRQL. So if your
device happens to interrupt while IRQL
is at SYNCH, due to interrupt priority arbitration, it wont be allowed to
interrupt, and is pended.

Dan

----- Original Message -----
From: “F.X. Mayer”
To: “NT Developers Interest List”
Sent: Monday, July 22, 2002 3:13 PM
Subject: [ntdev] SetLocalTime prevents interrupts

> Hi all
>
> I wrote a device driver on NT 4.0 for a PCI-Device that interrupts every 1
> Millisecond. Every thing works fine, but when I start an application that
> calls the SetLocalTime function, at least one interrupt is lost. Does
> anybody know what can be the reason for this behaviour, or knows a
> workaround.
>
> Thank you very much in advance
>
> F.X.
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@rdsor.ro
> To unsubscribe send a blank email to %%email.unsub%%
>

Dan

thank you for your quick response.

Is there any chance to process interrupts at the rate of 1000 Hz without any
interrupt lost and call SetLocalTime() ?

Best regards

F.X.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Dan Partelly
Sent: Monday, July 22, 2002 3:25 PM
To: NT Developers Interest List
Subject: [ntdev] Re: SetLocalTime prevents interrupts

SetSystemTime will be processed deep inside the kernel of windows NT, and
will result in at least one IRQL raise to
SYNCH level , which is pretty much higher than any device IRQL. So if your
device happens to interrupt while IRQL
is at SYNCH, due to interrupt priority arbitration, it wont be allowed to
interrupt, and is pended.

Dan

----- Original Message -----
From: “F.X. Mayer”
> To: “NT Developers Interest List”
> Sent: Monday, July 22, 2002 3:13 PM
> Subject: [ntdev] SetLocalTime prevents interrupts
>
>
> > Hi all
> >
> > I wrote a device driver on NT 4.0 for a PCI-Device that
> interrupts every 1
> > Millisecond. Every thing works fine, but when I start an
> application that
> > calls the SetLocalTime function, at least one interrupt is lost. Does
> > anybody know what can be the reason for this behaviour, or knows a
> > workaround.
> >
> > Thank you very much in advance
> >
> > F.X.
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@rdsor.ro
> > To unsubscribe send a blank email to %%email.unsub%%
> >
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@fxm.de
> To unsubscribe send a blank email to %%email.unsub%%
>

I think that fail proof data processing at a interrupt rate of 1 milisecond
is very hard to implement. Not only the interrupt model in NT , but also
thread scheduling are not very adequate for real time processing. The main
ideea is that when your device interrupts, this is an asynchronous event and
execution context is not determined. It might take several thread switches
for
your application threads to be scheduled for execution, and collect the
data. Frankly Interrupt latencys are pretty low , so I dont know exactly if
what I said earlier is the reason this happens you, but it can be an
explnation.

What is the intended use of your device / app? Is it required to allow a
user mode process to make nofail, low latency processing on something
every 1Ms ?

----- Original Message -----
From: “F.X. Mayer”
To: “NT Developers Interest List”
Sent: Monday, July 22, 2002 5:05 PM
Subject: [ntdev] Re: SetLocalTime prevents interrupts

> Dan
>
> thank you for your quick response.
>
> Is there any chance to process interrupts at the rate of 1000 Hz without
any
> interrupt lost and call SetLocalTime() ?
>
> Best regards
>
> F.X.
>
>
>
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com]On Behalf Of Dan Partelly
> > Sent: Monday, July 22, 2002 3:25 PM
> > To: NT Developers Interest List
> > Subject: [ntdev] Re: SetLocalTime prevents interrupts
> >
> >
> > SetSystemTime will be processed deep inside the kernel of windows NT,
and
> > will result in at least one IRQL raise to
> > SYNCH level , which is pretty much higher than any device IRQL. So if
your
> > device happens to interrupt while IRQL
> > is at SYNCH, due to interrupt priority arbitration, it wont be allowed
to
> > interrupt, and is pended.
> >
> > Dan
> >
> >
> >
> > ----- Original Message -----
> > From: “F.X. Mayer”
> > To: “NT Developers Interest List”
> > Sent: Monday, July 22, 2002 3:13 PM
> > Subject: [ntdev] SetLocalTime prevents interrupts
> >
> >
> > > Hi all
> > >
> > > I wrote a device driver on NT 4.0 for a PCI-Device that
> > interrupts every 1
> > > Millisecond. Every thing works fine, but when I start an
> > application that
> > > calls the SetLocalTime function, at least one interrupt is lost. Does
> > > anybody know what can be the reason for this behaviour, or knows a
> > > workaround.
> > >
> > > Thank you very much in advance
> > >
> > > F.X.
> > >
> > >
> > >
> > > —
> > > You are currently subscribed to ntdev as: xxxxx@rdsor.ro
> > > To unsubscribe send a blank email to %%email.unsub%%
> > >
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@fxm.de
> > To unsubscribe send a blank email to %%email.unsub%%
> >
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@rdsor.ro
> To unsubscribe send a blank email to %%email.unsub%%
>

Dan

thank you once again for your help.
The processing in the driver is:

There is a counter card at the PCI bus that interrupts every millisecond.
The ISR of the driver gets this interrupt and starts data aquisition using
an ISA-Card with system DMA to write data to a ringbuffer mapped to user
address space. When the DMA is done (after appr. 700 microseconds) some
locations in the ringbuffer are updated and the cycle is done. The only
dirty thing I have done is that I restart the system DMA with PORT I/O, as
of course I do not have the time to switch to DPC and call IoMapTransfer.
The worst case interrupt latency i have measured at my system is 100
microsecond.
The driver works well (I run tests of more than 100 hours), but when i use
SetLocalTime in an application there is one interrupt lost. If i change the
rate to 2 milliseconds, no problem.

So, it would be very interesting, how long NT will stay at SYNC level and if
there is a safe way th adjust the sustem time ?

Best regards

F.X.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Dan Partelly
Sent: Monday, July 22, 2002 4:22 PM
To: NT Developers Interest List
Subject: [ntdev] Re: SetLocalTime prevents interrupts

I think that fail proof data processing at a interrupt rate of 1
milisecond
is very hard to implement. Not only the interrupt model in NT , but also
thread scheduling are not very adequate for real time processing. The main
ideea is that when your device interrupts, this is an
asynchronous event and
execution context is not determined. It might take several thread switches
for
your application threads to be scheduled for execution, and collect the
data. Frankly Interrupt latencys are pretty low , so I dont know
exactly if
what I said earlier is the reason this happens you, but it can be an
explnation.

What is the intended use of your device / app? Is it required to allow a
user mode process to make nofail, low latency processing on something
every 1Ms ?

----- Original Message -----
From: “F.X. Mayer”
> To: “NT Developers Interest List”
> Sent: Monday, July 22, 2002 5:05 PM
> Subject: [ntdev] Re: SetLocalTime prevents interrupts
>
>
> > Dan
> >
> > thank you for your quick response.
> >
> > Is there any chance to process interrupts at the rate of 1000 Hz without
> any
> > interrupt lost and call SetLocalTime() ?
> >
> > Best regards
> >
> > F.X.
> >
> >
> >
> > > -----Original Message-----
> > > From: xxxxx@lists.osr.com
> > > [mailto:xxxxx@lists.osr.com]On Behalf Of Dan Partelly
> > > Sent: Monday, July 22, 2002 3:25 PM
> > > To: NT Developers Interest List
> > > Subject: [ntdev] Re: SetLocalTime prevents interrupts
> > >
> > >
> > > SetSystemTime will be processed deep inside the kernel of windows NT,
> and
> > > will result in at least one IRQL raise to
> > > SYNCH level , which is pretty much higher than any device IRQL. So if
> your
> > > device happens to interrupt while IRQL
> > > is at SYNCH, due to interrupt priority arbitration, it wont be allowed
> to
> > > interrupt, and is pended.
> > >
> > > Dan
> > >
> > >
> > >
> > > ----- Original Message -----
> > > From: “F.X. Mayer”
> > > To: “NT Developers Interest List”
> > > Sent: Monday, July 22, 2002 3:13 PM
> > > Subject: [ntdev] SetLocalTime prevents interrupts
> > >
> > >
> > > > Hi all
> > > >
> > > > I wrote a device driver on NT 4.0 for a PCI-Device that
> > > interrupts every 1
> > > > Millisecond. Every thing works fine, but when I start an
> > > application that
> > > > calls the SetLocalTime function, at least one interrupt is
> lost. Does
> > > > anybody know what can be the reason for this behaviour, or knows a
> > > > workaround.
> > > >
> > > > Thank you very much in advance
> > > >
> > > > F.X.
> > > >
> > > >
> > > >
> > > > —
> > > > You are currently subscribed to ntdev as: xxxxx@rdsor.ro
> > > > To unsubscribe send a blank email to %%email.unsub%%
> > > >
> > >
> > >
> > >
> > > —
> > > You are currently subscribed to ntdev as: xxxxx@fxm.de
> > > To unsubscribe send a blank email to %%email.unsub%%
> > >
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@rdsor.ro
> > To unsubscribe send a blank email to %%email.unsub%%
> >
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@fxm.de
> To unsubscribe send a blank email to %%email.unsub%%
>

>> thank you once again for your help.

What help so far ? Im debating it with myself now, since I seem as puzzled
as you.

> how long NT will stay at SYNC level

I think on avergae no more than 170 microseconds, maybe a bit more on SMP
kernels where some IPIs and barier waits
are involved.

Dan

----- Original Message -----
From: “F.X. Mayer”
To: “NT Developers Interest List”
Sent: Monday, July 22, 2002 6:03 PM
Subject: [ntdev] Re: SetLocalTime prevents interrupts

> Dan
>
> thank you once again for your help.
> The processing in the driver is:
>
> There is a counter card at the PCI bus that interrupts every millisecond.
> The ISR of the driver gets this interrupt and starts data aquisition using
> an ISA-Card with system DMA to write data to a ringbuffer mapped to user
> address space. When the DMA is done (after appr. 700 microseconds) some
> locations in the ringbuffer are updated and the cycle is done. The only
> dirty thing I have done is that I restart the system DMA with PORT I/O, as
> of course I do not have the time to switch to DPC and call IoMapTransfer.
> The worst case interrupt latency i have measured at my system is 100
> microsecond.
> The driver works well (I run tests of more than 100 hours), but when i use
> SetLocalTime in an application there is one interrupt lost. If i change
the
> rate to 2 milliseconds, no problem.
>
> So, it would be very interesting, how long NT will stay at SYNC level and
if
> there is a safe way th adjust the sustem time ?
>
> Best regards
>
> F.X.
>
>
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com]On Behalf Of Dan Partelly
> > Sent: Monday, July 22, 2002 4:22 PM
> > To: NT Developers Interest List
> > Subject: [ntdev] Re: SetLocalTime prevents interrupts
> >
> >
> > I think that fail proof data processing at a interrupt rate of 1
> > milisecond
> > is very hard to implement. Not only the interrupt model in NT , but also
> > thread scheduling are not very adequate for real time processing. The
main
> > ideea is that when your device interrupts, this is an
> > asynchronous event and
> > execution context is not determined. It might take several thread
switches
> > for
> > your application threads to be scheduled for execution, and collect the
> > data. Frankly Interrupt latencys are pretty low , so I dont know
> > exactly if
> > what I said earlier is the reason this happens you, but it can be an
> > explnation.
> >
> > What is the intended use of your device / app? Is it required to allow a
> > user mode process to make nofail, low latency processing on something
> > every 1Ms ?
> >
> >
> >
> > ----- Original Message -----
> > From: “F.X. Mayer”
> > To: “NT Developers Interest List”
> > Sent: Monday, July 22, 2002 5:05 PM
> > Subject: [ntdev] Re: SetLocalTime prevents interrupts
> >
> >
> > > Dan
> > >
> > > thank you for your quick response.
> > >
> > > Is there any chance to process interrupts at the rate of 1000 Hz
without
> > any
> > > interrupt lost and call SetLocalTime() ?
> > >
> > > Best regards
> > >
> > > F.X.
> > >
> > >
> > >
> > > > -----Original Message-----
> > > > From: xxxxx@lists.osr.com
> > > > [mailto:xxxxx@lists.osr.com]On Behalf Of Dan Partelly
> > > > Sent: Monday, July 22, 2002 3:25 PM
> > > > To: NT Developers Interest List
> > > > Subject: [ntdev] Re: SetLocalTime prevents interrupts
> > > >
> > > >
> > > > SetSystemTime will be processed deep inside the kernel of windows
NT,
> > and
> > > > will result in at least one IRQL raise to
> > > > SYNCH level , which is pretty much higher than any device IRQL. So
if
> > your
> > > > device happens to interrupt while IRQL
> > > > is at SYNCH, due to interrupt priority arbitration, it wont be
allowed
> > to
> > > > interrupt, and is pended.
> > > >
> > > > Dan
> > > >
> > > >
> > > >
> > > > ----- Original Message -----
> > > > From: “F.X. Mayer”
> > > > To: “NT Developers Interest List”
> > > > Sent: Monday, July 22, 2002 3:13 PM
> > > > Subject: [ntdev] SetLocalTime prevents interrupts
> > > >
> > > >
> > > > > Hi all
> > > > >
> > > > > I wrote a device driver on NT 4.0 for a PCI-Device that
> > > > interrupts every 1
> > > > > Millisecond. Every thing works fine, but when I start an
> > > > application that
> > > > > calls the SetLocalTime function, at least one interrupt is
> > lost. Does
> > > > > anybody know what can be the reason for this behaviour, or knows a
> > > > > workaround.
> > > > >
> > > > > Thank you very much in advance
> > > > >
> > > > > F.X.
> > > > >
> > > > >
> > > > >
> > > > > —
> > > > > You are currently subscribed to ntdev as: xxxxx@rdsor.ro
> > > > > To unsubscribe send a blank email to %%email.unsub%%
> > > > >
> > > >
> > > >
> > > >
> > > > —
> > > > You are currently subscribed to ntdev as: xxxxx@fxm.de
> > > > To unsubscribe send a blank email to %%email.unsub%%
> > > >
> > >
> > >
> > >
> > > —
> > > You are currently subscribed to ntdev as: xxxxx@rdsor.ro
> > > To unsubscribe send a blank email to %%email.unsub%%
> > >
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@fxm.de
> > To unsubscribe send a blank email to %%email.unsub%%
> >
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@rdsor.ro
> To unsubscribe send a blank email to %%email.unsub%%
>