public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* Re: kvm-27 vs 28 I/O speed
@ 2007-07-13 15:11 Gregory Haskins
       [not found] ` <46975DD10200005A00027808-Igcdv/6uVdMHoYOw/+koYqIwWpluYiW7@public.gmane.org>
  0 siblings, 1 reply; 32+ messages in thread
From: Gregory Haskins @ 2007-07-13 15:11 UTC (permalink / raw)
  To: kronos.it-Re5JQEeQqe8AvxtiuMwx3w
  Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

On Fri, 2007-07-13 at 16:46 +0200, Luca wrote:
> On 7/13/07, Gregory Haskins <ghaskins-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org> wrote:

> Just to clarify: you are suggesting that the "old" IDE driver used to
> see that the controller was disabled and reprogrammed it by itself
> (fast mode); now it sees it's enabled and leaves whatever mode is
> currently set.
> I can't look at the sources right now but it's at least plausible ;-)
> 

Yeah.  As Im sure you are aware, those bits that your patch modifies are
(IIUC) for enabling/disabling access to the legacy IDE.  On real
hardware, they can be used by the bios to enable/disable the legacy IDE
function.  It doesnt actually disable the chip IIUC..its just a flag to
let higher layer software detect if the legacy IDE is usable.  In our
emulated environment, those bits were left undefined prior to your patch
(neither qemu nor bochs was configuring them).  Dont ask me why, but
what they initialized to was relatively consistent instead of random.
However, you cannot predict which way (on or off) and it seems each
environment was somewhat different (e.g. no one else was complaining
about the loss of IDE when i first stumbled on it, yet it was
consistently broken for me through a couple of releases).

So what I am thinking is that the drivers included with the FC7 kernel
are defaulting to some kind of slower legacy mode when they see it is
available and enabled.  Otherwise, they probably load some direct
non-legacy PCI driver and use that instead.

If this theory pans out, I would suggest we make some kind of flag in
qemu "--disable-legacy-ide" where the default is "enabled" (as your
patch does today).  That way, people with this issue can disable it in
the "bios" just like a real system.

-Greg



-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

^ permalink raw reply	[flat|nested] 32+ messages in thread
* Re: kvm-27 vs 28 I/O speed
@ 2007-07-13 16:10 Gregory Haskins
  0 siblings, 0 replies; 32+ messages in thread
From: Gregory Haskins @ 2007-07-13 16:10 UTC (permalink / raw)
  To: kronos.it-Re5JQEeQqe8AvxtiuMwx3w
  Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

On Fri, 2007-07-13 at 17:39 +0200, Luca wrote:

> Still, I fail to see why enabling the ports should reduce the speed.
> Dave, can you confirm that backing out my patch fixes your speed issue?

BTW: I said what I said because I thought people had already bisected
the problem down to your patch.  If that's not the case, then what I
said is probably completely invalid, and I apologize for wasting
everyone's time.


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

^ permalink raw reply	[flat|nested] 32+ messages in thread
* Re: kvm-27 vs 28 I/O speed
@ 2007-07-13 16:04 Gregory Haskins
  0 siblings, 0 replies; 32+ messages in thread
From: Gregory Haskins @ 2007-07-13 16:04 UTC (permalink / raw)
  To: kronos.it-Re5JQEeQqe8AvxtiuMwx3w
  Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

On Fri, 2007-07-13 at 17:39 +0200, Luca wrote:
> On 7/13/07, Gregory Haskins <ghaskins-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org> wrote:
> > On Fri, 2007-07-13 at 16:46 +0200, Luca wrote:
> > > On 7/13/07, Gregory Haskins <ghaskins-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org> wrote:
> >
> > > Just to clarify: you are suggesting that the "old" IDE driver used to
> > > see that the controller was disabled and reprogrammed it by itself
> > > (fast mode); now it sees it's enabled and leaves whatever mode is
> > > currently set.
> > > I can't look at the sources right now but it's at least plausible ;-)
> > >
> >
> > Yeah.  As Im sure you are aware, those bits that your patch modifies are
> > (IIUC) for enabling/disabling access to the legacy IDE.  On real
> > hardware, they can be used by the bios to enable/disable the legacy IDE
> > function.  It doesnt actually disable the chip IIUC..
> 
> Hum, are you *really* sure? Intel doc says:

Of course not!  That was a long time ago and my memory is fuzzy :P

> 
> "IDE Decode Enable (IDE). 1=Enable; 0=Disable. When enabled, I/O
> transactions on PCI
> targeting the IDE ATA register blocks (command block and control
> block) are positively
> decoded on PCI and driven on the IDE interface. When disabled, these
> accesses are
> subtractively decoded to ISA."
> 
> Now, "subtractively decoded to ISA" means that if nobody wants them
> then those accesses are left to ISA devices (the PCI-to-ISA bridge
> forwards them).
> So IIRC setting the decode enable to 0 really means "disable the controller".


I think what you say is 100% accurate, but you are taking what I was
saying too literally.  All I meant was that I don't think setting those
bits to enabled/disabled actually affects whether the IDE subsystem can
still be *used* or not...but rather it affects the interface that can be
used to access them.  

I could very well be totally wrong here, but the way I see it is that
some of these chips like the ICH present multiple abstractions to a
single subsystem.  I.e. there might be ISA representation for a feature
X, as well as a PCI representation.  Both of these features end up at
the same "IDE ribbon cable" so to speak, but the logical controller
abstraction is overloaded on multiple interfaces (e.g. ISA and PCI) and
can be independently manipulated.

Those bits in question enable the presentation of the standard IDE
interfaces.  However, IIRC there are ways to access the ide without
using the legacy IDE command/control blocks (e.g. via a PIIX3 mass
storage controller in PCI space).
  
> 
> > its just a flag to let higher layer software detect if the legacy IDE is usable.  In our
> > emulated environment, those bits were left undefined prior to your patch
> > (neither qemu nor bochs was configuring them).
> 
> Bochs *is* enabling the ports; it's just that it does that in the
> emulated device (i.e. the equivalent of out hw/ide.c) and not in the
> BIOS.

I don't doubt you, but that is contrary to the observed behavior I saw.
My SLED installed kept telling me I didnt have a valid hard-disk.
Debugging, I found that the IDE subsystem was skipping the disks because
they were disabled in bios..leading me to make a similar patch as yours
which fixed the problem.  If bochs was setting those bits, they were
gone by the time the installer got to them ;)

> 
> Btw, the original thread is there:
> http://thread.gmane.org/gmane.comp.emulators.kvm.devel/3619
> 
> > So what I am thinking is that the drivers included with the FC7 kernel
> > are defaulting to some kind of slower legacy mode when they see it is
> > available and enabled.  Otherwise, they probably load some direct
> > non-legacy PCI driver and use that instead.
> 
> Nope, FC7 with libata doesn't find anything at all. It doesn't even
> try to touch the controller if the ports are not enabled. This makes a
> lot of sense since with ports disabled all the access to the command
> and control blocks are forwarded to the ISA worlds (since the IDE
> controller is not claiming the transactions).
> I guess that the old driver has some logic like "BIOS is stupid, we
> really want to enable this port".
> Still, I fail to see why enabling the ports should reduce the speed.
> Dave, can you confirm that backing out my patch fixes your speed issue?

I don't think this is what is happening.  I think what happens is the
legacy IDE driver tries its probe and fails due to the disabled bits.
Later a different driver succeeds at its probe (e.g. say a PCI based
PIIX3 or similar).  Likewise, I am guessing that this other driver is
more efficient at virtualization due to its interaction with the device.
But, like I mentioned, I am guessing here. ;)



-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

^ permalink raw reply	[flat|nested] 32+ messages in thread
* Re: kvm-27 vs 28 I/O speed
@ 2007-07-13 14:00 Gregory Haskins
       [not found] ` <46974D330200005A000277EF-Igcdv/6uVdMHoYOw/+koYqIwWpluYiW7@public.gmane.org>
  0 siblings, 1 reply; 32+ messages in thread
From: Gregory Haskins @ 2007-07-13 14:00 UTC (permalink / raw)
  To: avi-atKUWr5tajBWk0Htik3J/w; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

On Fri, 2007-07-13 at 16:41 +0300, Avi Kivity wrote:


> I tested FC6 i386 about found no difference with or without the patch.
> 
> Dave, can you diff the guest dmesg with kvm-27 and kvm-28 userspace? 
> Maybe that will tell us something.
> 

I can say this:  It would seem that the IDE enable bits "float" before
Lucas fix.  I say this because I had written/submitted a similar fix way
back in kvm-teens because I found that sometimes my SLED installer guest
would fail to see the IDE controller.  I found it to be that the IDE
controller wasn't enabled sometimes and setting the 0x80 bits as Luca
has done fixed the issue.

Then, I found that later versions of KVM (sans my patch) seemed to work
fine so I somewhat assumed the issue had been addressed.  When I saw
Lucas patch come through, I realized that it must not have been fixed,
but I was getting lucky that it tended to come up enabled pretty much
100%.

So heres what I think is happening:  I think that having the IDE
controller enabled is causing FC7 to go into a different mode of
operation, which is slower for whatever reason.  I think that Dave has a
system that relatively deterministically comes up disabled, and Avi has
one that comes up enabled.  Therefore, the patch has ill-effect for
Dave, and no-effect for Avi.

Therefore, to test this theory, Avi should modify Luca patch to
*disable* the IDE and see what happens.  If the theory is true, Avi will
see a speed improvement.

Just a shot in the dark... ;)

-Greg 


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

^ permalink raw reply	[flat|nested] 32+ messages in thread
* kvm-27 vs 28 I/O speed
@ 2007-07-06 19:07 Dave Hansen
  2007-07-08  8:14 ` Avi Kivity
  0 siblings, 1 reply; 32+ messages in thread
From: Dave Hansen @ 2007-07-06 19:07 UTC (permalink / raw)
  To: kvm-devel

I've noticed that some of my tests run *MUCH* slower in kvm-28 than in
27.  I'm sure that wall time is pretty wonky in the guests, but it is
much slower in real-world time as well.

Here's a little test to create a 32MB zeroed file with dd.  Here it is
from kvm-27 (this took ~5.5 seconds on my wristwatch):
33554432 bytes transferred in 0.052050 seconds (644657845 bytes/sec)
33554432 bytes transferred in 0.062933 seconds (533176451 bytes/sec)

Here's the same thing from kvm-28 (~80 seconds on my wristwatch):
33554432 bytes transferred in 38.607065 seconds (869127 bytes/sec)
33554432 bytes transferred in 22.274318 seconds (1506418 bytes/sec)

Same host kernel, same kvm kernel modules (from kvm-28) same guest
kernel, same command-line options, same disk image.

Any ideas what is going on?

-- Dave


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

^ permalink raw reply	[flat|nested] 32+ messages in thread

end of thread, other threads:[~2007-07-18  6:01 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-13 15:11 kvm-27 vs 28 I/O speed Gregory Haskins
     [not found] ` <46975DD10200005A00027808-Igcdv/6uVdMHoYOw/+koYqIwWpluYiW7@public.gmane.org>
2007-07-13 15:39   ` Luca
     [not found]     ` <68676e00707130839o3af94674y69e7a990b27f0820-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2007-07-13 18:33       ` Dave Hansen
  -- strict thread matches above, loose matches on Subject: below --
2007-07-13 16:10 Gregory Haskins
2007-07-13 16:04 Gregory Haskins
2007-07-13 14:00 Gregory Haskins
     [not found] ` <46974D330200005A000277EF-Igcdv/6uVdMHoYOw/+koYqIwWpluYiW7@public.gmane.org>
2007-07-13 14:46   ` Luca
2007-07-06 19:07 Dave Hansen
2007-07-08  8:14 ` Avi Kivity
     [not found]   ` <46909CFD.9050806-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-07-09 20:33     ` Dave Hansen
2007-07-10  5:44       ` Avi Kivity
     [not found]         ` <46931CC9.8060106-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-07-11 18:54           ` Dave Hansen
2007-07-12  5:37             ` Avi Kivity
     [not found]               ` <4695BE06.6060609-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-07-12 18:10                 ` Dave Hansen
2007-07-13 12:23                   ` Avi Kivity
     [not found]                     ` <46976EA7.2020202-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-07-13 13:27                       ` Luca
     [not found]                         ` <68676e00707130627p32a43a63l3c6fe647242ec3e-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2007-07-13 13:41                           ` Avi Kivity
     [not found]                             ` <46978110.5090303-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-07-13 18:31                               ` Dave Hansen
2007-07-13 18:49                                 ` Anthony Liguori
     [not found]                                   ` <4697C954.8040404-rdkfGonbjUSkNkDKm+mE6A@public.gmane.org>
2007-07-14  6:27                                     ` Avi Kivity
     [not found]                                       ` <46986CEC.7050903-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-07-16 19:40                                         ` Dave Hansen
2007-07-14 17:30                                     ` Luca
2007-07-15 19:27                                 ` Luca
     [not found]                                   ` <68676e00707151227hb8b8538j706d9d0ee765ed41-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2007-07-15 21:07                                     ` Luca
     [not found]                                       ` <68676e00707151407j1cf758e0ya7032c8c8577b982-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2007-07-15 21:22                                         ` Luca
     [not found]                                           ` <68676e00707151422n2e1f0a07kc4ec10797edfa40c-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2007-07-16  8:58                                             ` Avi Kivity
     [not found]                                               ` <469B3351.50508-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-07-16 19:32                                                 ` Luca
     [not found]                                                   ` <68676e00707161232k5fbd0c2cxd8bebfc21faacc8c-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2007-07-17  7:58                                                     ` Avi Kivity
     [not found]                                                       ` <469C76C0.5050101-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-07-18  6:01                                                         ` Luca
2007-07-16 19:49                                             ` Dave Hansen
2007-07-16 19:41                                     ` Dave Hansen
2007-07-16 19:42                                     ` Dave Hansen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox