Re: [RESEND v3 1/3] KVM: setup empty irq routing when create vm

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Mar 8, 2024 at 12:06 PM Yang, Weijiang <weijiang.yang@xxxxxxxxx> wrote:
>
> On 2/29/2024 2:53 PM, Yi Wang wrote:
> > From: Yi Wang <foxywang@xxxxxxxxxxx>

> > +
> > +int kvm_setup_empty_irq_routing_lockless(struct kvm *kvm)
> > +{
> > +     struct kvm_irq_routing_table *new;
> > +     u32 i, j;
> > +
> > +     new = kzalloc(struct_size(new, map, 1), GFP_KERNEL_ACCOUNT);
> > +     if (!new)
> > +             return -ENOMEM;
> > +
> > +     new->nr_rt_entries = 1;
> > +     for (i = 0; i < KVM_NR_IRQCHIPS; i++)
> > +             for (j = 0; j < KVM_IRQCHIP_NUM_PINS; j++)
> > +                     new->chip[i][j] = -1;
>
> Maybe it looks nicer by:
> size = sizeof(int) * KVM_NR_IRQCHIPS *KVM_IRQCHIP_NUM_PINS;
> memset(new->chip, -1, size);
>

It seems better, I'll update this patch. Thx a lot!

> > +
> > +     RCU_INIT_POINTER(kvm->irq_routing, new);
> > +
> > +     return 0;

>


---
Best wishes
Yi Wang





[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux