All of lore.kernel.org
 help / color / mirror / Atom feed
* [KVM-autotest][patch] Spread virtio_consoles across multiple PCIs
@ 2010-11-26 10:51 Lukas Doktor
  2010-11-26 10:51 ` [PATCH] " Lukas Doktor
  0 siblings, 1 reply; 2+ messages in thread
From: Lukas Doktor @ 2010-11-26 10:51 UTC (permalink / raw)
  To: autotest, kvm, kvm-autotest, akong, lmr, ldoktor, jzupka

This patch spreads the virtconsoles and virtserialports across multiple virtio-serial-pci devices.

There has been a discussion about how to test the communication between various topologies of virtio_consoles. This patch keeps the old way of configuration but still lets the user to test the communication in 1:N, N:1, N:M (no_pci : no_dev_per_pci) topologies.


The logic is simple:
Starting with virtconsoles it allocates them by two per one virtio-serial-pci device. It doesn't require any changes to tests_base.cfg but still when using more than 2 devices it transfers data between multiple PCIs. The layout can look like this:
3 consoles, 2 serialports: "CC|CS|S" => 3 virtio-serial-pci devices
3 consoles, 4 serialports: "CC|CS|SS|S" => 4 virtio-serial-pci devices
...

Later in the test consoles are picked starting first available console:
Layout: 3 consoles, 2 serialports: "CC|CS|S"
virtio_console_smoke = "serialport;console"
{
    1st round: cc|cS|s => only the first serialport is used (1:1)
    2nd round: Cc|cs|s => only the first console is used (1:1)
}

virtio_console_loopback = "console:console;serialport:serialport:console:console"
{
    1st round: CC|cs|s => first two consoles are used (1:N)
    2nd round: CC|cS|S => first 2 consoles and first 2 serialports are used (N:M)
}

virtio_console_perf = "serialport"
{
    1st round: cc|cS|s => only the first serialport is used (1:1)
}


An example of "info qtree" with 3 consoles and 2 serialports:
...
      dev: virtio-serial-pci, id "virtio-serial-pci2"
        dev-prop: vectors = 32
        dev-prop: class = 0x780
        dev-prop: indirect_desc = off
        dev-prop: max_ports = 31
        bus-prop: addr = 06.0
        bus-prop: romfile = <null>
        bus-prop: rombar = 1
        class Class 0780, addr 00:06.0, pci id 1af4:1003 (sub 1af4:0003)
        bar 0: i/o at 0xc080 [0xc09f]
        bar 1: mem at 0xf2042000 [0xf2042fff]
        bus: virtio-serial-pci2.0
          type virtio-serial-bus
          dev: virtserialport, id "p4"
            dev-prop: nr = 1
            dev-prop: chardev = vs4
            dev-prop: name = "serialport-4"
             dev-prop-int: id: 1
             dev-prop-int: guest_connected: 0
             dev-prop-int: host_connected: 1
      dev: virtio-serial-pci, id "virtio-serial-pci1"
        dev-prop: vectors = 32
        dev-prop: class = 0x780
        dev-prop: indirect_desc = off
        dev-prop: max_ports = 31
        bus-prop: addr = 05.0
        bus-prop: romfile = <null>
        bus-prop: rombar = 1
        class Class 0780, addr 00:05.0, pci id 1af4:1003 (sub 1af4:0003)
        bar 0: i/o at 0xc060 [0xc07f]
        bar 1: mem at 0xf2041000 [0xf2041fff]
        bus: virtio-serial-pci1.0
          type virtio-serial-bus
          dev: virtserialport, id "p3"
            dev-prop: nr = 1
            dev-prop: chardev = vs3
            dev-prop: name = "serialport-3"
             dev-prop-int: id: 1
             dev-prop-int: guest_connected: 0
             dev-prop-int: host_connected: 1
          dev: virtconsole, id "c2"
            dev-prop: is_console = 1
            dev-prop: nr = 0
            dev-prop: chardev = vc2
            dev-prop: name = "console-2"
             dev-prop-int: id: 0
             dev-prop-int: guest_connected: 1
             dev-prop-int: host_connected: 0
      dev: virtio-serial-pci, id "virtio-serial-pci0"
        dev-prop: vectors = 32
        dev-prop: class = 0x780
        dev-prop: indirect_desc = off
        dev-prop: max_ports = 31
        bus-prop: addr = 04.0
        bus-prop: romfile = <null>
        bus-prop: rombar = 1
        class Class 0780, addr 00:04.0, pci id 1af4:1003 (sub 1af4:0003)
        bar 0: i/o at 0xc040 [0xc05f]
        bar 1: mem at 0xf2040000 [0xf2040fff]
        bus: virtio-serial-pci0.0
          type virtio-serial-bus
          dev: virtconsole, id "c1"
            dev-prop: is_console = 1
            dev-prop: nr = 1
            dev-prop: chardev = vc1
            dev-prop: name = "console-1"
             dev-prop-int: id: 1
             dev-prop-int: guest_connected: 1
             dev-prop-int: host_connected: 0
          dev: virtconsole, id "c0"
            dev-prop: is_console = 1
            dev-prop: nr = 0
            dev-prop: chardev = vc0
            dev-prop: name = "console-0"
             dev-prop-int: id: 0
             dev-prop-int: guest_connected: 1
             dev-prop-int: host_connected: 0
...

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

* [PATCH] Spread virtio_consoles across multiple PCIs
  2010-11-26 10:51 [KVM-autotest][patch] Spread virtio_consoles across multiple PCIs Lukas Doktor
@ 2010-11-26 10:51 ` Lukas Doktor
  0 siblings, 0 replies; 2+ messages in thread
From: Lukas Doktor @ 2010-11-26 10:51 UTC (permalink / raw)
  To: autotest, kvm, kvm-autotest, akong, lmr, ldoktor, jzupka

Signed-off-by: Lukas Doktor <ldoktor@redhat.com>
---
 client/tests/kvm/tests/virtio_console.py |   21 +++++++++++++++++----
 1 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/client/tests/kvm/tests/virtio_console.py b/client/tests/kvm/tests/virtio_console.py
index 3edd051..2f1d5eb 100644
--- a/client/tests/kvm/tests/virtio_console.py
+++ b/client/tests/kvm/tests/virtio_console.py
@@ -544,19 +544,32 @@ def run_virtio_console(test, params, env):
         tmp_dir = tempfile.mkdtemp(prefix="virtio-console-", dir="/tmp/")
         if not params.get('extra_params'):
             params['extra_params'] = ''
-        params['extra_params'] += " -device virtio-serial"
 
-        for i in  range(0, no_console):
+        for i in range(0, no_console):
+            # Spread consoles between multiple PCI devices (2 per a dev)
+            if not i % 2:
+                pci = "virtio-serial-pci%d" % (i / 2)
+                params['extra_params'] += (" -device virtio-serial-pci,id="
+                                           + pci)
+                pci += ".0"
             params['extra_params'] += (" -chardev socket,path=%s/%d,id=vc%d,"
                                        "server,nowait" % (tmp_dir, i, i))
             params['extra_params'] += (" -device virtconsole,chardev=vc%d,"
-                                      "name=console-%d,id=c%d" % (i, i, i))
+                                      "name=console-%d,id=c%d,bus=%s"
+                                      % (i, i, i, pci))
 
         for i in  range(no_console, no_console + no_serialport):
+            # Spread seroal ports between multiple PCI devices (2 per a dev)
+            if not i % 2:
+                pci = "virtio-serial-pci%d" % (i / 2)
+                params['extra_params'] += (" -device virtio-serial-pci,id="
+                                           + pci)
+                pci += ".0"
             params['extra_params'] += (" -chardev socket,path=%s/%d,id=vs%d,"
                                        "server,nowait" % (tmp_dir, i, i))
             params['extra_params'] += (" -device virtserialport,chardev=vs%d,"
-                                       "name=serialport-%d,id=p%d" % (i, i, i))
+                                       "name=serialport-%d,id=p%d,bus=%s"
+                                       % (i, i, i, pci))
 
         logging.debug("Booting first guest %s", params.get("main_vm"))
         kvm_preprocessing.preprocess_vm(test, params, env,
-- 
1.7.2.3

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

end of thread, other threads:[~2010-11-26 10:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-26 10:51 [KVM-autotest][patch] Spread virtio_consoles across multiple PCIs Lukas Doktor
2010-11-26 10:51 ` [PATCH] " Lukas Doktor

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.