[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAN35MuR+E4-2xKkVjffqEjdZ1NOMnrdpmck+LT6_i2EjCzO_rg@mail.gmail.com>
Date: Mon, 11 Mar 2024 17:44:55 +0800
From: Yi Wang <up2wing@...il.com>
To: "Yang, Weijiang" <weijiang.yang@...el.com>
Cc: "seanjc@...gle.com" <seanjc@...gle.com>, "atishp@...shpatra.org" <atishp@...shpatra.org>,
"dave.hansen@...ux.intel.com" <dave.hansen@...ux.intel.com>, "x86@...nel.org" <x86@...nel.org>,
"tglx@...utronix.de" <tglx@...utronix.de>, "mingo@...hat.com" <mingo@...hat.com>,
"foxywang@...cent.com" <foxywang@...cent.com>, "bp@...en8.de" <bp@...en8.de>,
"pbonzini@...hat.com" <pbonzini@...hat.com>, "hpa@...or.com" <hpa@...or.com>,
"imbrenda@...ux.ibm.com" <imbrenda@...ux.ibm.com>, "kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"oliver.upton@...ux.dev" <oliver.upton@...ux.dev>,
"borntraeger@...ux.ibm.com" <borntraeger@...ux.ibm.com>, "maz@...nel.org" <maz@...nel.org>,
"anup@...infault.org" <anup@...infault.org>, "frankja@...ux.ibm.com" <frankja@...ux.ibm.com>,
"wanpengli@...cent.com" <wanpengli@...cent.com>
Subject: Re: [RESEND v3 1/3] KVM: setup empty irq routing when create vm
On Fri, Mar 8, 2024 at 12:06 PM Yang, Weijiang <weijiang.yang@...elcom> wrote:
>
> On 2/29/2024 2:53 PM, Yi Wang wrote:
> > From: Yi Wang <foxywang@...cent.com>
> > +
> > +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
Powered by blists - more mailing lists