* [PATCH 1/1] KVM: Correct deliver_bitmask in kvm_get_intr_delivery_bitmask
@ 2009-02-27 4:58 Sheng Yang
2009-03-02 7:12 ` Gleb Natapov
0 siblings, 1 reply; 3+ messages in thread
From: Sheng Yang @ 2009-02-27 4:58 UTC (permalink / raw)
To: Avi Kivity; +Cc: Gleb Natapov, kvm, Sheng Yang
1. deliver_bitmask is a bitmap rather than a unsigned long intereger.
2. Lowest priority target bitmap wrong calculated by mistake.
3. Prevent potential NULL reference.
Signed-off-by: Sheng Yang <sheng@linux.intel.com>
---
virt/kvm/irq_comm.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/virt/kvm/irq_comm.c b/virt/kvm/irq_comm.c
index d165e05..8e1869d 100644
--- a/virt/kvm/irq_comm.c
+++ b/virt/kvm/irq_comm.c
@@ -54,8 +54,12 @@ void kvm_get_intr_delivery_bitmask(struct kvm_ioapic *ioapic,
deliver_bitmask);
switch (entry->fields.delivery_mode) {
case IOAPIC_LOWEST_PRIORITY:
+ /* Select one in deliver_bitmask */
vcpu = kvm_get_lowest_prio_vcpu(ioapic->kvm,
entry->fields.vector, deliver_bitmask);
+ bitmap_zero(deliver_bitmask, KVM_MAX_VCPUS);
+ if (!vcpu)
+ return;
__set_bit(vcpu->vcpu_id, deliver_bitmask);
break;
case IOAPIC_FIXED:
@@ -65,7 +69,7 @@ void kvm_get_intr_delivery_bitmask(struct kvm_ioapic *ioapic,
if (printk_ratelimit())
printk(KERN_INFO "kvm: unsupported delivery mode %d\n",
entry->fields.delivery_mode);
- *deliver_bitmask = 0;
+ bitmap_zero(deliver_bitmask, KVM_MAX_VCPUS);
}
}
--
1.5.4.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] KVM: Correct deliver_bitmask in kvm_get_intr_delivery_bitmask
2009-02-27 4:58 [PATCH 1/1] KVM: Correct deliver_bitmask in kvm_get_intr_delivery_bitmask Sheng Yang
@ 2009-03-02 7:12 ` Gleb Natapov
2009-03-02 7:46 ` Sheng Yang
0 siblings, 1 reply; 3+ messages in thread
From: Gleb Natapov @ 2009-03-02 7:12 UTC (permalink / raw)
To: Sheng Yang; +Cc: Avi Kivity, kvm
On Fri, Feb 27, 2009 at 12:58:55PM +0800, Sheng Yang wrote:
> 1. deliver_bitmask is a bitmap rather than a unsigned long intereger.
> 2. Lowest priority target bitmap wrong calculated by mistake.
> 3. Prevent potential NULL reference.
>
> Signed-off-by: Sheng Yang <sheng@linux.intel.com>
> ---
> virt/kvm/irq_comm.c | 6 +++++-
> 1 files changed, 5 insertions(+), 1 deletions(-)
>
> diff --git a/virt/kvm/irq_comm.c b/virt/kvm/irq_comm.c
> index d165e05..8e1869d 100644
> --- a/virt/kvm/irq_comm.c
> +++ b/virt/kvm/irq_comm.c
> @@ -54,8 +54,12 @@ void kvm_get_intr_delivery_bitmask(struct kvm_ioapic *ioapic,
> deliver_bitmask);
> switch (entry->fields.delivery_mode) {
> case IOAPIC_LOWEST_PRIORITY:
> + /* Select one in deliver_bitmask */
> vcpu = kvm_get_lowest_prio_vcpu(ioapic->kvm,
> entry->fields.vector, deliver_bitmask);
> + bitmap_zero(deliver_bitmask, KVM_MAX_VCPUS);
> + if (!vcpu)
> + return;
> __set_bit(vcpu->vcpu_id, deliver_bitmask);
> break;
The only caller of kvm_ioapic_get_delivery_bitmask() is kvm_get_intr_delivery_bitmask()
why not add delivery_mode parameter to kvm_ioapic_get_delivery_bitmask()
and get rid of kvm_get_intr_delivery_bitmask()?
> case IOAPIC_FIXED:
> @@ -65,7 +69,7 @@ void kvm_get_intr_delivery_bitmask(struct kvm_ioapic *ioapic,
> if (printk_ratelimit())
> printk(KERN_INFO "kvm: unsupported delivery mode %d\n",
> entry->fields.delivery_mode);
> - *deliver_bitmask = 0;
> + bitmap_zero(deliver_bitmask, KVM_MAX_VCPUS);
> }
> }
>
> --
> 1.5.4.5
--
Gleb.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] KVM: Correct deliver_bitmask in kvm_get_intr_delivery_bitmask
2009-03-02 7:12 ` Gleb Natapov
@ 2009-03-02 7:46 ` Sheng Yang
0 siblings, 0 replies; 3+ messages in thread
From: Sheng Yang @ 2009-03-02 7:46 UTC (permalink / raw)
To: Gleb Natapov; +Cc: Avi Kivity, kvm
On Monday 02 March 2009 15:12:52 Gleb Natapov wrote:
> On Fri, Feb 27, 2009 at 12:58:55PM +0800, Sheng Yang wrote:
> > 1. deliver_bitmask is a bitmap rather than a unsigned long intereger.
> > 2. Lowest priority target bitmap wrong calculated by mistake.
> > 3. Prevent potential NULL reference.
> >
> > Signed-off-by: Sheng Yang <sheng@linux.intel.com>
> > ---
> > virt/kvm/irq_comm.c | 6 +++++-
> > 1 files changed, 5 insertions(+), 1 deletions(-)
> >
> > diff --git a/virt/kvm/irq_comm.c b/virt/kvm/irq_comm.c
> > index d165e05..8e1869d 100644
> > --- a/virt/kvm/irq_comm.c
> > +++ b/virt/kvm/irq_comm.c
> > @@ -54,8 +54,12 @@ void kvm_get_intr_delivery_bitmask(struct kvm_ioapic
> > *ioapic, deliver_bitmask);
> > switch (entry->fields.delivery_mode) {
> > case IOAPIC_LOWEST_PRIORITY:
> > + /* Select one in deliver_bitmask */
> > vcpu = kvm_get_lowest_prio_vcpu(ioapic->kvm,
> > entry->fields.vector, deliver_bitmask);
> > + bitmap_zero(deliver_bitmask, KVM_MAX_VCPUS);
> > + if (!vcpu)
> > + return;
> > __set_bit(vcpu->vcpu_id, deliver_bitmask);
> > break;
>
> The only caller of kvm_ioapic_get_delivery_bitmask() is
> kvm_get_intr_delivery_bitmask() why not add delivery_mode parameter to
> kvm_ioapic_get_delivery_bitmask() and get rid of
> kvm_get_intr_delivery_bitmask()?
Oh yeah, that's right. I think it's OK to merge
kvm_ioapic_get_delivery_bitmask() into kvm_get_intr_delivery_bitmask(). If no
objection, I would send a patch to merge them.
Thanks.
--
regards
Yang, Sheng
>
> > case IOAPIC_FIXED:
> > @@ -65,7 +69,7 @@ void kvm_get_intr_delivery_bitmask(struct kvm_ioapic
> > *ioapic, if (printk_ratelimit())
> > printk(KERN_INFO "kvm: unsupported delivery mode %d\n",
> > entry->fields.delivery_mode);
> > - *deliver_bitmask = 0;
> > + bitmap_zero(deliver_bitmask, KVM_MAX_VCPUS);
> > }
> > }
> >
> > --
> > 1.5.4.5
>
> --
> Gleb.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-03-02 7:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-27 4:58 [PATCH 1/1] KVM: Correct deliver_bitmask in kvm_get_intr_delivery_bitmask Sheng Yang
2009-03-02 7:12 ` Gleb Natapov
2009-03-02 7:46 ` Sheng Yang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox