none
Turn off one core of 4 cores i5 CPU RRS feed

  • Question

  • Hello,

    Is it possible to turn off one core of 4 cores i5 CPU for the case, when Windows will not work with it?

    We need to turn off one core and use it just for APIC Timer clock computations. We want to communicate with APIC Timer in Kernel mode in our driver.

    --

    Kind regards,

    Alexey Kisliy


    Wednesday, July 24, 2013 10:49 AM

Answers

  • You should be able to boot time set the number of CPU's but whether the APIC timer is completely independant is another question. 

    Does your system have space for another card?  I know there used to be independant timer cards, and while I suspect they may not be for current busses exploring creating one may be your best option.


    Don Burn Windows Filesystem and Driver Consulting Website: http://www.windrvr.com Blog: http://msmvps.com/blogs/WinDrvr

    Wednesday, July 24, 2013 11:01 AM

All replies

  • You should be able to boot time set the number of CPU's but whether the APIC timer is completely independant is another question. 

    Does your system have space for another card?  I know there used to be independant timer cards, and while I suspect they may not be for current busses exploring creating one may be your best option.


    Don Burn Windows Filesystem and Driver Consulting Website: http://www.windrvr.com Blog: http://msmvps.com/blogs/WinDrvr

    Wednesday, July 24, 2013 11:01 AM
  • If you just want high resolution "wall time", why not to use QueryPerformanceCounter or KeQueryPerformanceCounter ?

    -- pa

    Wednesday, July 24, 2013 11:53 AM
  • If you just want high resolution "wall time", why not to use QueryPerformanceCounter or KeQueryPerformanceCounter ?

    Because we need to work with timer in Kernel mode from code of our driver. In the driver we have interrupt routines, which are managed by APIC timer, in which we have our code.

    --

    Kind regards,

    Alexey Kisliy




    • Edited by Oleksii Kyslyi Wednesday, July 24, 2013 1:34 PM Added one point
    Wednesday, July 24, 2013 12:25 PM
  • You should be able to boot time set the number of CPU's but whether the APIC timer is completely independant is another question. 

    Does your system have space for another card?  I know there used to be independant timer cards, and while I suspect they may not be for current busses exploring creating one may be your best option.


    Don Burn Windows Filesystem and Driver Consulting Website: http://www.windrvr.com Blog: http://msmvps.com/blogs/WinDrvr

    We already have external timer, but it has big interrupt latencies and using of external device is fallback strategy for us. We just want to use APIC timer. In all Windows everything was allright, but Windows 7 started to use APIC timer with embedded into OS profilers and it brought problems for us.

    --

    Kind regards,

    Alexey Kisliy




    • Edited by Oleksii Kyslyi Wednesday, July 24, 2013 1:35 PM Added one point
    Wednesday, July 24, 2013 12:51 PM
  • Instead of turning off the processor, how about:

    1.  Create a thread with affinitiy to only this processor

    2.  Use KeStallExecutionProcessor and KeQueryPerformaceCounter at HIGH_LEVEL to delay things the time you need. 

    Yes it will not pass driver verifier (unless you are tricky), but it will solve your problem.  Since this is a system you control, not a general purpose system the DV failure should be acceptable.


    Don Burn Windows Filesystem and Driver Consulting Website: http://www.windrvr.com Blog: http://msmvps.com/blogs/WinDrvr

    Wednesday, July 24, 2013 1:47 PM
  • I understand your desire to not have external components for your interrupt source, but that is no longer possible. However, you don't necessarily need an expensive PCIe precision timer/interrupt source. You can get really good results with USB and a small and cheap ($30) microcontroller. The USB host controller will poll for "interrupt" transfers from a device at a driver-specified interval, as fast as every 125 microseconds. With a small amount of work, you can easily write some firmware that will respond to these interrupt polling requests, which will give you a callback in your driver at IRQL 2.

     -Brian


    Azius Developer Training www.azius.com Windows device driver, internals, security, & forensics training and consulting.

    Wednesday, July 24, 2013 7:32 PM
    Moderator
  • Hi, Brian,

    We already have external PCI device for clock computations. But this timer has big interrupt latencies. I will explain, what for 2 problems we have in our case with this external device.

    First - Interrupt Line in PCI-Bus, through which our external timer connects with APIC and CPU. This line can be busy, because of a lot devices connected through PCI-Bus in last systems. And so in our case of real-time system, we can get interrupt latencies or just lost values, when interrupt line will be busy by another devices, which share it between each other.

    Second problem in case of external timer is latency between Disabling and Enabling Interrupts. In last technologies these are EvtInterruptEnable and EvtInterruptDisable callback functions. Just between Disabling and Enabling Interrupts executes some code, so it will take time and it will make latencies, that are not fit for our real-time system.

    If we can fix these 2 problems, then it is possible for us to use external timer.

    In case of APIC Timer we do now have these 2 problems.

    --

    Kind regards,

    Alexey Kisliy


    • Edited by Oleksii Kyslyi Thursday, July 25, 2013 12:13 PM Added one point
    Thursday, July 25, 2013 11:36 AM
  • Instead of turning off the processor, how about:

    1.  Create a thread with affinitiy to only this processor

    2.  Use KeStallExecutionProcessor and KeQueryPerformaceCounter at HIGH_LEVEL to delay things the time you need. 


    Don Burn Windows Filesystem and Driver Consulting Website: http://www.windrvr.com Blog: http://msmvps.com/blogs/WinDrvr

    Mr. Burn,

    We have analyzed this option. We do not see solution in this option, because do not see, who will call ISR routines. In MSDN is just written, that "Depending on the platform, KeQueryPerformanceCounter can disable system-wide interrupts for a minimal interval", but it is not exactly, what we need.

    --

    Kind regards,

    Alexey Kisliy

    Thursday, July 25, 2013 12:26 PM
  • Why do you want disable & enable the interrupt of the periodic timer??? Let it run freely, in the isr just dispatch the DPC. Hope your ext. timer does not share interrupt line with other devices, otherwise all complaints about latency are nonsense.

    -- pa

    Enable & Disable statements are used in some drivers in the system and therefore they destroy our real-time system. We cannot refuse from using these Enable & Disable statements.

    Our ext. timer does share interrupt line with other devices :(

    Is it possible to use external timer in our case?

    --

    Kind regards,

    Alexey Kisliy



    • Edited by Oleksii Kyslyi Thursday, July 25, 2013 4:44 PM Added one point
    Thursday, July 25, 2013 1:42 PM