* [PATCH] KVM: Fix tsc deadline timer without irqchip_in_kernel()
@ 2011-10-02 9:51 Avi Kivity
2011-10-02 16:28 ` Jan Kiszka
0 siblings, 1 reply; 5+ messages in thread
From: Avi Kivity @ 2011-10-02 9:51 UTC (permalink / raw)
To: kvm, Marcelo Tosatti; +Cc: Jinsong Liu
vcpu->arch.apic may be NULL.
Signed-off-by: Avi Kivity <avi@redhat.com>
---
arch/x86/kvm/x86.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 83b839f..aa11707 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -600,6 +600,8 @@ static bool guest_cpuid_has_fsgsbase(struct kvm_vcpu *vcpu)
static void update_cpuid(struct kvm_vcpu *vcpu)
{
struct kvm_cpuid_entry2 *best;
+ struct kvm_lapic *apic = vcpu->arch.apic;
+ u32 timer_mode_mask;
best = kvm_find_cpuid_entry(vcpu, 1, 0);
if (!best)
@@ -615,9 +617,12 @@ static void update_cpuid(struct kvm_vcpu *vcpu)
if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL &&
best->function == 0x1) {
best->ecx |= bit(X86_FEATURE_TSC_DEADLINE_TIMER);
- vcpu->arch.apic->lapic_timer.timer_mode_mask = (3 << 17);
+ timer_mode_mask = 3 << 17;
} else
- vcpu->arch.apic->lapic_timer.timer_mode_mask = (1 << 17);
+ timer_mode_mask = 1 << 17;
+
+ if (apic)
+ apic->lapic_timer.timer_mode_mask = timer_mode_mask;
}
int kvm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4)
--
1.7.6.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] KVM: Fix tsc deadline timer without irqchip_in_kernel()
2011-10-02 9:51 [PATCH] KVM: Fix tsc deadline timer without irqchip_in_kernel() Avi Kivity
@ 2011-10-02 16:28 ` Jan Kiszka
2011-10-02 16:30 ` Avi Kivity
0 siblings, 1 reply; 5+ messages in thread
From: Jan Kiszka @ 2011-10-02 16:28 UTC (permalink / raw)
To: Avi Kivity; +Cc: kvm, Marcelo Tosatti, Jinsong Liu
[-- Attachment #1: Type: text/plain, Size: 1271 bytes --]
On 2011-10-02 11:51, Avi Kivity wrote:
> vcpu->arch.apic may be NULL.
>
> Signed-off-by: Avi Kivity <avi@redhat.com>
> ---
> arch/x86/kvm/x86.c | 9 +++++++--
> 1 files changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 83b839f..aa11707 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -600,6 +600,8 @@ static bool guest_cpuid_has_fsgsbase(struct kvm_vcpu *vcpu)
> static void update_cpuid(struct kvm_vcpu *vcpu)
> {
> struct kvm_cpuid_entry2 *best;
> + struct kvm_lapic *apic = vcpu->arch.apic;
> + u32 timer_mode_mask;
>
> best = kvm_find_cpuid_entry(vcpu, 1, 0);
> if (!best)
> @@ -615,9 +617,12 @@ static void update_cpuid(struct kvm_vcpu *vcpu)
> if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL &&
> best->function == 0x1) {
> best->ecx |= bit(X86_FEATURE_TSC_DEADLINE_TIMER);
> - vcpu->arch.apic->lapic_timer.timer_mode_mask = (3 << 17);
> + timer_mode_mask = 3 << 17;
> } else
> - vcpu->arch.apic->lapic_timer.timer_mode_mask = (1 << 17);
> + timer_mode_mask = 1 << 17;
> +
> + if (apic)
> + apic->lapic_timer.timer_mode_mask = timer_mode_mask;
Coding style... While at it, you could also fix braces for that else.
Jan
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] KVM: Fix tsc deadline timer without irqchip_in_kernel()
2011-10-02 16:28 ` Jan Kiszka
@ 2011-10-02 16:30 ` Avi Kivity
2011-10-02 16:33 ` Jan Kiszka
0 siblings, 1 reply; 5+ messages in thread
From: Avi Kivity @ 2011-10-02 16:30 UTC (permalink / raw)
To: Jan Kiszka; +Cc: kvm, Marcelo Tosatti, Jinsong Liu
On 10/02/2011 06:28 PM, Jan Kiszka wrote:
> > @@ -615,9 +617,12 @@ static void update_cpuid(struct kvm_vcpu *vcpu)
> > if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL&&
> > best->function == 0x1) {
> > best->ecx |= bit(X86_FEATURE_TSC_DEADLINE_TIMER);
> > - vcpu->arch.apic->lapic_timer.timer_mode_mask = (3<< 17);
> > + timer_mode_mask = 3<< 17;
> > } else
> > - vcpu->arch.apic->lapic_timer.timer_mode_mask = (1<< 17);
> > + timer_mode_mask = 1<< 17;
> > +
> > + if (apic)
> > + apic->lapic_timer.timer_mode_mask = timer_mode_mask;
>
> Coding style... While at it, you could also fix braces for that else.
>
Too late... committed and pushed, and Marcelo holds the baton now.
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] KVM: Fix tsc deadline timer without irqchip_in_kernel()
2011-10-02 16:30 ` Avi Kivity
@ 2011-10-02 16:33 ` Jan Kiszka
2011-10-02 17:01 ` Avi Kivity
0 siblings, 1 reply; 5+ messages in thread
From: Jan Kiszka @ 2011-10-02 16:33 UTC (permalink / raw)
To: Avi Kivity; +Cc: kvm, Marcelo Tosatti, Jinsong Liu
[-- Attachment #1: Type: text/plain, Size: 958 bytes --]
On 2011-10-02 18:30, Avi Kivity wrote:
> On 10/02/2011 06:28 PM, Jan Kiszka wrote:
>> > @@ -615,9 +617,12 @@ static void update_cpuid(struct kvm_vcpu *vcpu)
>> > if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL&&
>> > best->function == 0x1) {
>> > best->ecx |= bit(X86_FEATURE_TSC_DEADLINE_TIMER);
>> > - vcpu->arch.apic->lapic_timer.timer_mode_mask = (3<< 17);
>> > + timer_mode_mask = 3<< 17;
>> > } else
>> > - vcpu->arch.apic->lapic_timer.timer_mode_mask = (1<< 17);
>> > + timer_mode_mask = 1<< 17;
>> > +
>> > + if (apic)
>> > + apic->lapic_timer.timer_mode_mask = timer_mode_mask;
>>
>> Coding style... While at it, you could also fix braces for that else.
>>
>
> Too late... committed and pushed, and Marcelo holds the baton now.
Err, sorry, this was false alarm anyway: Its perfectly valid kernel
style - for the kernel, not qemu. :)
Jan
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] KVM: Fix tsc deadline timer without irqchip_in_kernel()
2011-10-02 16:33 ` Jan Kiszka
@ 2011-10-02 17:01 ` Avi Kivity
0 siblings, 0 replies; 5+ messages in thread
From: Avi Kivity @ 2011-10-02 17:01 UTC (permalink / raw)
To: Jan Kiszka; +Cc: kvm, Marcelo Tosatti, Jinsong Liu
On 10/02/2011 06:33 PM, Jan Kiszka wrote:
> On 2011-10-02 18:30, Avi Kivity wrote:
> > On 10/02/2011 06:28 PM, Jan Kiszka wrote:
> >> > @@ -615,9 +617,12 @@ static void update_cpuid(struct kvm_vcpu *vcpu)
> >> > if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL&&
> >> > best->function == 0x1) {
> >> > best->ecx |= bit(X86_FEATURE_TSC_DEADLINE_TIMER);
> >> > - vcpu->arch.apic->lapic_timer.timer_mode_mask = (3<< 17);
> >> > + timer_mode_mask = 3<< 17;
> >> > } else
> >> > - vcpu->arch.apic->lapic_timer.timer_mode_mask = (1<< 17);
> >> > + timer_mode_mask = 1<< 17;
> >> > +
> >> > + if (apic)
> >> > + apic->lapic_timer.timer_mode_mask = timer_mode_mask;
> >>
> >> Coding style... While at it, you could also fix braces for that else.
> >>
> >
> > Too late... committed and pushed, and Marcelo holds the baton now.
>
> Err, sorry, this was false alarm anyway: Its perfectly valid kernel
> style - for the kernel, not qemu. :)
>
Actually CodingStyle does recomment consistent bracing in the if {
multiline } else singleline case.
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-10-02 17:01 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-02 9:51 [PATCH] KVM: Fix tsc deadline timer without irqchip_in_kernel() Avi Kivity
2011-10-02 16:28 ` Jan Kiszka
2011-10-02 16:30 ` Avi Kivity
2011-10-02 16:33 ` Jan Kiszka
2011-10-02 17:01 ` Avi Kivity
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).