http://defect.opensolaris.org/bz/show_bug.cgi?id=6265

           Summary: mismerge in c-state wakeup could lead to poking the
                    wrong CPU
    Classification: Development
           Product: power-mgmt
           Version: unspecified
          Platform: Other
        OS/Version: Solaris
            Status: ACCEPTED
          Severity: minor
          Priority: P4
         Component: c-state
        AssignedTo: eric.saxe at sun.com
        ReportedBy: eric.saxe at sun.com
                CC: tesla-dev at opensolaris.org


While fixing a lint issue in cstate_wakeup() I found a bug:

/*
 * c-state wakeup function.
 * Similar to cpu_wakeup and cpu_wakeup_mwait except this function deals
 * with CPUs asleep in MWAIT, HLT, or ACPI Deep C-State.
 */
void
cstate_wakeup(cpu_t *cp, int bound)
{
        /*
         * See if there's any other halted CPUs. If there are, then
         * select one, and awaken it.
         * It's possible that after we find a CPU, somebody else
         * will awaken it before we get the chance.
         * In that case, look again.
         */
        do {
                cpu_found = bitset_find(&cpu_part->cp_haltset); <------ 1
                if (cpu_found == (uint_t) -1)
                        return;

        } while (bitset_atomic_test_and_del(&cpu_part->cp_haltset, cpu_found) <
0);

        /*
         * Must use correct wakeup mechanism to avoid lost wakeup of
         * alternate cpu.
         */
        if (cpu_found != CPU->cpu_seqid) {
                mcpu_mwait = cpu[cpu_found]->cpu_m.mcpu_mwait;
                if ((mcpu_mwait != NULL) && (*mcpu_mwait == MWAIT_HALTED))
                        MWAIT_WAKEUP(cpu[cpu_found]);
                else
                        poke_cpu(cpu_found); <------ 2
        }
}

1: cpu_found now holds the sequential id returned by bitset_find().

2: The sequential id is passed to poke_cpu(). This is a problem because
poke_cpu() needs cp->cpu_id (and not cp->cpu_seqid).

The poke_cpu() should be: poke_cpu(cpu_seq[cpu_found]->cpu_id);

-- 
Configure bugmail: http://defect.opensolaris.org/bz/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

Reply via email to