Under what conditions would GetNumaNodeNumberFromHandle() fail?
-
Saturday, March 31, 2012 2:48 PM
I tried the GetNumaNodeNumberFromHandle() and it failed with a Error_Invalid_Function. The system is a NUMA supported and all the other NUMA supported calls work and the handle is also valid. The OS is W2K8 R2 SP1. So my question is based on the man pages which said:
>>If the specified handle does not have a node associated with it, the function returns FALSE.
My questions
1. Could the failure be because of the above reason?
2. If so can I check this out by some other method?
3. Why would the handle I get not associated with a node?
4. What makes the handle not to get associated with a node?
5. What is the criteria for a device to get associated with a node?
6. Is there a call like GetDevicesAssocitedWithNode() where in you give the node number and it spits out the list of devices associated with it?
7. I tried dumping the SRAT table by doing !srat in the winDbg it needs a physical address as parameter. Any idea how I can dig that out.
The device I am talking is a PCIE IO device. A card that is plugged in to a slot. The code looks like this. All the preceding NUMA calls works:
HDevice = CreateFile (
pDecviceParams->DeviceInfo.DevicePath,
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ|FILE_SHARE_WRITE,
(LPSECURITY_ATTRIBUTES)NULL, // no SECURITY_ATTRIBUTES structure
OPEN_EXISTING, // No special create flags
FILE_FLAG_OVERLAPPED,
NULL);
if (HDevice == INVALID_HANDLE_VALUE) {
return(1);
}
ret = GetNumaHighestNodeNumber(&higestNodeNumber);
ret = GetNumaNodeProcessorMaskEx(0, &ga);
ret = GetNumaNodeProcessorMaskEx(1, &ga);
ret = GetNumaAvailableMemoryNode(0, &mem);
ret = GetNumaAvailableMemoryNode(1, &mem);
if (!GetNumaNodeNumberFromHandle(HDevice, &nodeNumber)) {
printf("GetNumaNodeNumberFromHandle failed Err = 0x%x\n", GetLastError());
return(1);
}Any and all help will be much appreciated.
All Replies
-
Sunday, April 01, 2012 1:41 AM
Can you post the value (string) of DeviceInfo.DevicePath?
-- pa
-
Sunday, April 01, 2012 4:20 PM
>>If this is just an arbitrary PCIe card, the answer depends on how it's driver makes it visible to usermode. For example, the driver could create a "phantom" software-only device entity that is not >>related to the actual hardware. In other words, there is a sort of devices that are not file, file stream, disk, socket, or other types mentioned in the docum.
>>-- pa
Thank you very much for both of the replies. I have combined both of your replies Pavel here in this single thread.
#define FILE_DEVICE 0x00008500
#define IOCTL_BASE 0x00000880
#define GET_IOCTL(Offset) CTL_CODE(FILE_DEVICE, IOCTL_BASE + Offset, METHOD_BUFFERED, FILE_ANY_ACCESS)
So it is a file device
To answer your second question :
+DevicePath 0x00372160 "\\?\pci#ven_8086&dev_XXXX&subsys_00000000&rev_25#4&13f6dea0&0&0018#{b74cfec2-9366-454a-ba71-7c27b51470a4}" char [260]
Except for the Device ID(XXXX) rest everything is ASIS from the debugger output.
If there is an answer to my earlier question:
>>6. Is there a call like GetDevicesAssocitedWithNode() where in you give the node number and it spits out the list of devices associated with it?
that would make life easy ... :-)
-
Sunday, April 01, 2012 10:22 PM
Hi Ananda,
I've just tried this on my own PCI card on Win7 SP1. GetNumaNodeNumberFromHandle returns success and node number 0 (as it is a plain vanilla whitebox PC).
So, generally this API does work on handles of this sort, the problem is somewhere on your side - your machine or maybe the driver.
Regards,
-- pa


