Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to "escape" the system-wide CPU set? #15

Open
forderud opened this issue Aug 12, 2019 · 14 comments
Open

How to "escape" the system-wide CPU set? #15

forderud opened this issue Aug 12, 2019 · 14 comments

Comments

@forderud
Copy link

Thanks for a great book Pavel, and for sharing code samples. I'm interested in using CPU Sets to dedicate certain CPU cores to real-time signal processing tasks.

I've played a bit with CpuSet.exe based on the instructions in Windows Internals 7th ed. Part 1, and have successfully managed to change the system-wide CPU set. Changing the CPU set for a given process also works, but only within the system-wide CPU set. This means that I'm not able to reproduce "EXPERIMENT: CPU sets" in the book where CPU 0 is dedicated to the CPUSTRESS process.

Any advise on how to configure a process to "escape" the system-wide CPU set, so that it can get dedicated CPU cores?

Not sure if it's relevant, but I'm running Win10 Pro version 1903 (64bit) build 18362.267.

@zodiacon
Copy link
Owner

Hi Fredrik,
It should work... at least it did back then in the RS1 days.
I'll have to test it myself, but essentially CPU sets should allow escaping from the system CPU set just a thread can escape its process CPU set.

@forderud
Copy link
Author

@zodiacon Any updates on reproducing this issue?

@zodiacon
Copy link
Owner

Sorry, I've been super busy with work and other stuff and didn't get around to it yet.

@forderud
Copy link
Author

Gentle reminder.

@zodiacon
Copy link
Owner

Really sorry for the crazy delay...
It seems to work ok if you also set affinity for the process, not just the CPU set

@zodiacon
Copy link
Owner

It also seems that at some point the system CPU set is reset, need further testing to understand why.

@forderud
Copy link
Author

It also seems that at some point the system CPU set is reset, need further testing to understand why.

I've also experienced the same behavior, which really puzzled me.

@forderud
Copy link
Author

Status update: Microsoft have published How to set up a Device for Real-Time Performance
that documents a MDM_WindowsIoT_SoftRealTimeProperties01 management interface for configuring the system-wide CPU set. I guess this is the recommended interface for doing so.

@zodiacon
Copy link
Owner

Thank you for this.

@ToGoOrNotToGo
Copy link

@forderud Have you successfully run an application on a dedicated CPU?
Can the MDM_WindowsIoT_SoftRealTimeProperties01 setting be used on any Windows 10/11 or only on Windows IoT?

@forderud
Copy link
Author

forderud commented May 27, 2023

@forderud Have you successfully run an application on a dedicated CPU?
Can the MDM_WindowsIoT_SoftRealTimeProperties01 setting be used on any Windows 10/11 or only on Windows IoT?

I just tested on a Windows 11 Pro 21H2, and SoftRT seemed to work fine there.

Just follow the instructions on https://learn.microsoft.com/en-us/windows/iot/iot-enterprise/soft-real-time/soft-real-time-device#use-mdm-bridge-wmi-provider-to-configure-the-windowsiot-csp if you want to test yourself. I recommend testing in a VM, since it's difficult (and possibly impossible) to disable the feature after being enabled.

@ToGoOrNotToGo
Copy link

ToGoOrNotToGo commented May 28, 2023

I'll try it. Thanks!
Or do you know that it is not possible to stably handle a callback in which a CRC is calculated every 10 ms? Is this possible with soft real time or only with hard real time?
Hard real time should be possible with a dedicated CPU core (CPU set?) right?

@ghost
Copy link

ghost commented Jun 27, 2023

@forderud Have you successfully run an application on a dedicated CPU?
Can the MDM_WindowsIoT_SoftRealTimeProperties01 setting be used on any Windows 10/11 or only on Windows IoT?

I just tested on a Windows 11 Pro 21H2, and SoftRT seemed to work fine there.

Just follow the instructions on https://learn.microsoft.com/en-us/windows/iot/iot-enterprise/soft-real-time/soft-real-time-device#use-mdm-bridge-wmi-provider-to-configure-the-windowsiot-csp if you want to test yourself. I recommend testing in a VM, since it's difficult (and possibly impossible) to disable the feature after being enabled.

The feature can be reverted by deleting the ReservedCpuSets registry key. I created a program to extend the functionality of the feature in amitxv/ReservedCpuSets

@forderud
Copy link
Author

Thanks a lot for informing about the HKLM\System\CurrentControlSet\Control\Session Manager\kernel\ReservedCpuSets registry key @amitxv. This seems like a useful short-term fix for disabling Soft-RT.

I've added a note of the registry key in a Document how to disable Soft-RT enhancement request to Microsoft that I've previously opened.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants