multiprocessor safe

Hi,
I want to make my driver multiprocessor safe. I’ve
sychronized and mutexed most of the global objects. Is
there any additonal work that I have to do to ensure
multiprocessor safety?

I don’t have access to a multiprocessor machine. Is
there anyway I can test my driver with regards to
this?

Finally, Do I have to protect simple additive
counters?

Rajeev


Everything you always wanted to know about cars and bikes,now
at: http://in.autos.yahoo.com/cricket/tracker.html

Yes, No, Maybe.

Writing drivers for SMP systems is completely different from the usual DOS
and 9x drivers. What is your background? Have you worked on mainframes
where some multiprocessor issues must be resolved? If all you have ever
done is DOS and 9x drivers, you are in for a major learning experience.
Some drivers are easier than others, but the rules vary. If you are a
floppy driver, there can be only one drive being accessed at any one time.
Microsoft’s drivers accomplish this by using a single worker thread to
handle all requests that need to access the hardware.

You CANNOT test drivers for SMP safety. You can get a warm and fuzzy by
using a 8 processor system and an adequate testing plan, but the only way to
do it right is to understand where the problems may occur and make sure they
don’t by reviewing the code.

----- Original Message -----
From: “Rajeev Rao”
To: “NT Developers Interest List”
Sent: Monday, May 20, 2002 1:49 PM
Subject: [ntdev] multiprocessor safe

> Hi,
> I want to make my driver multiprocessor safe. I’ve
> sychronized and mutexed most of the global objects. Is
> there any additonal work that I have to do to ensure
> multiprocessor safety?
>
> I don’t have access to a multiprocessor machine. Is
> there anyway I can test my driver with regards to
> this?
>
> Finally, Do I have to protect simple additive
> counters?
>
> Rajeev
>
> ________________________________________________________________________
> Everything you always wanted to know about cars and bikes,now
> at: http://in.autos.yahoo.com/cricket/tracker.html
>
> —
> You are currently subscribed to ntdev as: xxxxx@yoshimuni.com
> To unsubscribe send a blank email to %%email.unsub%%

>

I don’t have access to a multiprocessor machine. Is
there anyway I can test my driver with regards to
this?

Not really. You need to at least purchase a low end dual processor system -
the cost is not much more than a midrange uni. Ideally you should be testing
on a 4-way system, as the concurrency of 2-ways is perhaps not as evident as
that of >2-way systems. Try the ebay route.

Finally, Do I have to protect simple additive
counters?

Yes if your code depends on the accuracy of those counters, otherwise no.

> Writing drivers for SMP systems is completely

different from the usual DOS
and 9x drivers. What is your background? Have you
worked on mainframes
where some multiprocessor issues must be resolved?
As nuts as this may, sound, I have done one or two
modules in linux, but no prg experince in win9x.

floppy driver, there can be only one drive being

accessed at any one time.
Microsoft’s drivers accomplish this by using a
single worker thread to

Well my driver is a filter driver over storage
volumes.
so its simpler then a monolithic driver. I have a list
which I have protected using a spinlock. The other
varaibles I was concerned with were counter residing
in my device extension. They are used as Transaction
id’s. Again, I used a spinlock to protect it. I’m not
sure if its necessary.

The other global variables are read-only, so I assumed
no problems there.

You CANNOT test drivers for SMP safety. You can get
a warm and fuzzy by
using a 8 processor system and an adequate testing
plan, but the only way to
do it right is to understand where the problems may
occur and make sure they
don’t by reviewing the code.
I’m doing this as a college project, the chances of
getting an smp machine is dismal. I was hoping to get
a slightly more portable driver. Well, I guess I
should give up.

thanks.

Rajeev


Everything you always wanted to know about cars and bikes,now
at: http://in.autos.yahoo.com/cricket/tracker.html

For performance reasons you should use the InterlockedXXX operations on your
counter, as I think your only concern is that the counter is consistently
incremented.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Rajeev Rao
Sent: Tuesday, May 21, 2002 12:54 AM
To: NT Developers Interest List
Subject: [ntdev] Re: multiprocessor safe

> Writing drivers for SMP systems is completely
> different from the usual DOS
> and 9x drivers. What is your background? Have you
> worked on mainframes
> where some multiprocessor issues must be resolved?
As nuts as this may, sound, I have done one or two
modules in linux, but no prg experince in win9x.

floppy driver, there can be only one drive being
> accessed at any one time.
> Microsoft’s drivers accomplish this by using a
> single worker thread to

Well my driver is a filter driver over storage
volumes.
so its simpler then a monolithic driver. I have a list
which I have protected using a spinlock. The other
varaibles I was concerned with were counter residing
in my device extension. They are used as Transaction
id’s. Again, I used a spinlock to protect it. I’m not
sure if its necessary.

The other global variables are read-only, so I assumed
no problems there.

> You CANNOT test drivers for SMP safety. You can get
> a warm and fuzzy by
> using a 8 processor system and an adequate testing
> plan, but the only way to
> do it right is to understand where the problems may
> occur and make sure they
> don’t by reviewing the code.
I’m doing this as a college project, the chances of
getting an smp machine is dismal. I was hoping to get
a slightly more portable driver. Well, I guess I
should give up.

thanks.

Rajeev



Everything you always wanted to know about cars and bikes,now
at: http://in.autos.yahoo.com/cricket/tracker.html


You are currently subscribed to ntdev as:
xxxxx@hollistech.com To unsubscribe send a blank email to
%%email.unsub%%

Just a suggestion. Open up your code, look at it and
imagine that multiple CPUs are executing this code
side-by-side – every line is executed simultaneously,
*at one and the same time*, by multiple CPUs. Then
think what will happen to your data in this case. If you
don’t like what happens, then you use a mutex or spinlock
to protect the data accessed by that code. Of course, the
same data can be accessed from several places, so you
must identify all of them and acquire the *same* mutex or
spinlock in all of them, before you touch the data. There
is no exact recipe. Be very meticulous and use your common
sense, that’s all. Reading “Inside Windows NT” (or a later
version of it) also helps.

— Rajeev Rao wrote:
>
> > Writing drivers for SMP systems is completely
> > different from the usual DOS
> > and 9x drivers. What is your background? Have you
> > worked on mainframes
> > where some multiprocessor issues must be resolved?
> As nuts as this may, sound, I have done one or two
> modules in linux, but no prg experince in win9x.
>
> floppy driver, there can be only one drive being
> > accessed at any one time.
> > Microsoft’s drivers accomplish this by using a
> > single worker thread to
>
> Well my driver is a filter driver over storage
> volumes.
> so its simpler then a monolithic driver. I have a list
> which I have protected using a spinlock. The other
> varaibles I was concerned with were counter residing
> in my device extension. They are used as Transaction
> id’s. Again, I used a spinlock to protect it. I’m not
> sure if its necessary.
>
>
> The other global variables are read-only, so I assumed
> no problems there.
>
>
>
> > You CANNOT test drivers for SMP safety. You can get
> > a warm and fuzzy by
> > using a 8 processor system and an adequate testing
> > plan, but the only way to
> > do it right is to understand where the problems may
> > occur and make sure they
> > don’t by reviewing the code.
> I’m doing this as a college project, the chances of
> getting an smp machine is dismal. I was hoping to get
> a slightly more portable driver. Well, I guess I
> should give up.
>
> thanks.
>
> Rajeev
>
>
>
> ______________________
> Everything you always wanted to know about cars and bikes,now
> at: http://in.autos.yahoo.com/cricket/tracker.html
>
> —
> You are currently subscribed to ntdev as: xxxxx@yahoo.com
> To unsubscribe send a blank email to %%email.unsub%%


Do You Yahoo!?
LAUNCH - Your Yahoo! Music Experience
http://launch.yahoo.com