new memory api: offsets?
Hi Avi,
while debugging, i noticed, that mr->offset is never set, expect in the initializer. (The subregion collision warning is printed although the regions are not overlapping.) Is this intended?
btw. you may include the memory region name in the warning.
Signature · 1 line
Michael
Quoted 5 lines · Michael Walle
Hi Avi,
while debugging, i noticed, that
mr->offsetis never set, expect in the initializer. (The subregion collision warning is printed although the regions are not overlapping.) Is this intended?
Did you miss memory_region_set_offset()?
The subregion collision warning is unrelated?
Quoted 2 lines
btw. you may include the memory region name in the warning.
sure, patches welcome.
Signature · 2 lines
I have a truly marvellous patch that fixes the bug which this signature is too narrow to contain.
Am Donnerstag 01 September 2011, 07:54:28 schrieb Avi Kivity:
Quoted 8 lines · Michael Walle
Quoted 5 lines
Hi Avi,
while debugging, i noticed, that
mr->offsetis never set, expect in the initializer. (The subregion collision warning is printed although the regions are not overlapping.) Is this intended?Did you miss
memory_region_set_offset()?
I saw that function but it's never called. Now i noticed that this is a deprecated public function.
Quoted 1 line
The subregion collision warning is unrelated?
you are walking along the subregions and use that offset property to detect collisions. Shouldn't you use the addr property instead?
@@ -1190,16 +1190,18 @@ static void memory_region_add_subregion_common(MemoryRegion *mr,
if (subregion->may_overlap || other->may_overlap) {
continue;
}
- if (offset >= other->offset + other->size
- || offset + subregion->size <= other->offset) {
+ if (offset >= other->addr + other->size
+ || offset + subregion->size <= other->addr) {
continue;
}Quoted 3 lines
Quoted 1 line
btw. you may include the memory region name in the warning.
sure, patches welcome.
- printf("warning: subregion collision %llx/%llx vs %llx/%llx\n",
+ printf("warning: subregion collision %llx/%llx (%s) "
+ "vs %llx/%llx (%s)\n",
(unsigned long long)offset, (unsigned long long)subregion->size,
- (unsigned long long)other->offset, - (unsigned long long)other->size); + subregion->name, + (unsigned long long)other->addr, + (unsigned long long)other->size, + other->name);
let me know if i should post a git patch instead :)
Signature · 1 line
Michael
Quoted 8 lines · Michael Walle
Am Donnerstag 01 September 2011, 07:54:28 schrieb Avi Kivity:
Quoted 7 lines · Michael Walle
Quoted 5 lines
Hi Avi,
while debugging, i noticed, that
mr->offsetis never set, expect in the initializer. (The subregion collision warning is printed although the regions are not overlapping.) Is this intended?
Quoted 7 lines
Quoted 1 line
Did you miss
memory_region_set_offset()?I saw that function but it's never called. Now i noticed that this is a deprecated public function.
Quoted 1 line
The subregion collision warning is unrelated?
you are walking along the subregions and use that offset property to detect collisions. Shouldn't you use the addr property instead?
Ah, of course.
Review static void · line 1197
Quoted 12 lines
(quoted diff) +2
-2@@ -1190,16 +1190,18 @@ static void memory_region_add_subregion_common(MemoryRegion *mr, if (subregion->may_overlap || other->may_overlap) { continue; } - if (offset>= other->offset + other->size - || offset + subregion->size<= other->offset) { + if (offset>= other->addr + other->size + || offset + subregion->size<= other->addr) { continue; }
Right. Please post with a changelog and signoff.
Quoted 17 lines
Quoted 4 lines
Quoted 2 lines
btw. you may include the memory region name in the warning.
sure, patches welcome.
(quoted diff) +6
-3- printf("warning: subregion collision %llx/%llx vs %llx/%llx\n", + printf("warning: subregion collision %llx/%llx (%s) " + "vs %llx/%llx (%s)\n", (unsigned long long)offset, (unsigned long long)subregion->size, - (unsigned long long)other->offset, - (unsigned long long)other->size); + subregion->name, + (unsigned long long)other->addr, + (unsigned long long)other->size, + other->name);
Quoted 2 lines
let me know if i should post a git patch instead :)
Yes, with a signoff.
Signature · 1 line
error compiling committee.c: too many arguments to function
PATCH 1/1 memory: fix subregion collision warning
Instead of the offset property use the proper addr property to calculate the offsets.
Additionally, be a little more verbose on the warning and print the subregion name.
--- memory.c | 13 ++++++++----- 1 files changed, 8 insertions(+), 5 deletions(-)
memory.c +8 -5
@@ -1190,16 +1190,19 @@ static void memory_region_add_subregion_common(MemoryRegion *mr,if (subregion->may_overlap || other->may_overlap) {continue ; } -if (offset >= other->offset + other->size - || offset + subregion->size <= other->offset) { +if (offset >= other->addr + other->size + || offset + subregion->size <= other->addr) {continue ; }#if 0 -printf ("warning: subregion collision %llx/%llx vs %llx/%llx\n" , +printf ("warning: subregion collision %llx/%llx (%s) " +"vs %llx/%llx (%s)\n" , (unsigned long long )offset, (unsigned long long )subregion->size, - (unsigned long long )other->offset, - (unsigned long long )other->size); + subregion->name, + (unsigned long long )other->addr, + (unsigned long long )other->size, + other->name);#endif } QTAILQ_FOREACH(other, &mr->subregions, subregions_link) {
Signature · 1 line
1.7.2.5
Avi Kivity
AppliedRe: [Qemu-devel] [PATCH] memory: fix subregion collision warning
Quoted 7 lines · Michael Walle
Instead of the offset property use the proper addr property to calculate the offsets.
Additionally, be a little more verbose on the warning and print the subregion name.
Thanks, applied to memory/core.
Signature · 1 line
error compiling committee.c: too many arguments to function