From: Konstantin Ozerkov <kozerkov@parallels.com>
To: Andy Lutomirski <luto@amacapital.net>,
Luis Rodriguez <mcgrof@suse.com>, Takashi Iwai <tiwai@suse.de>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
ALSA development <alsa-devel@alsa-project.org>
Subject: Re: Getting rid of inside_vm in intel8x0
Date: Wed, 30 Mar 2016 10:32:51 +0300 [thread overview]
Message-ID: <56FB8123.1020801@parallels.com> (raw)
In-Reply-To: <CALCETrWnsn4CoRXcKDXpMTjxCYj8==mZQHkZRuXfZQyvERB3Gw@mail.gmail.com>
Hello.
I'm strongly disagree to revert this path or disable optimization.
This patch fixes real sound issue when Linux runs inside VM.
On 30/03/16 00:37, Andy Lutomirski wrote:
> Would it be possible to revert:
>
> commit 228cf79376f13b98f2e1ac10586311312757675c
> Author: Konstantin Ozerkov <kozerkov@parallels.com>
> Date: Wed Oct 26 19:11:01 2011 +0400
>
> ALSA: intel8x0: Improve performance in virtual environment
>
> Presumably one or more of the following is true:
>
> a) The inside_vm == true case is just an optimization and should apply
> unconditionally.
Wrong. Code without optimization gracefully handle some odd hardware.
But code with optimization also fixes real problem in virtual environment.
>
> b) The inside_vm == true case is incorrect and should be fixed or disabled.
Could you explain what is wrong ?
>
> c) The inside_vm == true case is a special case that makes sense then
> IO is very very slow but doesn't make sense when IO is fast. If so,
> why not literally measure the time that the IO takes and switch over
> to the "inside VM" path when IO is slow?
Measuring IO performance inside VM is not easy as may seen. Most of
clock sources are
emulated and adjusted to hide VM-exit (emulation) hole, i.e. time flow
inside VM have
delays and speedups in comparison to wall clock time. To detect "inside
VM" condition by this
way loop should run at least 1 seconds or more (10 or more preferred)
without guarantee of
proper detection. I think this is not acceptable at module
initialization time.
>
> There are a pile of nonsensical "are we in a VM" checks of various
> sorts scattered throughout the kernel, they're all a mess to maintain
> (there are lots of kinds of VMs in the world, and Linux may not even
> know it's a guest), and, in most cases, it appears that the correct
> solution is to delete the checks. I just removed a nasty one in the
> x86_32 entry asm, and this one is written in C so it should be a piece
> of cake :)
From drivers view VM is sort of hardware with special requirements and
capabilities. Sometimes drivers should
be aware about them to work properly.
The simplest way to remove "are we in a VM" checks mess is write
kernel-wide service that detects this
condition and switch to use it in other places.
I agree that check inside snd_intel8x0_inside_vm() looks very strict.
Originally this code was designed to enable optimization
only for well tested environments (KVM-based or Parallels VMs).
>
> --Andy
prev parent reply other threads:[~2016-03-30 7:33 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-29 21:37 Getting rid of inside_vm in intel8x0 Andy Lutomirski
2016-03-30 6:07 ` Takashi Iwai
2016-03-31 22:26 ` Luis R. Rodriguez
2016-04-01 5:34 ` Takashi Iwai
2016-04-01 5:34 ` Takashi Iwai
2016-04-01 22:28 ` Luis R. Rodriguez
2016-04-01 22:28 ` Luis R. Rodriguez
2016-04-02 5:33 ` Takashi Iwai
2016-04-02 5:33 ` Takashi Iwai
2016-04-02 12:57 ` Andy Lutomirski
2016-04-02 12:57 ` Andy Lutomirski
2016-04-02 16:07 ` Takashi Iwai
2016-04-02 18:05 ` Andy Lutomirski
2016-04-02 18:05 ` Andy Lutomirski
2016-04-02 20:22 ` Takashi Iwai
2016-04-02 20:22 ` Takashi Iwai
2016-04-04 18:31 ` Luis R. Rodriguez
2016-04-04 18:31 ` Luis R. Rodriguez
2016-04-02 16:07 ` Takashi Iwai
2016-04-04 9:05 ` George Dunlap
2016-04-04 9:05 ` George Dunlap
2016-04-04 9:15 ` Takashi Iwai
2016-04-04 9:15 ` Takashi Iwai
2016-04-04 9:15 ` Takashi Iwai
2016-04-04 9:05 ` George Dunlap
2016-04-02 12:57 ` Andy Lutomirski
2016-04-02 5:33 ` Takashi Iwai
2016-03-31 22:26 ` Luis R. Rodriguez
2016-03-30 7:32 ` Konstantin Ozerkov [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56FB8123.1020801@parallels.com \
--to=kozerkov@parallels.com \
--cc=alsa-devel@alsa-project.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=mcgrof@suse.com \
--cc=tiwai@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.