qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v9 05/10] virtio-blk-pci: switch to new API.


From: Anthony Liguori
Subject: Re: [Qemu-devel] [PATCH v9 05/10] virtio-blk-pci: switch to new API.
Date: Mon, 18 Mar 2013 08:01:46 -0500
User-agent: Notmuch/0.13.2+93~ged93d79 (http://notmuchmail.org) Emacs/23.3.1 (x86_64-pc-linux-gnu)

address@hidden writes:

> From: KONRAD Frederic <address@hidden>
>
> Here the virtio-blk-pci is modified for the new API. The device
> virtio-blk-pci extends virtio-pci. It creates and connects a virtio-blk
> during the init. The properties are not changed.
>
> Signed-off-by: KONRAD Frederic <address@hidden>
> Reviewed-by: Peter Maydell <address@hidden>

According to bisect, this breaks hot unplug:

Using RANDOM seed 35921
Testing block
Formatting '.tmp-15607/disk.img', fmt=qcow2 size=10737418240 encryption=off 
cluster_size=65536 lazy_refcounts=off 
/home/aliguori/build/qemu/x86_64-softmmu/qemu-system-x86_64 -kernel 
/usr/local/share/qemu-jeos/kernel-x86_64-pc -initrd 
.tmp-15607/initramfs-15607.img.gz -device isa-debug-exit -append console=ttyS0 
seed=35921 -nographic -enable-kvm -device virtio-balloon-pci,id=balloon0 
-pidfile .tmp-15607/pidfile-15607.pid -qmp 
unix:.tmp-15607/qmpsock-15607.sock,server,nowait
[    0.000000] Initializing cgroup subsys cpuset
[    0.000000] Initializing cgroup subsys cpu
[    0.000000] Linux version 3.4.0 (address@hidden) (gcc version 4.6.4 20120830 
(prerelease) (GCC) ) #2 SMP Mon Dec 3 19:40:41 CST 2012
[    0.000000] Command line: console=ttyS0 seed=35921
[    0.000000] BIOS-provided physical RAM map:
[    0.000000]  BIOS-e820: 0000000000000000 - 000000000009fc00 (usable)
[    0.000000]  BIOS-e820: 000000000009fc00 - 00000000000a0000 (reserved)
[    0.000000]  BIOS-e820: 00000000000f0000 - 0000000000100000 (reserved)
[    0.000000]  BIOS-e820: 0000000000100000 - 0000000007ffe000 (usable)
[    0.000000]  BIOS-e820: 0000000007ffe000 - 0000000008000000 (reserved)
[    0.000000]  BIOS-e820: 00000000feffc000 - 00000000ff000000 (reserved)
[    0.000000]  BIOS-e820: 00000000fffc0000 - 0000000100000000 (reserved)
[    0.000000] NX (Execute Disable) protection: active
[    0.000000] DMI 2.4 present.
[    0.000000] No AGP bridge found
[    0.000000] last_pfn = 0x7ffe max_arch_pfn = 0x400000000
[    0.000000] PAT not supported by CPU.
[    0.000000] found SMP MP-table at [ffff8800000fdaf0] fdaf0
[    0.000000] init_memory_mapping: 0000000000000000-0000000007ffe000
[    0.000000] RAMDISK: 07f58000 - 07ff0000
[    0.000000] ACPI: RSDP 00000000000fd990 00014 (v00 BOCHS )
[    0.000000] ACPI: RSDT 0000000007ffe4b0 00034 (v01 BOCHS  BXPCRSDT 00000001 
BXPC 00000001)
[    0.000000] ACPI: FACP 0000000007ffff80 00074 (v01 BOCHS  BXPCFACP 00000001 
BXPC 00000001)
[    0.000000] ACPI: DSDT 0000000007ffe4f0 011A9 (v01   BXPC   BXDSDT 00000001 
INTL 20100528)
[    0.000000] ACPI: FACS 0000000007ffff40 00040
[    0.000000] ACPI: SSDT 0000000007fff800 00735 (v01 BOCHS  BXPCSSDT 00000001 
BXPC 00000001)
[    0.000000] ACPI: APIC 0000000007fff6e0 00078 (v01 BOCHS  BXPCAPIC 00000001 
BXPC 00000001)
[    0.000000] ACPI: HPET 0000000007fff6a0 00038 (v01 BOCHS  BXPCHPET 00000001 
BXPC 00000001)
[    0.000000] No NUMA configuration found
[    0.000000] Faking a node at 0000000000000000-0000000007ffe000
[    0.000000] Initmem setup node 0 0000000000000000-0000000007ffe000
[    0.000000]   NODE_DATA [0000000007ff7000 - 0000000007ffafff]
[    0.000000] Zone PFN ranges:
[    0.000000]   DMA      0x00000010 -> 0x00001000
[    0.000000]   DMA32    0x00001000 -> 0x00100000
[    0.000000]   Normal   empty
[    0.000000] Movable zone start PFN for each node
[    0.000000] Early memory PFN ranges
[    0.000000]     0: 0x00000010 -> 0x0000009f
[    0.000000]     0: 0x00000100 -> 0x00007ffe
[    0.000000] ACPI: PM-Timer IO Port: 0xb008
[    0.000000] ACPI: LAPIC (acpi_id[0x00] lapic_id[0x00] enabled)
[    0.000000] ACPI: LAPIC_NMI (acpi_id[0xff] dfl dfl lint[0x1])
[    0.000000] ACPI: IOAPIC (id[0x00] address[0xfec00000] gsi_base[0])
[    0.000000] IOAPIC[0]: apic_id 0, version 17, address 0xfec00000, GSI 0-23
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 0 global_irq 2 dfl dfl)
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 5 global_irq 5 high level)
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 high level)
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 10 global_irq 10 high level)
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 11 global_irq 11 high level)
[    0.000000] Using ACPI (MADT) for SMP configuration information
[    0.000000] ACPI: HPET id: 0x8086a201 base: 0xfed00000
[    0.000000] SMP: Allowing 1 CPUs, 0 hotplug CPUs
[    0.000000] PM: Registered nosave memory: 000000000009f000 - 00000000000a0000
[    0.000000] PM: Registered nosave memory: 00000000000a0000 - 00000000000f0000
[    0.000000] PM: Registered nosave memory: 00000000000f0000 - 0000000000100000
[    0.000000] Allocating PCI resources starting at 8000000 (gap: 
8000000:f6ffc000)
[    0.000000] setup_percpu: NR_CPUS:64 nr_cpumask_bits:64 nr_cpu_ids:1 
nr_node_ids:1
[    0.000000] PERCPU: Embedded 26 pages/cpu @ffff880007c00000 s77056 r8192 
d21248 u2097152
[    0.000000] Built 1 zonelists in Node order, mobility grouping on.  Total 
pages: 32136
[    0.000000] Policy zone: DMA32
[    0.000000] Kernel command line: console=ttyS0 seed=35921
[    0.000000] PID hash table entries: 512 (order: 0, 4096 bytes)
[    0.000000] Checking aperture...
[    0.000000] No AGP bridge found
[    0.000000] Memory: 113188k/131064k available (7532k kernel code, 452k 
absent, 17424k reserved, 5454k data, 584k init)
[    0.000000] SLUB: Genslabs=15, HWalign=64, Order=0-3, MinObjects=0, CPUs=1, 
Nodes=1
[    0.000000] Hierarchical RCU implementation.
[    0.000000] NR_IRQS:4352 nr_irqs:256 16
[    0.000000] Console: colour VGA+ 80x25
[    0.000000] console [ttyS0] enabled
[    0.000000] Fast TSC calibration using PIT
[    0.000000] Detected 2933.452 MHz processor.
[    0.003001] Calibrating delay loop (skipped), value calculated using timer 
frequency.. 5866.90 BogoMIPS (lpj=2933452)
[    0.004339] pid_max: default: 32768 minimum: 301
[    0.005016] Security Framework initialized
[    0.006006] SELinux:  Initializing.
[    0.006476] Dentry cache hash table entries: 16384 (order: 5, 131072 bytes)
[    0.007033] Inode-cache hash table entries: 8192 (order: 4, 65536 bytes)
[    0.008015] Mount-cache hash table entries: 256
[    0.009177] Initializing cgroup subsys cpuacct
[    0.009720] Initializing cgroup subsys freezer
[    0.010054] mce: CPU supports 10 MCE banks
[    0.011219] SMP alternatives: switching to UP code
[    0.020490] Freeing SMP alternatives: 24k freed
[    0.021013] ACPI: Core revision 20120320
[    0.023189] ..TIMER: vector=0x30 apic1=0 pin1=2 apic2=-1 pin2=-1
[    0.033904] CPU0: Intel QEMU Virtual CPU version 1.4.50 stepping 03
[    0.034997] Performance Events: unsupported p6 CPU model 2 no PMU driver, 
software events only.
[    0.035064] Brought up 1 CPUs
[    0.035421] Total of 1 processors activated (5866.90 BogoMIPS).
[    0.036391] kworker/u:0 used greatest stack depth: 6368 bytes left
[    0.037067] RTC time: 21:22:00, date: 03/18/13
[    0.037605] NET: Registered protocol family 16
[    0.038264] ACPI: bus type pci registered
[    0.039070] kworker/u:0 used greatest stack depth: 6304 bytes left
[    0.039843] PCI: Using configuration type 1 for base access
[    0.040253] kworker/u:0 used greatest stack depth: 5968 bytes left
[    0.042503] kworker/u:0 used greatest stack depth: 5536 bytes left
[    0.047520] bio: create slab <bio-0> at 0
[    0.048158] ACPI: Added _OSI(Module Device)
[    0.048691] ACPI: Added _OSI(Processor Device)
[    0.049001] ACPI: Added _OSI(3.0 _SCP Extensions)
[    0.049554] ACPI: Added _OSI(Processor Aggregator Device)
[    0.051771] ACPI: Interpreter enabled
[    0.051999] ACPI: (supports S0 S3 S4 S5)
[    0.052538] ACPI: Using IOAPIC for interrupt routing
[    0.056116] ACPI: No dock devices found.
[    0.056583] PCI: Using host bridge windows from ACPI; if necessary, use 
"pci=nocrs" and report a bug
[    0.057065] ACPI: PCI Root Bridge [PCI0] (domain 0000 [bus 00-ff])
[    0.058081] pci_root PNP0A03:00: host bridge window [io  0x0000-0x0cf7]
[    0.059011] pci_root PNP0A03:00: host bridge window [io  0x0d00-0xffff]
[    0.060001] pci_root PNP0A03:00: host bridge window [mem 
0x000a0000-0x000bffff]
[    0.060997] pci_root PNP0A03:00: host bridge window [mem 
0x80000000-0xfebfffff]
[    0.061881] PCI host bridge to bus 0000:00
[    0.062006] pci_bus 0000:00: root bus resource [io  0x0000-0x0cf7]
[    0.062996] pci_bus 0000:00: root bus resource [io  0x0d00-0xffff]
[    0.063758] pci_bus 0000:00: root bus resource [mem 0x000a0000-0x000bffff]
[    0.063996] pci_bus 0000:00: root bus resource [mem 0x80000000-0xfebfffff]
[    0.070443] pci 0000:00:01.3: quirk: [io  0xb000-0xb03f] claimed by PIIX4 
ACPI
[    0.071009] pci 0000:00:01.3: quirk: [io  0xb100-0xb10f] claimed by PIIX4 SMB
[    0.091473]  pci0000:00: Unable to request _OSC control (_OSC support mask: 
0x1e)
[    0.093828] ACPI: PCI Interrupt Link [LNKA] (IRQs 5 *10 11)
[    0.094263] ACPI: PCI Interrupt Link [LNKB] (IRQs 5 *10 11)
[    0.095296] ACPI: PCI Interrupt Link [LNKC] (IRQs 5 10 *11)
[    0.096296] ACPI: PCI Interrupt Link [LNKD] (IRQs 5 10 *11)
[    0.097101] ACPI: PCI Interrupt Link [LNKS] (IRQs *9)
[    0.097847] vgaarb: device added: 
PCI:0000:00:02.0,decodes=io+mem,owns=io+mem,locks=none
[    0.098001] vgaarb: loaded
[    0.098992] vgaarb: bridge control possible 0000:00:02.0
[    0.099746] SCSI subsystem initialized
[    0.100169] usbcore: registered new interface driver usbfs
[    0.101027] usbcore: registered new interface driver hub
[    0.101686] usbcore: registered new device driver usb
[    0.102143] Advanced Linux Sound Architecture Driver Version 1.0.25.
[    0.102997] PCI: Using ACPI for IRQ routing
[    0.104287] cfg80211: Calling CRDA to update world regulatory domain
[    0.105085] NetLabel: Initializing
[    0.105502] NetLabel:  domain hash size = 128
[    0.106000] NetLabel:  protocols = UNLABELED CIPSOv4
[    0.106633] NetLabel:  unlabeled traffic allowed by default
[    0.107074] HPET: 3 timers in total, 0 timers will be used for per-cpu timer
[    0.108011] hpet0: at MMIO 0xfed00000, IRQs 2, 8, 0
[    0.108650] hpet0: 3 comparators, 64-bit 100.000000 MHz counter
[    0.114004] Switching to clocksource hpet
[    0.115611] pnp: PnP ACPI init
[    0.115979] ACPI: bus type pnp registered
[    0.117343] pnp: PnP ACPI: found 8 devices
[    0.117869] ACPI: ACPI bus type pnp unregistered
[    0.126132] NET: Registered protocol family 2
[    0.126658] IP route cache hash table entries: 1024 (order: 1, 8192 bytes)
[    0.127536] TCP established hash table entries: 4096 (order: 4, 65536 bytes)
[    0.128434] TCP bind hash table entries: 4096 (order: 4, 65536 bytes)
[    0.129277] TCP: Hash tables configured (established 4096 bind 4096)
[    0.130046] TCP: reno registered
[    0.130429] UDP hash table entries: 128 (order: 0, 4096 bytes)
[    0.131142] UDP-Lite hash table entries: 128 (order: 0, 4096 bytes)
[    0.131902] NET: Registered protocol family 1
[    0.132495] RPC: Registered named UNIX socket transport module.
[    0.133231] RPC: Registered udp transport module.
[    0.133829] RPC: Registered tcp transport module.
[    0.134406] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.135188] pci 0000:00:00.0: Limiting direct PCI/PCI transfers
[    0.135884] pci 0000:00:01.0: PIIX3: Enabling Passive Release
[    0.136596] pci 0000:00:01.0: Activating ISA DMA hang workarounds
[    0.137472] Trying to unpack rootfs image as initramfs...
[    0.146656] Freeing initrd memory: 608k freed
[    0.147604] microcode: CPU0 sig=0x623, pf=0x0, revision=0x1
[    0.148340] microcode: Microcode Update Driver: v2.00 <address@hidden>, 
Peter Oruba
[    0.149627] audit: initializing netlink socket (disabled)
[    0.150356] type=2000 audit(1363641720.149:1): initialized
[    0.168648] HugeTLB registered 2 MB page size, pre-allocated 0 pages
[    0.172627] VFS: Disk quotas dquot_6.5.2
[    0.173217] Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
[    0.174573] NFS: Registering the id_resolver key type
[    0.175430] msgmni has been set to 222
[    0.176302] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 
253)
[    0.177266] io scheduler noop registered
[    0.177731] io scheduler deadline registered
[    0.178355] io scheduler cfq registered (default)
[    0.179118] pci_hotplug: PCI Hot Plug PCI Core version: 0.5
[    0.179774] acpiphp: ACPI Hot Plug PCI Controller Driver version: 0.5
[    0.180626] acpiphp: Slot [3] registered
[    0.181174] acpiphp: Slot [4] registered
[    0.181681] acpiphp: Slot [5] registered
[    0.182230] acpiphp: Slot [6] registered
[    0.182782] acpiphp: Slot [7] registered
[    0.183324] acpiphp: Slot [8] registered
[    0.183834] acpiphp: Slot [9] registered
[    0.184375] acpiphp: Slot [10] registered
[    0.184888] acpiphp: Slot [11] registered
[    0.185440] acpiphp: Slot [12] registered
[    0.185966] acpiphp: Slot [13] registered
[    0.186518] acpiphp: Slot [14] registered
[    0.187074] acpiphp: Slot [15] registered
[    0.187586] acpiphp: Slot [16] registered
[    0.188186] acpiphp: Slot [17] registered
[    0.188714] acpiphp: Slot [18] registered
[    0.189271] acpiphp: Slot [19] registered
[    0.189792] acpiphp: Slot [20] registered
[    0.190346] acpiphp: Slot [21] registered
[    0.190911] acpiphp: Slot [22] registered
[    0.191462] acpiphp: Slot [23] registered
[    0.192068] acpiphp: Slot [24] registered
[    0.192584] acpiphp: Slot [25] registered
[    0.193145] acpiphp: Slot [26] registered
[    0.193663] acpiphp: Slot [27] registered
[    0.194221] acpiphp: Slot [28] registered
[    0.194744] acpiphp: Slot [29] registered
[    0.195296] acpiphp: Slot [30] registered
[    0.195814] acpiphp: Slot [31] registered
[    0.196533] input: Power Button as 
/devices/LNXSYSTM:00/LNXPWRBN:00/input/input0
[    0.197443] ACPI: Power Button [PWRF]
[    0.199428] ACPI: PCI Interrupt Link [LNKD] enabled at IRQ 11
[    0.200958] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
�[    0.467562] serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
[    0.491167] 00:06: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
[    0.492233] Non-volatile memory driver v1.3
[    0.492697] Linux agpgart interface v0.103
[    0.493403] [drm] Initialized drm 1.1.0 20060810
[    0.493923] [drm:i915_init] *ERROR* drm/i915 can't work without intel_agp 
module!
[    0.496435] brd: module loaded
[    0.497691] loop: module loaded
[    0.498225] DC390: clustering now enabled by default. If you get problems 
load
[    0.499126]        with "disable_clustering=1" and report to maintainers
[    0.499906] megasas: 00.00.06.14-rc1 Fri. Jan. 6 17:00:00 PDT 2012
[    0.501942] scsi0 : ata_piix
[    0.502416] scsi1 : ata_piix
[    0.502816] ata1: PATA max MWDMA2 cmd 0x1f0 ctl 0x3f6 bmdma 0xc060 irq 14
[    0.503615] ata2: PATA max MWDMA2 cmd 0x170 ctl 0x376 bmdma 0xc068 irq 15
[    0.505477] pcnet32: pcnet32.c:v1.35 21.Apr.2008 address@hidden
[    0.506355] e100: Intel(R) PRO/100 Network Driver, 3.5.24-k2-NAPI
[    0.507122] e100: Copyright(c) 1999-2006 Intel Corporation
[    0.507797] e1000: Intel(R) PRO/1000 Network Driver - version 7.3.21-k8-NAPI
[    0.508605] e1000: Copyright (c) 1999-2006 Intel Corporation.
[    0.509432] ACPI: PCI Interrupt Link [LNKC] enabled at IRQ 10
[    0.801483] ata2.00: ATAPI: QEMU DVD-ROM, 1.4.50, max UDMA/100
[    0.802553] ata2.00: configured for MWDMA2
[    0.803460] scsi 1:0:0:0: CD-ROM            QEMU     QEMU DVD-ROM     1.4. 
PQ: 0 ANSI: 5
[    0.805114] sr0: scsi3-mmc drive: 4x/4x cd/rw xa/form2 tray
[    0.805738] cdrom: Uniform CD-ROM driver Revision: 3.20
[    0.806800] sr 1:0:0:0: Attached scsi generic sg0 type 5
[    0.830497] e1000 0000:00:03.0: eth0: (PCI:33MHz:32-bit) 52:54:00:12:34:56
[    0.831385] e1000 0000:00:03.0: eth0: Intel(R) PRO/1000 Network Connection
[    0.832223] sky2: driver version 1.30
[    0.832914] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    0.833721] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    0.834490] uhci_hcd: USB Universal Host Controller Interface driver
[    0.835305] usbcore: registered new interface driver usblp
[    0.835957] Initializing USB Mass Storage driver...
[    0.836575] usbcore: registered new interface driver usb-storage
[    0.837281] USB Mass Storage support registered.
[    0.837843] usbcore: registered new interface driver libusual
[    0.838602] i8042: PNP: PS/2 Controller [PNP0303:KBD,PNP0f13:MOU] at 
0x60,0x64 irq 1,12
[    0.840195] serio: i8042 KBD port at 0x60,0x64 irq 1
[    0.840756] serio: i8042 AUX port at 0x60,0x64 irq 12
[    0.841521] mousedev: PS/2 mouse device common for all mice
[    0.842527] input: AT Translated Set 2 keyboard as 
/devices/platform/i8042/serio0/input/input1
[    0.843606] rtc_cmos 00:01: RTC can wake from S4
[    0.846490] rtc_cmos 00:01: rtc core: registered rtc_cmos as rtc0
[    0.847332] rtc0: alarms up to one day, 114 bytes nvram, hpet irqs
[    0.848305] device-mapper: ioctl: 4.22.0-ioctl (2011-10-19) initialised: 
address@hidden
[    0.849359] cpuidle: using governor ladder
[    0.849842] cpuidle: using governor menu
[    0.850322] EFI Variables Facility v0.08 2004-May-17
[    0.851670] usbcore: registered new interface driver usbhid
[    0.852373] usbhid: USB HID core driver
[    0.853283] Netfilter messages via NETLINK v0.30.
[    0.853838] nf_conntrack version 0.5.0 (889 buckets, 3556 max)
[    0.854632] ctnetlink v0.93: registering with nfnetlink.
[    0.855350] ip_tables: (C) 2000-2006 Netfilter Core Team
[    0.855969] TCP: cubic registered
[    0.856387] Initializing XFRM netlink socket
[    0.857072] NET: Registered protocol family 10
[    0.857735] ip6_tables: (C) 2000-2006 Netfilter Core Team
[    0.858397] IPv6 over IPv4 tunneling driver
[    0.859079] NET: Registered protocol family 17
[    0.859611] Registering the dns_resolver key type
[    0.860322] registered taskstats version 1
[    0.860899]   Magic number: 5:385:399
[    0.861368] console [netcon0] enabled
[    0.861773] netconsole: network logging started
[    0.862347] ALSA device list:
[    0.862689]   No soundcards found.
[    0.864143] Freeing unused kernel memory: 584k freed
[    0.864800] Write protecting the kernel read-only data: 12288k
[    0.867044] Freeing unused kernel memory: 640k freed
[    0.871753] Freeing unused kernel memory: 1724k freed
Setting guest RANDOM seed to 35921
*** Running tests ***
/tests/device-del.sh
Running test /tests/device-del.sh...
** waiting for hotplug **
** waiting for remove **
** waiting for guest to see device **
./qemu-test: line 99: 15638 Segmentation fault      (core dumped) "$@"

Here's the backtrace:

Program terminated with signal 11, Segmentation fault.
#0  virtio_pci_stop_ioeventfd (proxy=0x0)
    at /home/aliguori/git/qemu/hw/virtio-pci.c:243
243         if (!proxy->ioeventfd_started) {
Missing separate debuginfos, use: debuginfo-install 
bzip2-libs-1.0.6-7.fc18.x86_64 glib2-2.34.2-2.fc18.x86_64 
glibc-2.16-28.fc18.x86_64 libaio-0.3.109-6.fc18.x86_64 
libfdt-1.3.0-5.fc18.x86_64 libgcc-4.7.2-8.fc18.x86_64 
pixman-0.26.2-5.fc18.x86_64 xen-libs-4.2.1-5.fc18.x86_64 
xz-libs-5.1.2-2alpha.fc18.x86_64 zlib-1.2.7-9.fc18.x86_64
(gdb) bt
#0  virtio_pci_stop_ioeventfd (proxy=0x0)
    at /home/aliguori/git/qemu/hw/virtio-pci.c:243
#1  0x00007fc00cb131fa in virtio_bus_destroy_device (address@hidden
    0x7fc00e6e3bd8) at /home/aliguori/git/qemu/hw/virtio-bus.c:94
#2  0x00007fc00cb143c5 in virtio_pci_exit (pci_dev=0x7fc00e6e1410)
    at /home/aliguori/git/qemu/hw/virtio-pci.c:1369
#3  0x00007fc00caca30a in pci_unregister_device (dev=<optimized out>)
    at /home/aliguori/git/qemu/hw/pci/pci.c:889
#4  0x00007fc00cadd765 in device_unparent (obj=<optimized out>)
    at /home/aliguori/git/qemu/hw/qdev.c:774
#5  0x00007fc00cb595cf in object_unparent (obj=0x7fc00e6e1410)
    at /home/aliguori/git/qemu/qom/object.c:370
#6  0x00007fc00caddd2d in qdev_free (dev=<optimized out>)
    at /home/aliguori/git/qemu/hw/qdev.c:271
#7  0x00007fc00ca70450 in acpi_piix_eject_slot (s=0x7fc00e705ba0, 
    slots=<optimized out>) at /home/aliguori/git/qemu/hw/acpi_piix4.c:306
#8  0x00007fc00cbe2af2 in access_with_adjusted_size (address@hidden, 
    address@hidden, size=4, access_size_min=<optimized out>, 
    access_size_max=<optimized out>, address@hidden
    0x7fc00cbe3110 <memory_region_write_accessor>, address@hidden
    0x7fc00e706390) at /home/aliguori/git/qemu/memory.c:364
#9  0x00007fc00cbe4167 in memory_region_iorange_write (
    iorange=<optimized out>, offset=8, width=4, data=32)
#10 0x00007fc00cbe0f1d in kvm_handle_io (count=1, size=4, direction=1, 
    data=<optimized out>, port=44552) at /home/aliguori/git/qemu/kvm-all.c:1430
#11 kvm_cpu_exec (address@hidden)
    at /home/aliguori/git/qemu/kvm-all.c:1579
#12 0x00007fc00cb89d21 in qemu_kvm_cpu_thread_fn (arg=0x7fc00e670160)
    at /home/aliguori/git/qemu/cpus.c:759
#13 0x00007fc00aa41d15 in start_thread () from /lib64/libpthread.so.0
#14 0x00007fc00a77446d in clone () from /lib64/libc.so.6

Regards,

Anthony Liguori

> ---
>  hw/virtio-pci.c | 121 
> ++++++++++++++++++++++++++------------------------------
>  hw/virtio-pci.h |  15 ++++++-
>  2 files changed, 71 insertions(+), 65 deletions(-)
>
> diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
> index 2160cb8..0095a32 100644
> --- a/hw/virtio-pci.c
> +++ b/hw/virtio-pci.c
> @@ -924,26 +924,6 @@ void virtio_init_pci(VirtIOPCIProxy *proxy, VirtIODevice 
> *vdev)
>      proxy->host_features = vdev->get_features(vdev, proxy->host_features);
>  }
>  
> -static int virtio_blk_init_pci(PCIDevice *pci_dev)
> -{
> -    VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev);
> -    VirtIODevice *vdev;
> -
> -    if (proxy->class_code != PCI_CLASS_STORAGE_SCSI &&
> -        proxy->class_code != PCI_CLASS_STORAGE_OTHER)
> -        proxy->class_code = PCI_CLASS_STORAGE_SCSI;
> -
> -    vdev = virtio_blk_init(&pci_dev->qdev, &proxy->blk);
> -    if (!vdev) {
> -        return -1;
> -    }
> -    vdev->nvectors = proxy->nvectors;
> -    virtio_init_pci(proxy, vdev);
> -    /* make the actual value visible */
> -    proxy->nvectors = vdev->nvectors;
> -    return 0;
> -}
> -
>  static void virtio_exit_pci(PCIDevice *pci_dev)
>  {
>      VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev);
> @@ -952,15 +932,6 @@ static void virtio_exit_pci(PCIDevice *pci_dev)
>      msix_uninit_exclusive_bar(pci_dev);
>  }
>  
> -static void virtio_blk_exit_pci(PCIDevice *pci_dev)
> -{
> -    VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev);
> -
> -    virtio_pci_stop_ioeventfd(proxy);
> -    virtio_blk_exit(proxy->vdev);
> -    virtio_exit_pci(pci_dev);
> -}
> -
>  static int virtio_serial_init_pci(PCIDevice *pci_dev)
>  {
>      VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev);
> @@ -1082,40 +1053,6 @@ static void virtio_rng_exit_pci(PCIDevice *pci_dev)
>      virtio_exit_pci(pci_dev);
>  }
>  
> -static Property virtio_blk_properties[] = {
> -    DEFINE_PROP_HEX32("class", VirtIOPCIProxy, class_code, 0),
> -    DEFINE_PROP_BIT("ioeventfd", VirtIOPCIProxy, flags, 
> VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT, true),
> -#ifdef CONFIG_VIRTIO_BLK_DATA_PLANE
> -    DEFINE_PROP_BIT("x-data-plane", VirtIOPCIProxy, blk.data_plane, 0, 
> false),
> -#endif
> -    DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, 2),
> -    DEFINE_VIRTIO_BLK_FEATURES(VirtIOPCIProxy, host_features),
> -    DEFINE_VIRTIO_BLK_PROPERTIES(VirtIOPCIProxy, blk),
> -    DEFINE_PROP_END_OF_LIST(),
> -};
> -
> -static void virtio_blk_class_init(ObjectClass *klass, void *data)
> -{
> -    DeviceClass *dc = DEVICE_CLASS(klass);
> -    PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
> -
> -    k->init = virtio_blk_init_pci;
> -    k->exit = virtio_blk_exit_pci;
> -    k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET;
> -    k->device_id = PCI_DEVICE_ID_VIRTIO_BLOCK;
> -    k->revision = VIRTIO_PCI_ABI_VERSION;
> -    k->class_id = PCI_CLASS_STORAGE_SCSI;
> -    dc->reset = virtio_pci_reset;
> -    dc->props = virtio_blk_properties;
> -}
> -
> -static const TypeInfo virtio_blk_info = {
> -    .name          = "virtio-blk-pci",
> -    .parent        = TYPE_PCI_DEVICE,
> -    .instance_size = sizeof(VirtIOPCIProxy),
> -    .class_init    = virtio_blk_class_init,
> -};
> -
>  static Property virtio_net_properties[] = {
>      DEFINE_PROP_BIT("ioeventfd", VirtIOPCIProxy, flags, 
> VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT, false),
>      DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, 3),
> @@ -1470,6 +1407,62 @@ static const TypeInfo virtio_pci_info = {
>      .abstract      = true,
>  };
>  
> +/* virtio-blk-pci */
> +
> +static Property virtio_blk_pci_properties[] = {
> +    DEFINE_PROP_HEX32("class", VirtIOPCIProxy, class_code, 0),
> +    DEFINE_PROP_BIT("ioeventfd", VirtIOPCIProxy, flags,
> +                    VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT, true),
> +    DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, 2),
> +#ifdef CONFIG_VIRTIO_BLK_DATA_PLANE
> +    DEFINE_PROP_BIT("x-data-plane", VirtIOBlkPCI, blk.data_plane, 0, false),
> +#endif
> +    DEFINE_VIRTIO_BLK_FEATURES(VirtIOPCIProxy, host_features),
> +    DEFINE_VIRTIO_BLK_PROPERTIES(VirtIOBlkPCI, blk),
> +    DEFINE_PROP_END_OF_LIST(),
> +};
> +
> +static int virtio_blk_pci_init(VirtIOPCIProxy *vpci_dev)
> +{
> +    VirtIOBlkPCI *dev = VIRTIO_BLK_PCI(vpci_dev);
> +    DeviceState *vdev = DEVICE(&dev->vdev);
> +    virtio_blk_set_conf(vdev, &(dev->blk));
> +    qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus));
> +    if (qdev_init(vdev) < 0) {
> +        return -1;
> +    }
> +    return 0;
> +}
> +
> +static void virtio_blk_pci_class_init(ObjectClass *klass, void *data)
> +{
> +    DeviceClass *dc = DEVICE_CLASS(klass);
> +    VirtioPCIClass *k = VIRTIO_PCI_CLASS(klass);
> +    PCIDeviceClass *pcidev_k = PCI_DEVICE_CLASS(klass);
> +
> +    dc->props = virtio_blk_pci_properties;
> +    k->init = virtio_blk_pci_init;
> +    pcidev_k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET;
> +    pcidev_k->device_id = PCI_DEVICE_ID_VIRTIO_BLOCK;
> +    pcidev_k->revision = VIRTIO_PCI_ABI_VERSION;
> +    pcidev_k->class_id = PCI_CLASS_STORAGE_SCSI;
> +}
> +
> +static void virtio_blk_pci_instance_init(Object *obj)
> +{
> +    VirtIOBlkPCI *dev = VIRTIO_BLK_PCI(obj);
> +    object_initialize(OBJECT(&dev->vdev), TYPE_VIRTIO_BLK);
> +    object_property_add_child(obj, "virtio-backend", OBJECT(&dev->vdev), 
> NULL);
> +}
> +
> +static const TypeInfo virtio_blk_pci_info = {
> +    .name          = TYPE_VIRTIO_BLK_PCI,
> +    .parent        = TYPE_VIRTIO_PCI,
> +    .instance_size = sizeof(VirtIOBlkPCI),
> +    .instance_init = virtio_blk_pci_instance_init,
> +    .class_init    = virtio_blk_pci_class_init,
> +};
> +
>  /* virtio-pci-bus */
>  
>  void virtio_pci_bus_new(VirtioBusState *bus, VirtIOPCIProxy *dev)
> @@ -1509,7 +1502,6 @@ static const TypeInfo virtio_pci_bus_info = {
>  
>  static void virtio_pci_register_types(void)
>  {
> -    type_register_static(&virtio_blk_info);
>      type_register_static(&virtio_net_info);
>      type_register_static(&virtio_serial_info);
>      type_register_static(&virtio_balloon_info);
> @@ -1520,6 +1512,7 @@ static void virtio_pci_register_types(void)
>  #ifdef CONFIG_VIRTFS
>      type_register_static(&virtio_9p_info);
>  #endif
> +    type_register_static(&virtio_blk_pci_info);
>  }
>  
>  type_init(virtio_pci_register_types)
> diff --git a/hw/virtio-pci.h b/hw/virtio-pci.h
> index 2ae96f8..a9dbfff 100644
> --- a/hw/virtio-pci.h
> +++ b/hw/virtio-pci.h
> @@ -25,6 +25,7 @@
>  #include "hw/9pfs/virtio-9p-device.h"
>  
>  typedef struct VirtIOPCIProxy VirtIOPCIProxy;
> +typedef struct VirtIOBlkPCI VirtIOBlkPCI;
>  
>  /* virtio-pci-bus */
>  
> @@ -73,7 +74,6 @@ struct VirtIOPCIProxy {
>      uint32_t flags;
>      uint32_t class_code;
>      uint32_t nvectors;
> -    VirtIOBlkConf blk;
>      NICConf nic;
>      uint32_t host_features;
>  #ifdef CONFIG_VIRTFS
> @@ -90,6 +90,19 @@ struct VirtIOPCIProxy {
>      VirtioBusState bus;
>  };
>  
> +/*
> + * virtio-blk-pci: This extends VirtioPCIProxy.
> + */
> +#define TYPE_VIRTIO_BLK_PCI "virtio-blk-pci"
> +#define VIRTIO_BLK_PCI(obj) \
> +        OBJECT_CHECK(VirtIOBlkPCI, (obj), TYPE_VIRTIO_BLK_PCI)
> +
> +struct VirtIOBlkPCI {
> +    VirtIOPCIProxy parent_obj;
> +    VirtIOBlock vdev;
> +    VirtIOBlkConf blk;
> +};
> +
>  void virtio_init_pci(VirtIOPCIProxy *proxy, VirtIODevice *vdev);
>  void virtio_pci_bus_new(VirtioBusState *bus, VirtIOPCIProxy *dev);
>  
> -- 
> 1.7.11.7




reply via email to

[Prev in Thread] Current Thread [Next in Thread]