Monolithic SCSI port and MmGetSystemAddressForMdlSafe(...)

Gentlemen,

we’re doing some performance tests comparing our iSCSI initiator Vs.
Microsoft iSCSI initiator. And we’ve found a situation when our code just
does not work! When the system is very low in memory (IOmeter is
configured to handle 200 requests 8 megabytes each, that’s 1600 megabytes
total and testing machine has only gigabyte of physical memory installed)
such a line of code fails (it’s part of the routine that calculates data
buffer pointer in the SRB that is part of IRP):

l__PUCHAR__DataBuffer =
( PUCHAR )
MmGetSystemAddressForMdlSafe(
p__PIRP->MdlAddress,
HighPagePriority
);

it returns NULL (the system cannot map the MDL). So we fail the SRB, IRP
and UserMode application request… In the same configuration MS code
works just great. So the question is: does anybody has an idea what shall
we do if we cannot handle the request b/s of the low memory? Delay
execution of the SRB until the system will not get stable? MS seems not to
do this… Or does anybody know what MS does to prevent such a condition?
Maybe we’re just doing wrong thing to get the data buffer for SRB in
monolithic SCSI port and there is easy and working way?

(Disassembling ISCSIPRT.SYS does not sound like a good idea for me).

Thanks for help!

Regards,
Anton Kolomyeytsev

look-up reserve mappings in the DDK. Basically you can get MM to put
aside a KVA range for you and then use it to map transfers in as
necessary. Scsiport sets up one of these (of the maximum transfer size)
during initialization to use in the case where
MmGetSystemAddressForMdlSafe fails.

you have to do some work to ensure that you’re only trying to map one
MDL into the reserved range at a time (basically queueing requests until
the reserve is available if you need it) but it’s not that hard.

-p

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Anton Kolomyeytsev
Sent: Friday, December 19, 2003 4:29 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Monolithic SCSI port and
MmGetSystemAddressForMdlSafe(…)

Gentlemen,

we’re doing some performance tests comparing our iSCSI initiator Vs.
Microsoft iSCSI initiator. And we’ve found a situation when our code
just does not work! When the system is very low in memory (IOmeter is
configured to handle 200 requests 8 megabytes each, that’s 1600
megabytes total and testing machine has only gigabyte of physical memory
installed) such a line of code fails (it’s part of the routine that
calculates data buffer pointer in the SRB that is part of IRP):

l__PUCHAR__DataBuffer =
( PUCHAR )
MmGetSystemAddressForMdlSafe(
p__PIRP->MdlAddress,
HighPagePriority
);

it returns NULL (the system cannot map the MDL). So we fail the SRB, IRP
and UserMode application request… In the same configuration MS code
works just great. So the question is: does anybody has an idea what
shall we do if we cannot handle the request b/s of the low memory? Delay
execution of the SRB until the system will not get stable? MS seems not
to do this… Or does anybody know what MS does to prevent such a
condition?
Maybe we’re just doing wrong thing to get the data buffer for SRB in
monolithic SCSI port and there is easy and working way?

(Disassembling ISCSIPRT.SYS does not sound like a good idea for me).

Thanks for help!

Regards,
Anton Kolomyeytsev


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@microsoft.com To
unsubscribe send a blank email to xxxxx@lists.osr.com

Peter,

what you’ve recommended to do is really gonna work! However the way you’ve
kindly pointed is for XP machines only. And we need to support 2000 too.
And according to import table of ISCSIPRT.SYS and MSISCSI.SYS Microsoft
itself does use other way to solve this problem b/s their modules do not
import MmAllocateMappingAddress(…), MmFreeMappingAddress(…),
MmMapLockedPagesWithReservedMapping(…) etc at all.

Looks like I’ll have to spend rest of this weekend with IDA ))

Thanks for advice in any case! Your information was valuable for me.

Regards,
Anton Kolomyeytsev

look-up reserve mappings in the DDK. Basically you can get MM to put
aside a KVA range for you and then use it to map transfers in as
necessary. Scsiport sets up one of these (of the maximum transfer size)
during initialization to use in the case where
MmGetSystemAddressForMdlSafe fails.

you have to do some work to ensure that you’re only trying to map one
MDL into the reserved range at a time (basically queueing requests until
the reserve is available if you need it) but it’s not that hard.

-p=20

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Anton Kolomyeytsev
Sent: Friday, December 19, 2003 4:29 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Monolithic SCSI port and
MmGetSystemAddressForMdlSafe(…)

Gentlemen,

we’re doing some performance tests comparing our iSCSI initiator Vs.
Microsoft iSCSI initiator. And we’ve found a situation when our code
just does not work! When the system is very low in memory (IOmeter is
configured to handle 200 requests 8 megabytes each, that’s 1600
megabytes total and testing machine has only gigabyte of physical memory
installed) such a line of code fails (it’s part of the routine that
calculates data buffer pointer in the SRB that is part of IRP):

l__PUCHAR__DataBuffer =3D
( PUCHAR )
MmGetSystemAddressForMdlSafe(
p__PIRP->MdlAddress,
HighPagePriority
);=20

it returns NULL (the system cannot map the MDL). So we fail the SRB, IRP
and UserMode application request… In the same configuration MS code
works just great. So the question is: does anybody has an idea what
shall we do if we cannot handle the request b/s of the low memory? Delay
execution of the SRB until the system will not get stable? MS seems not
to do this… Or does anybody know what MS does to prevent such a
condition?
Maybe we’re just doing wrong thing to get the data buffer for SRB in
monolithic SCSI port and there is easy and working way?

(Disassembling ISCSIPRT.SYS does not sound like a good idea for me).

Thanks for help!

Regards,
Anton Kolomyeytsev


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=3D256

You are currently subscribed to ntdev as: xxxxx@microsoft.com To
unsubscribe send a blank email to xxxxx@lists.osr.com

MmGetSystemRoutineAddress() allows you to test for the existance of a
given API in the kernel, and get the function pointer if it exists.
This routine is available in Windows 2000, and can be trivially used to
find/use the routines in question if they are available on the machine
by saving the function pointers during initialization.

Search the list archives – I just responded to this exact problem in
depth in the last few weeks.

.

-----Original Message-----
From: Anton Kolomyeytsev [mailto:xxxxx@cooldev.com]
Sent: Saturday, December 20, 2003 3:53 PM
Subject: RE: Monolithic SCSI port and MmGetSystemAddressForMdlSafe(…)

Peter,

what you’ve recommended to do is really gonna work! However the way
you’ve
kindly pointed is for XP machines only. And we need to support 2000 too.
And according to import table of ISCSIPRT.SYS and MSISCSI.SYS Microsoft
itself does use other way to solve this problem b/s their modules do not
import MmAllocateMappingAddress(…), MmFreeMappingAddress(…),
MmMapLockedPagesWithReservedMapping(…) etc at all.

Looks like I’ll have to spend rest of this weekend with IDA ))

Thanks for advice in any case! Your information was valuable for me.

Regards,
Anton Kolomyeytsev

look-up reserve mappings in the DDK. Basically you can get MM to put
aside a KVA range for you and then use it to map transfers in as
necessary. Scsiport sets up one of these (of the maximum transfer
size)
during initialization to use in the case where
MmGetSystemAddressForMdlSafe fails.

you have to do some work to ensure that you’re only trying to map one
MDL into the reserved range at a time (basically queueing requests
until
the reserve is available if you need it) but it’s not that hard.

-p=20

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Anton
Kolomyeytsev
Sent: Friday, December 19, 2003 4:29 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Monolithic SCSI port and
MmGetSystemAddressForMdlSafe(…)

Gentlemen,

we’re doing some performance tests comparing our iSCSI initiator Vs.
Microsoft iSCSI initiator. And we’ve found a situation when our code
just does not work! When the system is very low in memory (IOmeter is
configured to handle 200 requests 8 megabytes each, that’s 1600
megabytes total and testing machine has only gigabyte of physical
memory
installed) such a line of code fails (it’s part of the routine that
calculates data buffer pointer in the SRB that is part of IRP):

l__PUCHAR__DataBuffer =3D
( PUCHAR )
MmGetSystemAddressForMdlSafe(
p__PIRP->MdlAddress,
HighPagePriority
);=20

it returns NULL (the system cannot map the MDL). So we fail the SRB,
IRP
and UserMode application request… In the same configuration MS code
works just great. So the question is: does anybody has an idea what
shall we do if we cannot handle the request b/s of the low memory?
Delay
execution of the SRB until the system will not get stable? MS seems
not
to do this… Or does anybody know what MS does to prevent such a
condition?
Maybe we’re just doing wrong thing to get the data buffer for SRB in
monolithic SCSI port and there is easy and working way?

(Disassembling ISCSIPRT.SYS does not sound like a good idea for me).

Thanks for help!

Regards,
Anton Kolomyeytsev


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=3D256

You are currently subscribed to ntdev as: xxxxx@microsoft.com To
unsubscribe send a blank email to xxxxx@lists.osr.com