[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5df825a2-b794-9374-4ebf-83c5cc14584a@redhat.com>
Date: Wed, 30 Dec 2020 14:34:59 +0800
From: Jason Wang <jasowang@...hat.com>
To: Eli Cohen <elic@...dia.com>
Cc: mst@...hat.com, eperezma@...hat.com, kvm@...r.kernel.org,
virtualization@...ts.linux-foundation.org, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, lulu@...hat.com, eli@...lanox.com,
lingshan.zhu@...el.com, rob.miller@...adcom.com,
stefanha@...hat.com, sgarzare@...hat.com
Subject: Re: [PATCH 11/21] vhost-vdpa: introduce asid based IOTLB
On 2020/12/29 下午7:53, Eli Cohen wrote:
>> +
>> +static struct vhost_vdpa_as *vhost_vdpa_alloc_as(struct vhost_vdpa *v, u32 asid)
>> +{
>> + struct hlist_head *head = &v->as[asid % VHOST_VDPA_IOTLB_BUCKETS];
>> + struct vhost_vdpa_as *as;
>> +
>> + if (asid_to_as(v, asid))
>> + return NULL;
>> +
>> + as = kmalloc(sizeof(*as), GFP_KERNEL);
> kzalloc()? See comment below.
>
>> + if (!as)
>> + return NULL;
>> +
>> + vhost_iotlb_init(&as->iotlb, 0, 0);
>> + as->id = asid;
>> + hlist_add_head(&as->hash_link, head);
>> + ++v->used_as;
> Although you eventually ended up removing used_as, this is a bug since
> you're incrementing a random value. Maybe it's better to be on the safe
> side and use kzalloc() for as above.
Yes and used_as needs to be removed.
Thanks
>
Powered by blists - more mailing lists