Wednesday, February 24, 2010

linux.kernel - 26 new messages in 16 topics - digest

linux.kernel
http://groups.google.com/group/linux.kernel?hl=en

linux.kernel@googlegroups.com

Today's topics:

* KVM: SVM: Coding style cleanup - 4 messages, 2 authors
http://groups.google.com/group/linux.kernel/t/9fa82c01d7c02b51?hl=en
* Another set of nested svm fixes and optimizations - 4 messages, 1 author
http://groups.google.com/group/linux.kernel/t/967b5cd56bd77049?hl=en
* PROBLEM: Wrong bitrate when capturing sound from Creative webcam - 1
messages, 1 author
http://groups.google.com/group/linux.kernel/t/eba07aa7189d33dc?hl=en
* picolcd: driver for PicoLCD HID device - 1 messages, 1 author
http://groups.google.com/group/linux.kernel/t/e13e40f170ffc21f?hl=en
* IB/core: pack struct ib_device a little tighter - 1 messages, 1 author
http://groups.google.com/group/linux.kernel/t/48aebe73a404e022?hl=en
* Email Back Shortly - 1 messages, 1 author
http://groups.google.com/group/linux.kernel/t/cbd7732fdfa56b8f?hl=en
* failslab: add ability to filter slab caches - 1 messages, 1 author
http://groups.google.com/group/linux.kernel/t/98ce51d8046593a9?hl=en
* ftrace: fix ftrace_event_call alignment for use with gcc 4.5 - 1 messages, 1
author
http://groups.google.com/group/linux.kernel/t/e83a00a0498d67dc?hl=en
* [PATCH] ACPI: Eliminate race conditions related to removing event handlers -
1 messages, 1 author
http://groups.google.com/group/linux.kernel/t/ff8d947124a9c487?hl=en
* x86, pci: Add sanity check for PCI fixed bar probing - 1 messages, 1 author
http://groups.google.com/group/linux.kernel/t/1059f41e1abc2b19?hl=en
* x86, legacy_irq: Remove left over nr_legacy_irqs - 2 messages, 1 author
http://groups.google.com/group/linux.kernel/t/48ba2d10e1e10430?hl=en
* x86, mrst: Platform clock setup code - 1 messages, 1 author
http://groups.google.com/group/linux.kernel/t/8de8066dcaaf7975?hl=en
* Staging: Cleanup useless headers - 1 messages, 1 author
http://groups.google.com/group/linux.kernel/t/9057017ecc9aa833?hl=en
* Testing for dirty buffers on a block device - 2 messages, 1 author
http://groups.google.com/group/linux.kernel/t/a9255c9e086f9196?hl=en
* Regulators: wm8400 - cleanup platform driver data handling - 3 messages, 2
authors
http://groups.google.com/group/linux.kernel/t/8f3f33cbcc66f2b6?hl=en
* x86, apbt: Moorestown APB system timer driver - 1 messages, 1 author
http://groups.google.com/group/linux.kernel/t/4be434fd547d373f?hl=en

==============================================================================
TOPIC: KVM: SVM: Coding style cleanup
http://groups.google.com/group/linux.kernel/t/9fa82c01d7c02b51?hl=en
==============================================================================

== 1 of 4 ==
Date: Wed, Feb 24 2010 10:10 am
From: Joerg Roedel


On Wed, Feb 24, 2010 at 06:59:10PM +0100, Joerg Roedel wrote:
> This patch removes whitespace errors, fixes comment formats
> and most of checkpatch warnings. Now vim does not show
^^^^^^^^
This means actually "errors". The warnings left in this file are
completly 80-chars-per-line related. Two errors are left which don't
make sense to fix.

Joerg


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


== 2 of 4 ==
Date: Wed, Feb 24 2010 10:10 am
From: Joerg Roedel


This patch optimizes the way the msrpm of the host and the
guest are merged. The old code merged the 2 msrpm pages
completly. This code needed to touch 24kb of memory for that
operation. The optimized variant this patch introduces
merges only the parts where the host msrpm may contain zero
bits. This reduces the amount of memory which is touched to
48 bytes.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
---
arch/x86/kvm/svm.c | 45 ++++++++++++++++++++++++++++++++++++---------
1 files changed, 36 insertions(+), 9 deletions(-)

diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index ae2f211..eb25fea 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -754,6 +754,7 @@ static struct kvm_vcpu *svm_create_vcpu(struct kvm *kvm, unsigned int id)
svm->nested.hsave = page_address(hsave_page);

svm->nested.msrpm = page_address(nested_msrpm_pages);
+ svm_vcpu_init_msrpm(svm->nested.msrpm);

svm->vmcb = page_address(page);
clear_page(svm->vmcb);
@@ -1824,20 +1825,46 @@ static int nested_svm_vmexit(struct vcpu_svm *svm)

static bool nested_svm_vmrun_msrpm(struct vcpu_svm *svm)
{
- u32 *nested_msrpm;
- struct page *page;
+ /*
+ * This function merges the msr permission bitmaps of kvm and the
+ * nested vmcb. It is omptimized in that it only merges the parts where
+ * the kvm msr permission bitmap may contain zero bits
+ */
+ static const u32 msrpm_offsets[] = {
+ 0x0000002c, /* SYSENTER_CS */
+
+ 0x00000038, /* LASTBRANCHFROMIP
+ LASTBRANCHTOIP
+ LASTINTFROMIP
+ LASTINTTOIP */
+
+ 0x00000820, /* STAR
+ LSTAR
+ CSTAR
+ SYSCALL_MASK */
+
+ 0x00000840, /* FS_BASE
+ GS_BASE
+ KERNEL_GS_BASE */
+
+ 0xffffffff, /* End of List */
+ };
int i;

- nested_msrpm = nested_svm_map(svm, svm->nested.vmcb_msrpm, &page);
- if (!nested_msrpm)
- return false;
+ for (i = 0; msrpm_offsets[i] != 0xffffffff; i++) {
+ u32 value, p;
+ u64 offset;

- for (i = 0; i < PAGE_SIZE * (1 << MSRPM_ALLOC_ORDER) / 4; i++)
- svm->nested.msrpm[i] = svm->msrpm[i] | nested_msrpm[i];
+ offset = svm->nested.vmcb_msrpm + msrpm_offsets[i];
+ p = msrpm_offsets[i] / 4;

- svm->vmcb->control.msrpm_base_pa = __pa(svm->nested.msrpm);
+ if (kvm_read_guest(svm->vcpu.kvm, offset, &value, 4))
+ return false;

- nested_svm_unmap(page);
+ svm->nested.msrpm[p] = svm->msrpm[p] | value;
+ }
+
+ svm->vmcb->control.msrpm_base_pa = __pa(svm->nested.msrpm);

return true;
}
--
1.7.0


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


== 3 of 4 ==
Date: Wed, Feb 24 2010 10:10 am
From: Joerg Roedel


When injecting an vmexit.intr into the nested hypervisor
there might be leftover values in the exit_info fields.
Clear them to not confuse nested hypervisors.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
---
arch/x86/kvm/svm.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 22654de..ae2f211 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -1485,7 +1485,9 @@ static inline bool nested_svm_intr(struct vcpu_svm *svm)
if (!(svm->vcpu.arch.hflags & HF_HIF_MASK))
return false;

- svm->vmcb->control.exit_code = SVM_EXIT_INTR;
+ svm->vmcb->control.exit_code = SVM_EXIT_INTR;
+ svm->vmcb->control.exit_info_1 = 0;
+ svm->vmcb->control.exit_info_2 = 0;

if (svm->nested.intercept & 1ULL) {
/*
--
1.7.0


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


== 4 of 4 ==
Date: Wed, Feb 24 2010 11:30 am
From: Alexander Graf

On 24.02.2010, at 18:59, Joerg Roedel wrote:

> This patch optimizes the way the msrpm of the host and the
> guest are merged. The old code merged the 2 msrpm pages
> completly. This code needed to touch 24kb of memory for that
> operation. The optimized variant this patch introduces
> merges only the parts where the host msrpm may contain zero
> bits. This reduces the amount of memory which is touched to
> 48 bytes.

Nice catch!

>
> Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
> ---
> arch/x86/kvm/svm.c | 45 ++++++++++++++++++++++++++++++++++++---------
> 1 files changed, 36 insertions(+), 9 deletions(-)
>
> diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
> index ae2f211..eb25fea 100644
> --- a/arch/x86/kvm/svm.c
> +++ b/arch/x86/kvm/svm.c
> @@ -754,6 +754,7 @@ static struct kvm_vcpu *svm_create_vcpu(struct kvm *kvm, unsigned int id)
> svm->nested.hsave = page_address(hsave_page);
>
> svm->nested.msrpm = page_address(nested_msrpm_pages);
> + svm_vcpu_init_msrpm(svm->nested.msrpm);
>
> svm->vmcb = page_address(page);
> clear_page(svm->vmcb);
> @@ -1824,20 +1825,46 @@ static int nested_svm_vmexit(struct vcpu_svm *svm)
>
> static bool nested_svm_vmrun_msrpm(struct vcpu_svm *svm)
> {
> - u32 *nested_msrpm;
> - struct page *page;
> + /*
> + * This function merges the msr permission bitmaps of kvm and the
> + * nested vmcb. It is omptimized in that it only merges the parts where
> + * the kvm msr permission bitmap may contain zero bits
> + */
> + static const u32 msrpm_offsets[] = {
> + 0x0000002c, /* SYSENTER_CS */
> +
> + 0x00000038, /* LASTBRANCHFROMIP
> + LASTBRANCHTOIP
> + LASTINTFROMIP
> + LASTINTTOIP */
> +
> + 0x00000820, /* STAR
> + LSTAR
> + CSTAR
> + SYSCALL_MASK */
> +
> + 0x00000840, /* FS_BASE
> + GS_BASE
> + KERNEL_GS_BASE */
> +
> + 0xffffffff, /* End of List */

Isn't there such a list around somewhere already? We really should only keep this list once throughout the whole code. If necessary, just create the list on the fly when bits get set in the msrpm.

Alex

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

==============================================================================
TOPIC: Another set of nested svm fixes and optimizations
http://groups.google.com/group/linux.kernel/t/967b5cd56bd77049?hl=en
==============================================================================

== 1 of 4 ==
Date: Wed, Feb 24 2010 10:10 am
From: Joerg Roedel


Hi,

here is another set of patches I collected in the last days while trying
to get Hyper-V running with nested svm. I was not successful yet but the
patches in this set make sense anyway :-)
The patches fix coding style issues which annoyed me for some time
because my vim shows all c-space-errors with red color. Other patches in
this set make nested svm more complete (nmi and selective cr0 related).
The vm_cr and hwcr.ignne patches are related to Hyper-V tests. This
hypervisor expects to write to those msrs.
The most interesting thing is patch 11 which reduces the amount of
memory which is touched in the vmrun emulation for merging the msrpms
from 24kb to 48 bytes. Please review and comment (or apply if
perfect ;-) ) these patches.

Thanks,

Joerg

diffstat:

arch/x86/include/asm/svm.h | 4 +
arch/x86/kvm/svm.c | 282 +++++++++++++++++++++++++++++++-------------
arch/x86/kvm/trace.h | 22 ++++
arch/x86/kvm/x86.c | 3 +-
4 files changed, 226 insertions(+), 85 deletions(-)

shortlog:

Joerg Roedel (11):
KVM: SVM: Coding style cleanup
KVM: SVM: Reset MMU on nested_svm_vmrun for NPT too
KVM: SVM: Check for nested intercepts on NMI injection
KVM: SVM: Restore tracing of nested vmcb address
KVM: SVM: Add kvm_nested_intercepts tracepoint
KVM: SVM: Implement emulation of vm_cr msr
KVM: SVM: Ignore write of hwcr.ignne
KVM: x86: Don't set arch.cr0 in kvm_set_cr0
KVM: SVM: Handle nested selective_cr0 intercept correctly
KVM: SVM: Clear exit_info for injected INTR exits
KVM: SVM: Optimize nested svm msrpm merging


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


== 2 of 4 ==
Date: Wed, Feb 24 2010 10:10 am
From: Joerg Roedel


This patch removes whitespace errors, fixes comment formats
and most of checkpatch warnings. Now vim does not show
c-space-errors anymore.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
---
arch/x86/kvm/svm.c | 148 ++++++++++++++++++++++++++++-----------------------
1 files changed, 81 insertions(+), 67 deletions(-)

diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index d11ff46..217b8b0 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -119,7 +119,7 @@ struct vcpu_svm {
#if defined(CONFIG_X86_64) || defined(CONFIG_X86_PAE)
static bool npt_enabled = true;
#else
-static bool npt_enabled = false;
+static bool npt_enabled;

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate