Re: [PATCH 3/5] KVM: PPC: Book3S HV: Handle memory slot deletion and modification correctly

2012-08-15 Thread Avi Kivity
On 08/14/2012 01:04 AM, Marcelo Tosatti wrote: On Mon, Aug 13, 2012 at 01:34:11PM -0300, Marcelo Tosatti wrote: On Sat, Aug 11, 2012 at 10:37:54AM +1000, Paul Mackerras wrote: On Fri, Aug 10, 2012 at 03:35:53PM -0300, Marcelo Tosatti wrote: There's no plan. I just wanted to confirm this

Re: [PATCH 38/38] ppc: e500_tlb memset clears nothing

2012-08-15 Thread Avi Kivity
On 08/15/2012 02:04 AM, Alexander Graf wrote: From: Alan Cox a...@linux.intel.com Put the parameters the right way around Addresses https://bugzilla.kernel.org/show_bug.cgi?id=44031 Should this go to 3.6 (and backports etc.)? -- error compiling committee.c: too many arguments to

Re: [PATCH 38/38] ppc: e500_tlb memset clears nothing

2012-08-15 Thread Avi Kivity
On 08/15/2012 01:09 PM, Alexander Graf wrote: On 15.08.2012, at 12:07, Avi Kivity wrote: On 08/15/2012 02:04 AM, Alexander Graf wrote: From: Alan Cox a...@linux.intel.com Put the parameters the right way around Addresses https://bugzilla.kernel.org/show_bug.cgi?id=44031 Should

Re: [PATCH v5 00/12] KVM: introduce readonly memslot

2012-08-15 Thread Avi Kivity
On 08/14/2012 06:51 PM, Marcelo Tosatti wrote: Userspace may want to modify the ROM (for example, when programming a flash device). It is also possible to map an hva range rw through one slot and ro through another. Right, can do that with multiple userspace maps to the same anonymous

Re: [User question] Huge buffer size on KVM host

2012-08-15 Thread Avi Kivity
On 08/15/2012 11:06 AM, Martin Wawro wrote: Hi all, We have noticed a strange thing in one of our setups which uses KVM for virtualization. The size of the buffer cache turns out to be rather large, here is what 'top' on the host has to say about it: Mem: 12274084k total, 12202860k

Re: [User question] Huge buffer size on KVM host

2012-08-15 Thread Avi Kivity
On 08/15/2012 03:05 PM, Martin Wawro wrote: On Aug 15, 2012, at 1:30 PM, Avi Kivity wrote: We have noticed a strange thing in one of our setups which uses KVM for virtualization. The size of the buffer cache turns out to be rather large [,,,] How is you storage set up? Files (which

Re: [PATCH v7 2/2] kvm: KVM_EOIFD, an eventfd for EOIs

2012-08-15 Thread Avi Kivity
On 08/15/2012 02:26 AM, Alex Williamson wrote: Yes, I understand. It's simple, it's also very specific to this problem, and doesn't address generic ack notification. All of which I've noted before and I continue to note that v8 offers simplifications while retaining flexibility. Least

Re: [Qemu-devel] [PATCH v3 0/4] VFIO-based PCI device assignment for QEMU 1.2

2012-08-15 Thread Avi Kivity
, including Avi's requests to simplify both the PCI BAR mapping and unmapping paths. Reviewed-by: Avi Kivity a...@redhat.com -- error compiling committee.c: too many arguments to function -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord

[PATCH v2] KVM: x86 emulator: access GPRs on demand

2012-08-15 Thread Avi Kivity
Instead of populating the the entire register file, read in registers as they are accessed, and write back only the modified ones. This saves a VMREAD and VMWRITE on Intel (for rsp, since it is not usually used during emulation), and a two 128-byte copies for the registers. Signed-off-by: Avi

Re: [PATCH v2] KVM: x86 emulator: access GPRs on demand

2012-08-15 Thread Avi Kivity
On 08/15/2012 05:57 PM, Avi Kivity wrote: Instead of populating the the entire register file, read in registers as they are accessed, and write back only the modified ones. This saves a VMREAD and VMWRITE on Intel (for rsp, since it is not usually used during emulation), and a two 128-byte

Re: [PATCH 3/5] KVM: PPC: Book3S HV: Handle memory slot deletion and modification correctly

2012-08-15 Thread Avi Kivity
On 08/13/2012 07:34 PM, Marcelo Tosatti wrote: Avi, Gleb, Alex, do you know why it is necessary to support change of GPA base again? BAR moving around. Without taking into consideration backwards compatibility, userspace can first delete the slot and later create a new one. Current qemu

Re: [PATCH 38/38] ppc: e500_tlb memset clears nothing

2012-08-15 Thread Avi Kivity
On 08/15/2012 02:04 AM, Alexander Graf wrote: From: Alan Cox a...@linux.intel.com Put the parameters the right way around Addresses https://bugzilla.kernel.org/show_bug.cgi?id=44031 Should this go to 3.6 (and backports etc.)? -- error compiling committee.c: too many arguments to

Re: [PATCH 38/38] ppc: e500_tlb memset clears nothing

2012-08-15 Thread Avi Kivity
On 08/15/2012 01:09 PM, Alexander Graf wrote: On 15.08.2012, at 12:07, Avi Kivity wrote: On 08/15/2012 02:04 AM, Alexander Graf wrote: From: Alan Cox a...@linux.intel.com Put the parameters the right way around Addresses https://bugzilla.kernel.org/show_bug.cgi?id=44031 Should

Re: [PATCH] kvm-all.c: Move init of irqchip_inject_ioctl out of kvm_irqchip_create()

2012-08-14 Thread Avi Kivity
On 08/14/2012 10:33 AM, Jan Kiszka wrote: KVM_IRQ_LINE is old-style, deprecated, KVM_IRQ_LINE_STATUS (i.e injection with feedback to allow lost-tick compensation) is the current standard that other archs should pick up. KVM_IRQ_LINE_STATUS may not make sense on all architectures. I don't

Re: [PATCH v7 2/2] kvm: KVM_EOIFD, an eventfd for EOIs

2012-08-14 Thread Avi Kivity
On 08/12/2012 12:33 PM, Michael S. Tsirkin wrote: Michael, would the interface be more acceptable to you if we added separate ioctls to allocate and free some representation of an irq source ID, gsi pair? For instance, an ioctl might return an idr entry for an irq source ID/gsi object which

Re: [PATCH] kvm-all.c: Move init of irqchip_inject_ioctl out of kvm_irqchip_create()

2012-08-14 Thread Avi Kivity
On 08/14/2012 02:05 PM, Jan Kiszka wrote: On 2012-08-14 13:01, Avi Kivity wrote: On 08/14/2012 10:33 AM, Jan Kiszka wrote: KVM_IRQ_LINE is old-style, deprecated, KVM_IRQ_LINE_STATUS (i.e injection with feedback to allow lost-tick compensation) is the current standard that other archs should

Re: [PATCH v5 00/12] KVM: introduce readonly memslot

2012-08-14 Thread Avi Kivity
On 08/10/2012 09:14 PM, Marcelo Tosatti wrote: On Tue, Aug 07, 2012 at 05:47:15PM +0800, Xiao Guangrong wrote: Changelog: - introduce KVM_PFN_ERR_RO_FAULT instead of dummy page - introduce KVM_HVA_ERR_BAD and optimize error hva indicators The test case can be found at:

Re: [PATCH 0/8] use jump labels to streamline common APIC configuration

2012-08-14 Thread Avi Kivity
On 08/14/2012 05:00 PM, Jan Kiszka wrote: The host can prevent this by leaving disabling the guest pmu. But disabling jump labels for real-time kernels may be acceptable too. We can probably to it at run time by forcing the slow path at all times. Yes, it is possible to add module option

Re: [PATCH 0/3] VFIO-based PCI device assignment for QEMU 1.2

2012-08-14 Thread Avi Kivity
On 08/13/2012 10:31 PM, Anthony Liguori wrote: Jan Kiszka jan.kis...@siemens.com writes: On 2012-08-13 15:58, Avi Kivity wrote: On 08/13/2012 04:27 PM, Anthony Liguori wrote: Thanks for pushing this forward! Hopefully this will finally kill off qemu-kvm.git for good. No, it won't

Re: [PATCH 2/3] vfio: vfio-pci device assignment driver

2012-08-14 Thread Avi Kivity
On 08/01/2012 08:18 AM, Alex Williamson wrote: This adds the core of the QEMU VFIO-based PCI device assignment driver. To make use of this driver, enable CONFIG_VFIO, CONFIG_VFIO_IOMMU_TYPE1, and CONFIG_VFIO_PCI in your host Linux kernel config. Load the vfio-pci module. To assign device

Re: [PATCH 0/8] use jump labels to streamline common APIC configuration

2012-08-14 Thread Avi Kivity
On 08/14/2012 05:58 PM, Jan Kiszka wrote: And regarding how common they are: Do standard OSes trigger any jump-label optimized switch during at least their boot-up? I thought so. In that case, if you co-locate RT and standard OSes on a shared host, you would have a conflict. Yes, during

Re: [PATCH 0/8] use jump labels to streamline common APIC configuration

2012-08-14 Thread Avi Kivity
On 08/14/2012 07:38 PM, Jan Kiszka wrote: On 2012-08-14 18:21, Avi Kivity wrote: On 08/14/2012 05:58 PM, Jan Kiszka wrote: And regarding how common they are: Do standard OSes trigger any jump-label optimized switch during at least their boot-up? I thought so. In that case, if you co-locate

Re: [PATCH] KVM: vmx: restore MSR_IA32_DEBUGCTLMSR after VMEXIT

2012-08-13 Thread Avi Kivity
On 08/12/2012 08:28 PM, Gleb Natapov wrote: On Sun, Aug 12, 2012 at 04:40:48PM +0300, Avi Kivity wrote: On 08/12/2012 04:25 PM, Gleb Natapov wrote: How expensive is this? We may want a follow-on patch to cache it in a per-cpu variable. I have patches ready. I couldn't measure any

Re: [RFC PATCH 2/2] Cache msi irq destination.

2012-08-13 Thread Avi Kivity
On 08/13/2012 12:16 PM, Gleb Natapov wrote: Signed-off-by: Gleb Natapov g...@redhat.com -int kvm_irq_delivery_to_apic(struct kvm *kvm, struct kvm_lapic *src, +int kvm_irq_delivery_to_apic(struct kvm_kernel_irq_routing_entry *e, + struct kvm *kvm, struct kvm_lapic *src,

Re: [RFC PATCH 0/2] irq destination caching prototype

2012-08-13 Thread Avi Kivity
On 08/13/2012 12:16 PM, Gleb Natapov wrote: Here is a quick prototype of what we discussed yesterday. This one caches only MSI interrupts for now. The obvious problem is that not all interrupts (namely IPIs and MSIs using KVM_CAP_SIGNAL_MSI) use irq routing table, so they cannot be cached. We

Re: [RFC PATCH 0/2] irq destination caching prototype

2012-08-13 Thread Avi Kivity
On 08/13/2012 12:16 PM, Gleb Natapov wrote: Here is a quick prototype of what we discussed yesterday. This one caches only MSI interrupts for now. The obvious problem is that not all interrupts (namely IPIs and MSIs using KVM_CAP_SIGNAL_MSI) use irq routing table, so they cannot be cached.

Re: [RFC PATCH 0/2] irq destination caching prototype

2012-08-13 Thread Avi Kivity
On 08/13/2012 01:16 PM, Gleb Natapov wrote: On Mon, Aug 13, 2012 at 01:12:46PM +0300, Michael S. Tsirkin wrote: On Mon, Aug 13, 2012 at 12:36:41PM +0300, Avi Kivity wrote: On 08/13/2012 12:16 PM, Gleb Natapov wrote: Here is a quick prototype of what we discussed yesterday. This one

Re: [RFC PATCH 0/2] irq destination caching prototype

2012-08-13 Thread Avi Kivity
On 08/13/2012 01:24 PM, Gleb Natapov wrote: On Mon, Aug 13, 2012 at 01:21:33PM +0300, Avi Kivity wrote: On 08/13/2012 01:16 PM, Gleb Natapov wrote: On Mon, Aug 13, 2012 at 01:12:46PM +0300, Michael S. Tsirkin wrote: On Mon, Aug 13, 2012 at 12:36:41PM +0300, Avi Kivity wrote: On 08/13/2012

Re: [RFC PATCH 0/2] irq destination caching prototype

2012-08-13 Thread Avi Kivity
On 08/13/2012 01:38 PM, Michael S. Tsirkin wrote: On Mon, Aug 13, 2012 at 01:31:36PM +0300, Avi Kivity wrote: On 08/13/2012 01:24 PM, Gleb Natapov wrote: On Mon, Aug 13, 2012 at 01:21:33PM +0300, Avi Kivity wrote: On 08/13/2012 01:16 PM, Gleb Natapov wrote: On Mon, Aug 13, 2012 at 01:12

Re: [RFC PATCH 0/2] irq destination caching prototype

2012-08-13 Thread Avi Kivity
On 08/13/2012 02:01 PM, Gleb Natapov wrote: Actually this is overkill. Suppose we do an apicid-vcpu translation cache? Then we retain O(1) behaviour, no need for a huge cache. Not sure I follow. Unicast MSIs and IPIs can be speeded up by looking up the vcpu using the apic id, using a

Re: [RFC PATCH 0/2] irq destination caching prototype

2012-08-13 Thread Avi Kivity
On 08/13/2012 02:12 PM, Gleb Natapov wrote: On Mon, Aug 13, 2012 at 02:03:51PM +0300, Avi Kivity wrote: On 08/13/2012 02:01 PM, Gleb Natapov wrote: Actually this is overkill. Suppose we do an apicid-vcpu translation cache? Then we retain O(1) behaviour, no need for a huge cache

Re: [RFC PATCH 0/2] irq destination caching prototype

2012-08-13 Thread Avi Kivity
On 08/13/2012 02:41 PM, Gleb Natapov wrote: On Mon, Aug 13, 2012 at 02:30:49PM +0300, Avi Kivity wrote: On 08/13/2012 02:12 PM, Gleb Natapov wrote: On Mon, Aug 13, 2012 at 02:03:51PM +0300, Avi Kivity wrote: On 08/13/2012 02:01 PM, Gleb Natapov wrote: Actually this is overkill

Re: [RFC PATCH 0/2] irq destination caching prototype

2012-08-13 Thread Avi Kivity
On 08/13/2012 02:43 PM, Gleb Natapov wrote: MSI does not have shorthand, so it is simpler but the code above does work for APIC_DFR_CLUSTER as far as I can tell and it does not check lowest prio, which is not multicast, but should bot be cached. It also a little bit pessimistic for logical

[PATCH] KVM: VMX: Advertize RDTSC exiting to nested guests

2012-08-13 Thread Avi Kivity
All processors that support VMX have that feature, and guests (Xen) depend on it. As we already implement it, advertize it to the guest. Signed-off-by: Avi Kivity a...@redhat.com --- arch/x86/kvm/vmx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kvm/vmx.c b/arch

Re: [PATCH 0/3] VFIO-based PCI device assignment for QEMU 1.2

2012-08-13 Thread Avi Kivity
On 08/13/2012 04:27 PM, Anthony Liguori wrote: Thanks for pushing this forward! Hopefully this will finally kill off qemu-kvm.git for good. No, it won't. vfio requires a 3.6 kernel, which we cannot assume anyone has. We'll need the original device assignment code side-by-side. -- error

Re: [PATCH v7 2/2] kvm: KVM_EOIFD, an eventfd for EOIs

2012-08-12 Thread Avi Kivity
On 08/09/2012 10:26 PM, Alex Williamson wrote: On Mon, 2012-08-06 at 13:40 +0300, Avi Kivity wrote: On 08/06/2012 01:38 PM, Avi Kivity wrote: Regarding the implementation, instead of a linked list, would an array of counters parallel to the bitmap make it simpler? Or even, replace

Re: [PATCH 06/15] memory: use refcnt to manage MemoryRegion

2012-08-12 Thread Avi Kivity
On 08/10/2012 09:44 AM, liu ping fan wrote: In the previous discussion, you have suggest add dev-ref++ in core_region_add. But I think, if we can move it to higher layer -- memory_region_{add,del}_subregion, so we can avoid to duplicate do this in other xx_region_add. Why would other memory

Re: Will KVM support Xen on KVM type in nested virtualization ?

2012-08-12 Thread Avi Kivity
On 08/11/2012 12:20 PM, Ren, Yongjie wrote: Hi folks, I did some basic testing on nested virtualization on Intel x86-64 platform. Will KVM support Xen as L1 guest in nested virtualization ? When I tried Xen on KVM mode, I found VMX can't be initialized in L1 Xen hypervisor. I tried both

Re: [PATCH] tsc: use kvmclock for calibration

2012-08-12 Thread Avi Kivity
On 08/10/2012 11:10 AM, Gerd Hoffmann wrote: Hi, (1) Use this patch (with alignment issue fixed of course). (2) Do a full kvmclock implementation. Feels a bit like overkill. (3) SeaBIOS can fallback to the PIT for timing on machines which have no TSC. We could do that

Re: [PATCH] tsc: use kvmclock for calibration

2012-08-12 Thread Avi Kivity
On 08/09/2012 09:59 PM, Marcelo Tosatti wrote: +wrmsr(msr, 0); +if (time.version 2 || time.tsc_to_system_mul == 0) +return 0; + +/* go figure tsc frequency */ +khz = pvclock_tsc_khz(time); +dprintf(1, Using kvmclock, msr 0x%x, tsc %d MHz\n, +

Re: [PATCH 5/8] KVM: Add hva_to_memslot

2012-08-12 Thread Avi Kivity
On 08/09/2012 08:02 PM, Alexander Graf wrote: On 09.08.2012, at 12:36, Avi Kivity a...@redhat.com wrote: On 08/09/2012 01:34 PM, Takuya Yoshikawa wrote: On Tue, 7 Aug 2012 12:57:13 +0200 Alexander Graf ag...@suse.de wrote: +struct kvm_memory_slot *hva_to_memslot(struct kvm *kvm

Re: Will KVM support Xen on KVM type in nested virtualization ?

2012-08-12 Thread Avi Kivity
On 08/12/2012 12:41 PM, Ren, Yongjie wrote: #define CPU_BASED_RDTSC_EXITING 0x1000 #define VM_EXIT_ACK_INTR_ON_EXIT0x8000 Will KVM expose these two features in its vCPU ? Those are two bugs in kvm. The first is trivial to fix, the second is harder. I

Re: [RFC 5/5] configure: Enable KVM on ARM

2012-08-12 Thread Avi Kivity
On 08/09/2012 07:33 PM, Peter Maydell wrote: Enable KVM on ARM hosts, now that all the necessary components for it exist. esac case $target_arch2 in - i386|x86_64|ppcemb|ppc|ppc64|s390x) + arm|i386|x86_64|ppcemb|ppc|ppc64|s390x) # Make sure the target and host cpus are compatible

Re: [PATCH] tsc: use kvmclock for calibration

2012-08-12 Thread Avi Kivity
On 08/09/2012 10:02 PM, Marcelo Tosatti wrote: On Thu, Aug 09, 2012 at 05:20:11PM +0300, Avi Kivity wrote: On 08/09/2012 05:18 PM, Gerd Hoffmann wrote: Hi, So what do you suggest? The options I see are: (1) Use this patch (with alignment issue fixed of course). (2) Do a full

Re: [PATCH 5/8] KVM: Add hva_to_memslot

2012-08-12 Thread Avi Kivity
On 08/12/2012 02:03 PM, Alexander Graf wrote: Well, for now I just dropped the whole thing. In general, chances are pretty good that an HVA we get notified on with mmu notifiers is representing guest memory. And flushing a few times too often shouldn't hurt. That is not the case, actually.

Re: [PATCH] KVM: vmx: restore MSR_IA32_DEBUGCTLMSR after VMEXIT

2012-08-12 Thread Avi Kivity
On 08/12/2012 04:12 PM, Gleb Natapov wrote: MSR_IA32_DEBUGCTLMSR is zeroed on VMEXIT. Restore it to the correct value. @@ -6222,6 +6222,7 @@ static void atomic_switch_perf_msrs(struct vcpu_vmx *vmx) static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu) { struct vcpu_vmx *vmx

Re: [PATCH] KVM: vmx: restore MSR_IA32_DEBUGCTLMSR after VMEXIT

2012-08-12 Thread Avi Kivity
On 08/12/2012 04:25 PM, Gleb Natapov wrote: How expensive is this? We may want a follow-on patch to cache it in a per-cpu variable. I have patches ready. I couldn't measure any overhead of the rdmsr(MSR_IA32_DEBUGCTLMSR). Do you mean while running kvm? How about just running it in a

Re: [PATCH 5/8] KVM: Add hva_to_memslot

2012-08-12 Thread Avi Kivity
On 08/09/2012 08:02 PM, Alexander Graf wrote: On 09.08.2012, at 12:36, Avi Kivity a...@redhat.com wrote: On 08/09/2012 01:34 PM, Takuya Yoshikawa wrote: On Tue, 7 Aug 2012 12:57:13 +0200 Alexander Graf ag...@suse.de wrote: +struct kvm_memory_slot *hva_to_memslot(struct kvm *kvm

Re: [PATCH 5/8] KVM: Add hva_to_memslot

2012-08-12 Thread Avi Kivity
On 08/12/2012 02:03 PM, Alexander Graf wrote: Well, for now I just dropped the whole thing. In general, chances are pretty good that an HVA we get notified on with mmu notifiers is representing guest memory. And flushing a few times too often shouldn't hurt. That is not the case, actually.

Re: [PATCH 03/15] qom: introduce reclaimer to release obj

2012-08-09 Thread Avi Kivity
On 08/09/2012 10:49 AM, Paolo Bonzini wrote: Il 09/08/2012 09:33, liu ping fan ha scritto: Yes, it is to defer destructors. See 0009-memory-prepare-flatview-and-radix-tree-for-rcu-style.patch When MemoryRegion is _del_subregion from mem in updater, it may be still in use by reader -- radix or

Re: [PATCH 04/15] memory: MemoryRegion topology must be stable when updating

2012-08-09 Thread Avi Kivity
On 08/09/2012 10:28 AM, liu ping fan wrote: Seems to me that nothing in memory.c can susceptible to races. It must already be called under the big qemu lock, and with the exception of mutators (memory_region_set_*), changes aren't directly visible. Yes, what I want to do is prepare unplug

Re: [PATCH 11/15] lock: introduce global lock for device tree

2012-08-09 Thread Avi Kivity
On 08/09/2012 10:27 AM, liu ping fan wrote: On Wed, Aug 8, 2012 at 5:42 PM, Avi Kivity a...@redhat.com wrote: On 08/08/2012 09:25 AM, Liu Ping Fan wrote: From: Liu Ping Fan pingf...@linux.vnet.ibm.com Please explain the motivation. AFAICT, the big qemu lock is sufficient. Oh, this is one

Re: [PATCH 06/15] memory: use refcnt to manage MemoryRegion

2012-08-09 Thread Avi Kivity
On 08/09/2012 10:27 AM, liu ping fan wrote: On Wed, Aug 8, 2012 at 5:20 PM, Avi Kivity a...@redhat.com wrote: On 08/08/2012 09:25 AM, Liu Ping Fan wrote: From: Liu Ping Fan pingf...@linux.vnet.ibm.com Using refcnt for mr, so we can separate mr's life cycle management from refered object

Re: Nested kvm_intel broken on pre 3.3 hosts

2012-08-09 Thread Avi Kivity
On 08/09/2012 10:13 AM, Stefan Bader wrote: Avi, was the last version of the patch (only adding the flag to the nested MSRs) good for submitting to stable from your point of view? Yes, it is correct. I forwarded it to stable, thanks. -- error compiling committee.c: too many arguments

Re: hang on reboot with 3.6-rc1

2012-08-09 Thread Avi Kivity
On 08/08/2012 07:27 PM, David Ahern wrote: Not sure if KVM is the culprit, but it is the last line shown on the console. I have to power cycle the server to reboot. Have you tried rmmoding the kvm modules before reboot? Were any guests running during this? -- error compiling committee.c:

Re: [PATCH] KVM: correctly detect APIC SW state in kvm_apic_post_state_restore()

2012-08-09 Thread Avi Kivity
On 08/08/2012 03:24 PM, Gleb Natapov wrote: For apic_set_spiv() to track APIC SW state correctly it needs to see previous and next values of the spurious vector register, but currently memset() overwrite the old value before apic_set_spiv() get a chance to do tracking. Fix it by calling

Re: [PATCH 1/4] s390/kvm: Handle hosts not supporting s390-virtio.

2012-08-09 Thread Avi Kivity
On 08/07/2012 05:52 PM, Cornelia Huck wrote: Running under a kvm host does not necessarily imply the presence of a page mapped above the main memory with the virtio information; however, the code includes a hard coded access to that page. Instead, check for the presence of the page and exit

Re: [PATCH 5/8] KVM: Add hva_to_memslot

2012-08-09 Thread Avi Kivity
On 08/09/2012 01:34 PM, Takuya Yoshikawa wrote: On Tue, 7 Aug 2012 12:57:13 +0200 Alexander Graf ag...@suse.de wrote: +struct kvm_memory_slot *hva_to_memslot(struct kvm *kvm, hva_t hva) +{ +struct kvm_memslots *slots = kvm_memslots(kvm); +struct kvm_memory_slot *memslot; + +

Re: [PATCH] tsc: use kvmclock for calibration

2012-08-09 Thread Avi Kivity
On 08/09/2012 02:57 PM, Gerd Hoffmann wrote: Use kvmclock for tsc calibration when running on kvm. Without this the tsc frequency calibrated by seabios can be *way* off in case the virtual machine is booted on a loaded host. I've seen seabios calibrating 27 instead of ca. 2800 MHz, resulting

Re: [PATCH] handle device help before accelerator set up

2012-08-09 Thread Avi Kivity
On 08/08/2012 09:40 PM, Bruce Rogers wrote: A command line device probe using just -device ? gets processed after qemu-kvm initializes the accelerator. If /dev/kvm is not present, the accelerator check will fail (kvm is defaulted to on), which causes libvirt to not be set up to handle qemu

Re: [PATCH v2 0/7] split out uses of kvm_irqchip_in_kernel()

2012-08-09 Thread Avi Kivity
On 08/07/2012 06:11 PM, Peter Maydell wrote: On 2 August 2012 10:14, Jan Kiszka jan.kis...@web.de wrote: On 2012-07-26 16:35, Peter Maydell wrote: This patch series removes all uses of kvm_irqchip_in_kernel() from architecture-independent code, by creating a set of more specific functions

Re: [PATCH] tsc: use kvmclock for calibration

2012-08-09 Thread Avi Kivity
On 08/09/2012 05:01 PM, Avi Kivity wrote: On 08/09/2012 04:57 PM, Gerd Hoffmann wrote: Hi, +u64 kvm_tsc_khz(void) +{ +u32 eax, ebx, ecx, edx, msr; +struct pvclock_vcpu_time_info time; +u32 addr = (u32)(time); +u64 khz; + +/* check presence and figure msr number

Re: [PATCH] tsc: use kvmclock for calibration

2012-08-09 Thread Avi Kivity
On 08/09/2012 05:12 PM, Gerd Hoffmann wrote: Hi, er, the documentation says 4 bytes (so stack alignment works). I distinctly remember having a large alignment requirement so we don't cross a page or slot boundary... something's wrong here. case MSR_KVM_SYSTEM_TIME: { [ ... ]

Re: [PATCH] tsc: use kvmclock for calibration

2012-08-09 Thread Avi Kivity
On 08/09/2012 04:57 PM, Gerd Hoffmann wrote: Hi, +u64 kvm_tsc_khz(void) +{ +u32 eax, ebx, ecx, edx, msr; +struct pvclock_vcpu_time_info time; +u32 addr = (u32)(time); +u64 khz; + +/* check presence and figure msr number */ +cpuid(KVM_CPUID_FEATURES, eax, ebx,

Re: [PATCH] tsc: use kvmclock for calibration

2012-08-09 Thread Avi Kivity
On 08/09/2012 05:18 PM, Gerd Hoffmann wrote: Hi, So what do you suggest? The options I see are: (1) Use this patch (with alignment issue fixed of course). (2) Do a full kvmclock implementation. Feels a bit like overkill. (3) SeaBIOS can fallback to the PIT for timing on machines

Re: [net-next RFC V5 3/5] virtio: intorduce an API to set affinity for a virtqueue

2012-08-09 Thread Avi Kivity
On 08/09/2012 06:13 PM, Paolo Bonzini wrote: Il 05/07/2012 12:29, Jason Wang ha scritto: Sometimes, virtio device need to configure irq affiniry hint to maximize the performance. Instead of just exposing the irq of a virtqueue, this patch introduce an API to set the affinity for a virtqueue.

Re: [PATCH 5/8] KVM: Add hva_to_memslot

2012-08-09 Thread Avi Kivity
On 08/09/2012 01:34 PM, Takuya Yoshikawa wrote: On Tue, 7 Aug 2012 12:57:13 +0200 Alexander Graf ag...@suse.de wrote: +struct kvm_memory_slot *hva_to_memslot(struct kvm *kvm, hva_t hva) +{ +struct kvm_memslots *slots = kvm_memslots(kvm); +struct kvm_memory_slot *memslot; + +

Re: Reset problem vs. MMIO emulation, hypercalls, etc...

2012-08-08 Thread Avi Kivity
On 08/08/2012 12:09 AM, Benjamin Herrenschmidt wrote: On Tue, 2012-08-07 at 16:13 +0300, Avi Kivity wrote: Peter has started to fix up this naming mess in qemu. I guess we should do the same for the kernel (except for ABIs) and document it, because it keeps generating confusion. Ok so

Re: Reset problem vs. MMIO emulation, hypercalls, etc...

2012-08-08 Thread Avi Kivity
On 08/08/2012 03:49 AM, David Gibson wrote: We never have irqchip in kernel (because we haven't written that yet) but we still sleep in-kernel for CEDE. I haven't spotted any problem with that, but now I'm wondering if there is one, since x86 don't do it in what seems like the analogous

Re: [PATCH 01/15] atomic: introduce atomic operations

2012-08-08 Thread Avi Kivity
On 08/08/2012 09:25 AM, Liu Ping Fan wrote: From: Liu Ping Fan pingf...@linux.vnet.ibm.com If out of global lock, we will be challenged by SMP in low level, so need atomic ops. This file is heavily copied from kernel. Currently, only x86 atomic ops included, and will be extended for other

Re: [PATCH 03/15] qom: introduce reclaimer to release obj

2012-08-08 Thread Avi Kivity
On 08/08/2012 09:25 AM, Liu Ping Fan wrote: From: Liu Ping Fan pingf...@linux.vnet.ibm.com Collect unused object and release them at caller demand. Please explain the motivation for this patch. -- error compiling committee.c: too many arguments to function -- To unsubscribe from this

Re: [PATCH 04/15] memory: MemoryRegion topology must be stable when updating

2012-08-08 Thread Avi Kivity
On 08/08/2012 09:25 AM, Liu Ping Fan wrote: From: Liu Ping Fan pingf...@linux.vnet.ibm.com Using mem_map_lock to protect among updaters. So we can get the intact snapshot of mem topology -- FlatView radix-tree. Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com --- exec.c |3

Re: [PATCH 03/15] qom: introduce reclaimer to release obj

2012-08-08 Thread Avi Kivity
On 08/08/2012 12:07 PM, Paolo Bonzini wrote: Il 08/08/2012 11:05, Avi Kivity ha scritto: From: Liu Ping Fan pingf...@linux.vnet.ibm.com Collect unused object and release them at caller demand. Please explain the motivation for this patch. It's poor man RCU, I think? I thought

Re: [Qemu-devel] [PATCH 01/15] atomic: introduce atomic operations

2012-08-08 Thread Avi Kivity
On 08/08/2012 12:05 PM, 陳韋任 (Wei-Ren Chen) wrote: I propose we use gcc builtins. We get automatic architecture support, and tuning for newer processors if the user so chooses. http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Atomic-Builtins.html In May 2031 we can switch to C11 atomics.

Re: [PATCH 05/15] memory: introduce life_ops to MemoryRegion

2012-08-08 Thread Avi Kivity
On 08/08/2012 09:25 AM, Liu Ping Fan wrote: From: Liu Ping Fan pingf...@linux.vnet.ibm.com The types of referred object by MemoryRegion are variable, ex, another mr, DeviceState, or other struct defined by drivers. So the refer/unrefer may be different by drivers. Using this ops, we can

Re: [PATCH 06/15] memory: use refcnt to manage MemoryRegion

2012-08-08 Thread Avi Kivity
On 08/08/2012 09:25 AM, Liu Ping Fan wrote: From: Liu Ping Fan pingf...@linux.vnet.ibm.com Using refcnt for mr, so we can separate mr's life cycle management from refered object. When mr-ref 0-1, inc the refered object. When mr-ref 1-0, dec the refered object. The refered object can

Re: [PATCH 08/15] memory: introduce PhysMap to present snapshot of toploygy

2012-08-08 Thread Avi Kivity
On 08/08/2012 09:25 AM, Liu Ping Fan wrote: From: Liu Ping Fan pingf...@linux.vnet.ibm.com PhysMap contain the flatview and radix-tree view, they are snapshot of system topology and should be consistent. With PhysMap, we can swap the pointer when updating and achieve the atomic.

Re: [PATCH 09/15] memory: prepare flatview and radix-tree for rcu style access

2012-08-08 Thread Avi Kivity
On 08/08/2012 09:25 AM, Liu Ping Fan wrote: From: Liu Ping Fan pingf...@linux.vnet.ibm.com Flatview and radix view are all under the protection of pointer. And this make sure the change of them seem to be atomic! The mr accessed by radix-tree leaf or flatview will be reclaimed after the

Re: [PATCH 11/15] lock: introduce global lock for device tree

2012-08-08 Thread Avi Kivity
On 08/08/2012 09:25 AM, Liu Ping Fan wrote: From: Liu Ping Fan pingf...@linux.vnet.ibm.com Please explain the motivation. AFAICT, the big qemu lock is sufficient. -- error compiling committee.c: too many arguments to function -- To unsubscribe from this list: send the line unsubscribe kvm

Re: [PATCH 13/15] hotplug: introduce qdev_unplug_complete() to remove device from views

2012-08-08 Thread Avi Kivity
On 08/08/2012 12:52 PM, Paolo Bonzini wrote: Il 08/08/2012 08:25, Liu Ping Fan ha scritto: +void qdev_unplug_complete(DeviceState *dev, Error **errp) +{ +/* isolate from mem view */ +qdev_unmap(dev); +qemu_lock_devtree(); +/* isolate from device tree */ +

Re: [PATCH] KVM: x86 emulator: access GPRs on demand

2012-08-08 Thread Avi Kivity
On 08/08/2012 12:23 AM, Marcelo Tosatti wrote: @@ -281,8 +294,10 @@ struct x86_emulate_ctxt { bool rip_relative; unsigned long _eip; struct operand memop; +u32 regs_valid; /* bitmaps of registers in _regs[] that can be read */ +u32 regs_dirty; /* bitmaps of registers

Re: Reset problem vs. MMIO emulation, hypercalls, etc...

2012-08-08 Thread Avi Kivity
On 08/08/2012 02:59 PM, David Gibson wrote: No, you're correct. HLT could have been emulated in userspace, it just wasn't. The correct statement is that HLT was arbitrarily chosen to be emulated in userspace with the synchronous model, but the asynchronous model forced it into the kernel.

Re: [PATCH 01/15] atomic: introduce atomic operations

2012-08-08 Thread Avi Kivity
On 08/08/2012 04:49 PM, Paolo Bonzini wrote: Il 08/08/2012 15:32, Peter Maydell ha scritto: 1. GCC atomics look ugly, :) do not provide rmb/wmb, and in some versions of GCC mb is known to be (wrongly) a no-op. 2. glib atomics do not provide mb/rmb/wmb either, and

Re: Reset problem vs. MMIO emulation, hypercalls, etc...

2012-08-08 Thread Avi Kivity
On 08/08/2012 12:09 AM, Benjamin Herrenschmidt wrote: On Tue, 2012-08-07 at 16:13 +0300, Avi Kivity wrote: Peter has started to fix up this naming mess in qemu. I guess we should do the same for the kernel (except for ABIs) and document it, because it keeps generating confusion. Ok so

Re: Reset problem vs. MMIO emulation, hypercalls, etc...

2012-08-08 Thread Avi Kivity
On 08/08/2012 03:49 AM, David Gibson wrote: We never have irqchip in kernel (because we haven't written that yet) but we still sleep in-kernel for CEDE. I haven't spotted any problem with that, but now I'm wondering if there is one, since x86 don't do it in what seems like the analogous

Re: Reset problem vs. MMIO emulation, hypercalls, etc...

2012-08-08 Thread Avi Kivity
On 08/08/2012 02:59 PM, David Gibson wrote: No, you're correct. HLT could have been emulated in userspace, it just wasn't. The correct statement is that HLT was arbitrarily chosen to be emulated in userspace with the synchronous model, but the asynchronous model forced it into the kernel.

Re: Reset problem vs. MMIO emulation, hypercalls, etc...

2012-08-07 Thread Avi Kivity
On 08/07/2012 03:14 PM, David Gibson wrote: On Tue, Aug 07, 2012 at 11:46:35AM +0300, Avi Kivity wrote: On 08/07/2012 04:32 AM, David Gibson wrote: On Tue, Aug 07, 2012 at 06:57:57AM +1000, Benjamin Herrenschmidt wrote: On Mon, 2012-08-06 at 13:13 +1000, David Gibson wrote: So, I'm still

Re: [PATCH 6/8] KVM: PPC: E500: Implement MMU notifiers

2012-08-07 Thread Avi Kivity
On 08/07/2012 01:57 PM, Alexander Graf wrote: The e500 target has lived without mmu notifiers ever since it got introduced, but fails for the user space check on them with hugetlbfs. So in order to get that one working, implement mmu notifiers in a reasonably dumb fashion and be happy. On

Re: [PATCH 7/8] KVM: Add page map arch callback

2012-08-07 Thread Avi Kivity
On 08/07/2012 01:57 PM, Alexander Graf wrote: Some archs need to ensure that their icache is flushed when mapping a new page. Add a callback to the generic code for an arch to implement any cache flush logic it may need. Signed-off-by: Alexander Graf ag...@suse.de --- virt/kvm/kvm_main.c

Re: [PATCH 7/8] KVM: Add page map arch callback

2012-08-07 Thread Avi Kivity
On 08/07/2012 04:44 PM, Alexander Graf wrote: Is this the correct place? Who says the caller of hva_to_pfn() is going to map it? I don't think anyone is. However, we need the struct page, and all the generic kvm mm code tries hard to hide it from its users. The alternative would be

Re: [Android-virt] [PATCH v9 11/16] ARM: KVM: Inject IRQs and FIQs from userspace

2012-08-07 Thread Avi Kivity
On 08/06/2012 08:20 PM, Peter Maydell wrote: On 3 July 2012 10:01, Christoffer Dall c.d...@virtualopensystems.com wrote: From: Christoffer Dall cd...@cs.columbia.edu Userspace can inject IRQs and FIQs through the KVM_IRQ_LINE VM ioctl. This ioctl is used since the sematics are in fact two

Re: [PATCH 7/8] KVM: Add page map arch callback

2012-08-07 Thread Avi Kivity
On 08/07/2012 05:08 PM, Alexander Graf wrote: On 07.08.2012, at 15:58, Avi Kivity a...@redhat.com wrote: On 08/07/2012 04:44 PM, Alexander Graf wrote: Is this the correct place? Who says the caller of hva_to_pfn() is going to map it? I don't think anyone is. However, we need

Re: [PATCH 6/8] KVM: PPC: E500: Implement MMU notifiers

2012-08-07 Thread Avi Kivity
On 08/07/2012 04:52 PM, Alexander Graf wrote: +/* MMU Notifiers */ + +int kvm_unmap_hva(struct kvm *kvm, unsigned long hva) +{ +/* Is this a guest page? */ +if (!hva_to_memslot(kvm, hva)) +return 0; + +/* + * Flush all shadow tlb entries

Re: [PATCH 7/8] KVM: Add page map arch callback

2012-08-07 Thread Avi Kivity
On 08/07/2012 05:14 PM, Alexander Graf wrote: On 07.08.2012, at 16:10, Avi Kivity a...@redhat.com wrote: On 08/07/2012 05:08 PM, Alexander Graf wrote: On 07.08.2012, at 15:58, Avi Kivity a...@redhat.com wrote: On 08/07/2012 04:44 PM, Alexander Graf wrote: Is this the correct

Re: [Android-virt] [PATCH v9 11/16] ARM: KVM: Inject IRQs and FIQs from userspace

2012-08-07 Thread Avi Kivity
On 08/07/2012 05:12 PM, Peter Maydell wrote: On 7 August 2012 14:59, Avi Kivity a...@redhat.com wrote: On 08/06/2012 08:20 PM, Peter Maydell wrote: On 3 July 2012 10:01, Christoffer Dall c.d...@virtualopensystems.com wrote: From: Christoffer Dall cd...@cs.columbia.edu Userspace can inject

Re: [PATCH 7/8] KVM: Add page map arch callback

2012-08-07 Thread Avi Kivity
On 08/07/2012 05:24 PM, Alexander Graf wrote: Pre-map? How? In arch code before you install the page in a pte/tlbe. So how do I get to the struct page in there? pfn_to_page() -- error compiling committee.c: too many arguments to function -- To unsubscribe from this list: send the

Re: Reset problem vs. MMIO emulation, hypercalls, etc...

2012-08-07 Thread Avi Kivity
On 08/06/2012 11:25 PM, Scott Wood wrote: On 08/05/2012 04:00 AM, Avi Kivity wrote: On 08/04/2012 01:32 AM, Benjamin Herrenschmidt wrote: On Fri, 2012-08-03 at 15:05 -0300, Marcelo Tosatti wrote: See kvm_arch_process_async_events() call to qemu_system_reset_request() in target-i386/kvm.c

Re: Reset problem vs. MMIO emulation, hypercalls, etc...

2012-08-07 Thread Avi Kivity
On 08/07/2012 04:32 AM, David Gibson wrote: On Tue, Aug 07, 2012 at 06:57:57AM +1000, Benjamin Herrenschmidt wrote: On Mon, 2012-08-06 at 13:13 +1000, David Gibson wrote: So, I'm still trying to nut out the implications for H_CEDE, and think if there are any other hypercalls that might want

Re: Reset problem vs. MMIO emulation, hypercalls, etc...

2012-08-07 Thread Avi Kivity
On 08/06/2012 11:25 PM, Scott Wood wrote: On 08/05/2012 04:00 AM, Avi Kivity wrote: On 08/04/2012 01:32 AM, Benjamin Herrenschmidt wrote: On Fri, 2012-08-03 at 15:05 -0300, Marcelo Tosatti wrote: See kvm_arch_process_async_events() call to qemu_system_reset_request() in target-i386/kvm.c

Re: Reset problem vs. MMIO emulation, hypercalls, etc...

2012-08-07 Thread Avi Kivity
On 08/07/2012 04:32 AM, David Gibson wrote: On Tue, Aug 07, 2012 at 06:57:57AM +1000, Benjamin Herrenschmidt wrote: On Mon, 2012-08-06 at 13:13 +1000, David Gibson wrote: So, I'm still trying to nut out the implications for H_CEDE, and think if there are any other hypercalls that might want

<    2   3   4   5   6   7   8   9   10   11   >