Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results

Home NTDEV
Before Posting...
Please check out the Community Guidelines in the Announcements and Administration Category.

More Info on Driver Writing and Debugging


The free OSR Learning Library has more than 50 articles on a wide variety of topics about writing and debugging device drivers and Minifilters. From introductory level to advanced. All the articles have been recently reviewed and updated, and are written using the clear and definitive style you've come to expect from OSR over the years.


Check out The OSR Learning Library at: https://www.osr.com/osr-learning-library/


Changing MSI-X vector Affinity

msrmsr Member Posts: 348
edited September 7 in NTDEV

Hi

I have 32 MSI-X vectors. I want to affinitize each vector(in relation to other vectors) to particular proc given that I know the (static) semantics of each vector.
Implemented EvtDeviceFilterAddResourceRequirements. Also since EvtDeviceRemoveAddedResources() is needed, I just implement it empty (as I am only changing the attributes of the resource_Descriptor in-place in Add(), not adding any new descriptors etc,)

In EvtDeviceFilterAddResourceRequirements() I get my 32 MSIX, all like below.
(If it matters during FilterResourcesAdd, I get 2 logical lists, one with 32 MSI-x, another with 1INTx(alternative 8),1MSIx (preferred 1). In RemvoveAddedReosurces/PrepHW() I get 32 MSI-X.)

**Option:0**, ShareDisposition: 1, **Flags: 7** 
PriorityPolicy: 0 | AffinityPolicy: 0, TargetedProcessors:0000000000000000

Not sure why Flags is already 7 or if it is even correct (as TargetedProcessors is all zero). (In some runs I used to get Flags:3 AffinityPolicy:3 which seem to be correct)
Then I change each vector affinity like below
```
des->u.Interrupt.AffinityPolicy = IrqPolicySpecifiedProcessors;
des->u.Interrupt.TargetedProcessors = VECTOR_TO_PROC(MsgId, nActiveProcs);
des->Flags |= CM_RESOURCE_INTERRUPT_POLICY_INCLUDED;

```

PriorityPolicy: 0 | **AffinityPolicy: 4**, TargetedProcessors:0000000000000008
Option:0, ShareDisposition: 1, **Flags: 7**

But still in EvtDeviceRemoveAddedResources/PrepHw() I see below

Flags, Disposition = T(7,1) R(7.1)
Translated: Affinity:00000000000000**FF** Vector: 0x59 - Level: 0x5
Raw: Affinity:0000000000000000 Vector: 0xFFFFFFC0 - MessageCount: 1

Anyway to change per MSI-X vector affinity, this should be possible as these vectors are not shared etc ?

Thanks

-MSDN-

Define the bitmasks for resource options

define IO_RESOURCE_PREFERRED 0x01

define IO_RESOURCE_DEFAULT 0x02

define IO_RESOURCE_ALTERNATIVE 0x08

Define the bit masks for Flags when type is CmResourceTypeInterrupt

define CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE 0x00

define CM_RESOURCE_INTERRUPT_LATCHED 0x01

define CM_RESOURCE_INTERRUPT_MESSAGE 0x02

define CM_RESOURCE_INTERRUPT_POLICY_INCLUDED 0x04

define CM_RESOURCE_INTERRUPT_SECONDARY_INTERRUPT 0x10

define CM_RESOURCE_INTERRUPT_WAKE_HINT 0x20

AffinityPolicy
typedef enum _IRQ_DEVICE_POLICY {
IrqPolicyMachineDefault = 0,
IrqPolicyAllCloseProcessors,
IrqPolicyOneCloseProcessor,
IrqPolicyAllProcessorsInMachine,
IrqPolicySpecifiedProcessors,
IrqPolicySpreadMessagesAcrossAllProcessors,
IrqPolicyAllProcessorsInMachineWhenSteered
} IRQ_DEVICE_POLICY, *PIRQ_DEVICE_POLICY;

typedef enum _CM_SHARE_DISPOSITION {
CmResourceShareUndetermined = 0, // Reserved
CmResourceShareDeviceExclusive,
CmResourceShareDriverExclusive,
CmResourceShareShared
} CM_SHARE_DISPOSITION;

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Upcoming OSR Seminars
OSR has suspended in-person seminars due to the Covid-19 outbreak. But, don't miss your training! Attend via the internet instead!
Internals & Software Drivers 30 Nov 2020 LIVE ONLINE
Writing WDF Drivers 7 Dec 2020 LIVE ONLINE
Developing Minifilters Early 2021 LIVE ONLINE