From mboxrd@z Thu Jan 1 00:00:00 1970 From: Konstantin Ozerkov Subject: Re: [PATCH] ALSA: intel8x0: Drop superfluous VM checks Date: Tue, 5 Apr 2016 17:58:59 +0300 Message-ID: <5703D2B3.7050403@parallels.com> References: <1459867994-22143-1-git-send-email-tiwai@suse.de> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: Received: from na01-bn1-obe.outbound.protection.outlook.com (mail-bn1on0083.outbound.protection.outlook.com [157.56.110.83]) by alsa0.perex.cz (Postfix) with ESMTP id 1B35C26055E for ; Tue, 5 Apr 2016 16:59:18 +0200 (CEST) In-Reply-To: <1459867994-22143-1-git-send-email-tiwai@suse.de> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: Takashi Iwai , alsa-devel@alsa-project.org Cc: "Luis R . Rodriguez" , Andy Lutomirski List-Id: alsa-devel@alsa-project.org Ack On 05/04/16 17:53, Takashi Iwai wrote: > intel8x0 driver has the inside_vm check for skipping a buggy hardware > workaround in the PCM pointer callback in the commit [228cf79376f1: > ALSA: intel8x0: Improve performance in virtual environment]. This was > originally applied to all devices on known VMs, but the code was > switched to use the PCI ID matching for applying to only known > devices (KVM and Parallels), in order to avoid applying wrongly to > VT-d and other such cases, in the commit [7fb4f392bd27: ALSA: > intel8x0: improve virtual environment detection]. > > Meanwhile, the original VM check was kept even after switching to the > PCI ID matching. It was partly because we weren't 100% sure whether > we had covered all well, and partly because this would help > identifying the issue once when a user of another VM hit the same > problem or a regression. Currently the VM check is used only for > showing the kernel message that the VM-optimization isn't applied, and > the VM check itself doesn't change the actual driver behavior at all. > > Despite the relatively safe driver behavior, the code caught attention > of developers badly and brought many confusion / misunderstanding. > Since we've got neither regression nor enhancement report for other > VMs for five years long, it's likely safe to drop this superfluous VM > check now. > > The module option is still kept, so if a user still needs to adjust, > it can be applied as was. > > Cc: Andy Lutomirski > Cc: Luis R. Rodriguez > Cc: Konstantin Ozerkov > Signed-off-by: Takashi Iwai > --- > sound/pci/intel8x0.c | 20 +++----------------- > 1 file changed, 3 insertions(+), 17 deletions(-) > > diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c > index 8151318a69a2..9720a30dbfff 100644 > --- a/sound/pci/intel8x0.c > +++ b/sound/pci/intel8x0.c > @@ -42,12 +42,6 @@ > #include > #include > > -#ifdef CONFIG_KVM_GUEST > -#include > -#else > -#define kvm_para_available() (0) > -#endif > - > MODULE_AUTHOR("Jaroslav Kysela "); > MODULE_DESCRIPTION("Intel 82801AA,82901AB,i810,i820,i830,i840,i845,MX440; SiS 7012; Ali 5455"); > MODULE_LICENSE("GPL"); > @@ -2972,25 +2966,17 @@ static int snd_intel8x0_inside_vm(struct pci_dev *pci) > goto fini; > } > > - /* detect KVM and Parallels virtual environments */ > - result = kvm_para_available(); > -#ifdef X86_FEATURE_HYPERVISOR > - result = result || boot_cpu_has(X86_FEATURE_HYPERVISOR); > -#endif > - if (!result) > - goto fini; > - > /* check for known (emulated) devices */ > + result = 0; > if (pci->subsystem_vendor == PCI_SUBVENDOR_ID_REDHAT_QUMRANET && > pci->subsystem_device == PCI_SUBDEVICE_ID_QEMU) { > /* KVM emulated sound, PCI SSID: 1af4:1100 */ > msg = "enable KVM"; > + result = 1; > } else if (pci->subsystem_vendor == 0x1ab8) { > /* Parallels VM emulated sound, PCI SSID: 1ab8:xxxx */ > msg = "enable Parallels VM"; > - } else { > - msg = "disable (unknown or VT-d) VM"; > - result = 0; > + result = 1; > } > > fini: