Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1329264 > unrolled thread

[PATCH 2/3] KVM: x86: consolidate "has lapic" checks into irq.c

Started byPaolo Bonzini <pbonzini@redhat.com>
First post2016-02-08 17:20 +0100
Last post2016-02-09 16:30 +0100
Articles 4 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 2/3] KVM: x86: consolidate "has lapic" checks into irq.c Paolo Bonzini <pbonzini@redhat.com> - 2016-02-08 17:20 +0100
    Re: [PATCH 2/3] KVM: x86: consolidate "has lapic" checks into irq.c Radim Krčmář <rkrcmar@redhat.com> - 2016-02-09 15:10 +0100
      Re: [PATCH 2/3] KVM: x86: consolidate "has lapic" checks into irq.c Paolo Bonzini <pbonzini@redhat.com> - 2016-02-09 16:10 +0100
        Re: [PATCH 2/3] KVM: x86: consolidate "has lapic" checks into irq.c Radim Krčmář <rkrcmar@redhat.com> - 2016-02-09 16:30 +0100

#1329264 — [PATCH 2/3] KVM: x86: consolidate "has lapic" checks into irq.c

FromPaolo Bonzini <pbonzini@redhat.com>
Date2016-02-08 17:20 +0100
Subject[PATCH 2/3] KVM: x86: consolidate "has lapic" checks into irq.c
Message-ID<qZWHF-7Fq-41@gated-at.bofh.it>
Do for kvm_cpu_has_pending_timer and kvm_inject_pending_timer_irqs
what the other irq.c routines have been doing.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 arch/x86/kvm/irq.c   | 9 ++++++---
 arch/x86/kvm/lapic.c | 6 +-----
 2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/arch/x86/kvm/irq.c b/arch/x86/kvm/irq.c
index 3982b479bb5f..4056007e9fe1 100644
--- a/arch/x86/kvm/irq.c
+++ b/arch/x86/kvm/irq.c
@@ -33,7 +33,10 @@
  */
 int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu)
 {
-	return apic_has_pending_timer(vcpu);
+	if (lapic_in_kernel(vcpu))
+		return apic_has_pending_timer(vcpu);
+
+	return true;
 }
 EXPORT_SYMBOL(kvm_cpu_has_pending_timer);
 
@@ -137,8 +140,8 @@ EXPORT_SYMBOL_GPL(kvm_cpu_get_interrupt);
 
 void kvm_inject_pending_timer_irqs(struct kvm_vcpu *vcpu)
 {
-	kvm_inject_apic_timer_irqs(vcpu);
-	/* TODO: PIT, RTC etc. */
+	if (lapic_in_kernel(vcpu))
+		kvm_inject_apic_timer_irqs(vcpu);
 }
 EXPORT_SYMBOL_GPL(kvm_inject_pending_timer_irqs);
 
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
index b1029051f664..57e3f27bdadb 100644
--- a/arch/x86/kvm/lapic.c
+++ b/arch/x86/kvm/lapic.c
@@ -1801,8 +1801,7 @@ int apic_has_pending_timer(struct kvm_vcpu *vcpu)
 {
 	struct kvm_lapic *apic = vcpu->arch.apic;
 
-	if (kvm_vcpu_has_lapic(vcpu) && apic_enabled(apic) &&
-			apic_lvt_enabled(apic, APIC_LVTT))
+	if (apic_enabled(apic) && apic_lvt_enabled(apic, APIC_LVTT))
 		return atomic_read(&apic->lapic_timer.pending);
 
 	return 0;
@@ -1927,9 +1926,6 @@ void kvm_inject_apic_timer_irqs(struct kvm_vcpu *vcpu)
 {
 	struct kvm_lapic *apic = vcpu->arch.apic;
 
-	if (!kvm_vcpu_has_lapic(vcpu))
-		return;
-
 	if (atomic_read(&apic->lapic_timer.pending) > 0) {
 		kvm_apic_local_deliver(apic, APIC_LVTT);
 		if (apic_lvtt_tscdeadline(apic))
-- 
1.8.3.1

[toc] | [next] | [standalone]


#1330261

FromRadim Krčmář <rkrcmar@redhat.com>
Date2016-02-09 15:10 +0100
Message-ID<r0h9n-56j-5@gated-at.bofh.it>
In reply to#1329264
2016-02-08 17:15+0100, Paolo Bonzini:
> Do for kvm_cpu_has_pending_timer and kvm_inject_pending_timer_irqs
> what the other irq.c routines have been doing.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> diff --git a/arch/x86/kvm/irq.c b/arch/x86/kvm/irq.c
> @@ -33,7 +33,10 @@
>   */
>  int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu)
>  {
> -	return apic_has_pending_timer(vcpu);
> +	if (lapic_in_kernel(vcpu))
> +		return apic_has_pending_timer(vcpu);
> +
> +	return true;

Apart from int/bool mismatch, it returned 0 before and that was correct.

[toc] | [prev] | [next] | [standalone]


#1330312

FromPaolo Bonzini <pbonzini@redhat.com>
Date2016-02-09 16:10 +0100
Message-ID<r0i5s-5IR-23@gated-at.bofh.it>
In reply to#1330261

On 09/02/2016 15:05, Radim Krčmář wrote:
> 2016-02-08 17:15+0100, Paolo Bonzini:
>> Do for kvm_cpu_has_pending_timer and kvm_inject_pending_timer_irqs
>> what the other irq.c routines have been doing.
>>
>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>> ---
>> diff --git a/arch/x86/kvm/irq.c b/arch/x86/kvm/irq.c
>> @@ -33,7 +33,10 @@
>>   */
>>  int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu)
>>  {
>> -	return apic_has_pending_timer(vcpu);
>> +	if (lapic_in_kernel(vcpu))
>> +		return apic_has_pending_timer(vcpu);
>> +
>> +	return true;
> 
> Apart from int/bool mismatch, it returned 0 before and that was correct.
> 

So that means "return 0;" implies "Reviewed-by"? :)

Paolo

[toc] | [prev] | [next] | [standalone]


#1330345

FromRadim Krčmář <rkrcmar@redhat.com>
Date2016-02-09 16:30 +0100
Message-ID<r0ioO-5QL-39@gated-at.bofh.it>
In reply to#1330312
2016-02-09 16:07+0100, Paolo Bonzini:
> On 09/02/2016 15:05, Radim Krčmář wrote:
>> 2016-02-08 17:15+0100, Paolo Bonzini:
>>>  int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu)
>>> +	return true;
>> 
>> Apart from int/bool mismatch, it returned 0 before and that was correct.
>> 
> 
> So that means "return 0;" implies "Reviewed-by"? :)

Yes.  (Also for "false" and "bool kvm_cpu_has_pending_timer...". :])

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web