Help - Locking Kernel Thread

Discussion in 'Windows Vista Drivers' started by hypervista, Jul 4, 2007.

  1. hypervista

    hypervista Guest

    Can someone give me a few groups on going about locking a kernel thread to
    one processor? I have an Intel core 2 duo processor and need to lock a
    kernel thread to one of the cores. Any help / suggestions would be greatly
    appreciated.
     
    hypervista, Jul 4, 2007
    #1
    1. Advertisements

  2. hypervista

    Don Burn Guest

    The first thing is why do you want to do this? Most designs that require
    this are broken, so if it is for things like your code is not MP safe
    forget this. If you really need to do this, do something like:

    status = PsCreateSystemThread(&h, THREAD_ALL_ACCESS, NULL, NULL, NULL,
    (PKSTART_ROUTINE) pptThread, NULL);

    if (NT_SUCCESS(status))
    {
    Affinity = (i ? (1 << n : 1);
    status = ZwSetInformationThread(h ThreadAffinityMask, &Affinity,
    sizeof(KAFFINITY) );
    }


    But tell us why you thing you need this, since you are probably not going
    to get what you think.


    --
    Don Burn (MVP, Windows DDK)
    Windows 2k/XP/2k3 Filesystem and Driver Consulting
    Website: http://www.windrvr.com
    Blog: http://msmvps.com/blogs/WinDrvr
    Remove StopSpam to reply


    ""
     
    Don Burn, Jul 4, 2007
    #2
    1. Advertisements

  3. hypervista

    hypervista Guest

    Thank you for the reply Don, especially on the holiday.

    I'm writing a Windows Vista x64 device driver based hypervisor using
    Intel's VT-x virtualization extensions (VMX). While I will eventually make
    it MP safe, I'm trying to get a demo version running and making a hypervisor
    (VMM) MP safe is quite an endeavor. I want to lock it to a single core for
    now (just to get a proof-of-concept running in the near-term). I have
    VMXLAUNCH working but getting random VMEXITs and suspect I'm running into MP
    conflicts with virtualization. I want to elliminate MP as a cause for the
    random VMEXITs.

    Again, thank you so much for your quick reply.

    Don Bailey
    Founder & CEO Hypervista Technologies
     
    hypervista, Jul 5, 2007
    #3
  4. hypervista

    Don Burn Guest

    Remember things can still happen on the other processor. You may want to
    consider using a boot optuon to reduce the number of processors to 1.


    --
    Don Burn (MVP, Windows DDK)
    Windows 2k/XP/2k3 Filesystem and Driver Consulting
    Website: http://www.windrvr.com
    Blog: http://msmvps.com/blogs/WinDrvr
    Remove StopSpam to reply

    ""
     
    Don Burn, Jul 5, 2007
    #4
  5. hypervista

    hypervista Guest

    Thnx! I had not thought of the boot option .....
     
    hypervista, Jul 6, 2007
    #5
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.