On Mon, Jul 29, 2019 at 10:30:56AM +0200, Igor Mammedov wrote: >On Mon, 29 Jul 2019 09:49:37 +0200 >David Hildenbrand <da...@redhat.com> wrote: > >> On 28.07.19 15:13, Wei Yang wrote: >> > The memory-device list built by memory_device_build_list is ordered by >> > its address, this means if the tmp range exceed the hinted range, all >> > the following range will not overlap with it. >> > >> > Signed-off-by: Wei Yang <richardw.y...@linux.intel.com> >> > --- >> > hw/mem/memory-device.c | 2 +- >> > 1 file changed, 1 insertion(+), 1 deletion(-) >> > >> > diff --git a/hw/mem/memory-device.c b/hw/mem/memory-device.c >> > index 413b514586..aea47ab3e8 100644 >> > --- a/hw/mem/memory-device.c >> > +++ b/hw/mem/memory-device.c >> > @@ -180,7 +180,7 @@ static uint64_t >> > memory_device_get_free_addr(MachineState *ms, >> > range_make_empty(&new); >> > break; >> > } >> > - } else if (!hint) { >> > + } else if (!hint || range_lob(&tmp) > range_upb(&new)) { >> > break; >> > } >> > } >> > >> >> Lower bound is inclusive, upper bound is exclusive. Shouldn't this be >> >> range_lob(&tmp) >= range_upb(&new) >> >> Also, I wonder if patch #2 is now really needed? >Indeed, it looks like 3/3 will break early in both hinted and >non-hinted cases so 2/3 looks not necessary (in case 2/3 is dropped >this commit message needs to be amended). >
ok, let me drop #2 -- Wei Yang Help you, Help me