Wierd hack to sound/pci/intel8x0.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The recently merged 228cf79376f1 ("ALSA: intel8x0: Improve performance
in virtual environment") is hacky and somewhat wrong.

First, the detection code

+       if (inside_vm < 0) {
+               /* detect KVM and Parallels virtual environments */
+               inside_vm = kvm_para_available();
+#if defined(__i386__) || defined(__x86_64__)
+               inside_vm = inside_vm ||
boot_cpu_has(X86_FEATURE_HYPERVISOR);
+#endif
+       }
+
 
is incorrect.  It detects that you're running in a guest, but that
doesn't imply that the device you're accessing is emulated.  It may be a
host device assigned to the guest; presumably the optimization you apply
doesn't work for real devices.

Second, the optimization itself looks fishy:

        spin_lock(&chip->reg_lock);
        do {
                civ = igetbyte(chip, ichdev->reg_offset + ICH_REG_OFF_CIV);
                ptr1 = igetword(chip, ichdev->reg_offset +
ichdev->roff_picb);
                position = ichdev->position;
                if (ptr1 == 0) {
                        udelay(10);
                        continue;
                }
-               if (civ == igetbyte(chip, ichdev->reg_offset +
ICH_REG_OFF_CIV) &&
-                   ptr1 == igetword(chip, ichdev->reg_offset +
ichdev->roff_picb))
+               if (civ != igetbyte(chip, ichdev->reg_offset +
ICH_REG_OFF_CIV))
+                       continue;
+               if (chip->inside_vm)
+                       break;
+               if (ptr1 == igetword(chip, ichdev->reg_offset +
ichdev->roff_picb))
                        break;
        } while (timeout--);


Why is the emulated device timing out?  Can't the emulation be fixed to
behave like real hardware?

Last, please copy kvm@xxxxxxxxxxxxxxx on such issues.

-- 
error compiling committee.c: too many arguments to function

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux