[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] memory: do not do out of bound notification
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH] memory: do not do out of bound notification |
Date: |
Thu, 20 Jun 2019 15:14:04 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 |
On 20/06/19 14:59, Peter Xu wrote:
> I feel like this can be problematic. I'm imaging:
>
> start=0x1000_0000, size=0x1000_1000
>
> This will get size=0x1000 but actually we can do size=0x1000_0000 as
> the first.
Right, we can do:
/*
* If a naturally aligned region starting at "start" ends before "end",
* use it. Otherwise, keep the lowest bit of size.
*/
if (size > (start & -start))
size = start & -start;
else
size = size & -size;
>>
>> + trace_vtd_as_unmap_whole(pci_bus_num(as->bus),
>> + VTD_PCI_SLOT(as->devfn),
>> + VTD_PCI_FUNC(as->devfn),
>> + entry.iova, size);
>
> Can move this out because this is a trace only so we don't have
> restriction on mask?
>
>>
>> - map.iova = entry.iova;
>> - map.size = entry.addr_mask;
>> - iova_tree_remove(as->iova_tree, &map);
>> + map.iova = entry.iova;
>> + map.size = entry.addr_mask;
>> + iova_tree_remove(as->iova_tree, &map);
>
> Same here?
>
Yes, I would move these and the iova_tree_remove outside the loop, while
keeping entry's initialization inside looks cleaner.
Paolo
- Re: [Qemu-devel] [PATCH] memory: do not do out of bound notification, (continued)
- Re: [Qemu-devel] [PATCH] memory: do not do out of bound notification, Peter Xu, 2019/06/20
- Re: [Qemu-devel] [PATCH] memory: do not do out of bound notification,
Paolo Bonzini <=
- Re: [Qemu-devel] [PATCH] memory: do not do out of bound notification, Peter Xu, 2019/06/20
- Re: [Qemu-devel] [PATCH] memory: do not do out of bound notification, Peter Xu, 2019/06/20
- Re: [Qemu-devel] [PATCH] memory: do not do out of bound notification, Yan Zhao, 2019/06/24
- Re: [Qemu-devel] [PATCH] memory: do not do out of bound notification, Peter Xu, 2019/06/24
- Re: [Qemu-devel] [PATCH] memory: do not do out of bound notification, Yan Zhao, 2019/06/21