[Bug 19982] SetThreadAffinityMask() seems not to work correctly

wine-bugs at winehq.org wine-bugs at winehq.org
Wed Sep 30 17:17:07 CDT 2009


http://bugs.winehq.org/show_bug.cgi?id=19982





--- Comment #42 from ray at pobox.co.uk  2009-09-30 17:17:07 ---
(In reply to comment #39)
> Okay, that helps, thanks.  Ray, how is that time calculated?  Are the incorrect
> values related to bug 19960?

This problem is nothing to do with CPU times.  SIV 4.01 and later work around
that bug anyway.  The problem is that the threads are not being run on the CPU
they set affinity to:

What the [Test APIC] page is doing is checking
that the APIC of the CPU it had set affinity to is as expected.  The actual
code is a loop that does:

    if( cib->dkc )                              // CPU Switching Mode ?
    {
      if( ( cpo += 1 ) == smb->cpu + smb->log_cpus )
      {
        cpo = smb->cpu;                         // cycle round all CPUs
      }

      cpu_ssa_set( cth, cpo->ssa );             // switch to another
      cpu_ssa_set( cth, cpu->ssa );             // and back to my CPU
    }
    else                                        // no, so wait a while
    {
      ULONG volatile dly;

      for( dly = 0; dly < 3000; dly++ ) {}      // so rate is similar
    }

    if( cpu->apic == cpu_get_apic( smb ) )      // APIC correct ?
    {
      InterlockedIncrement( &cib->gar );        // Good APIC Rate
    }
    else
    {
      InterlockedIncrement( &cib->bac );        // Bad  APIC Count
    }

cpu_ssa_set() is a wrapper for SetThreadAffinityMask()
cpu_get_apic() reads the APIC of the curent CPU

As soon as the returned APIC is not as expected then FAIL is reported.

-- 
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
Do not reply to this email, post in Bugzilla using the
above URL to reply.
------- You are receiving this mail because: -------
You are watching all bug changes.



More information about the wine-bugs mailing list