On 19/02/18 12:23, Tomasz Nowicki wrote:
[...]
>> +static int viommu_receive_resp(struct viommu_dev *viommu, int nr_sent,
>> +                           struct list_head *sent)
>> +{
>> +
>> +    unsigned int len;
>> +    int nr_received = 0;
>> +    struct viommu_request *req, *pending;
>> +
>> +    pending = list_first_entry_or_null(sent, struct viommu_request, list);
>> +    if (WARN_ON(!pending))
>> +            return 0;
>> +
>> +    while ((req = virtqueue_get_buf(viommu->vq, &len)) != NULL) {
>> +            if (req != pending) {
>> +                    dev_warn(viommu->dev, "discarding stale request\n");
>> +                    continue;
>> +            }
>> +
>> +            pending->written = len;
>> +
>> +            if (++nr_received == nr_sent) {
>> +                    WARN_ON(!list_is_last(&pending->list, sent));
>> +                    break;
>> +            } else if (WARN_ON(list_is_last(&pending->list, sent))) {
>> +                    break;
>> +            }
>> +
>> +            pending = list_next_entry(pending, list);
> 
> We should remove current element from the pending list. There is no 
> guarantee we get response for each while loop so when we get back for 
> more the _viommu_send_reqs_sync() caller will pass pointer to the out of 
> date head next time.

Right, I'll fix this

Thanks,
Jean
_______________________________________________
kvmarm mailing list
[email protected]
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

Reply via email to