qemu-trivial.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-trivial] [PATCH] memory: fix a bug of detection of memory region collision
@ 2013-03-15  6:32 Hu Tao
  2013-03-22 12:22 ` Stefan Hajnoczi
  0 siblings, 1 reply; 3+ messages in thread
From: Hu Tao @ 2013-03-15  6:32 UTC (permalink / raw)
  To: qemu-devel, qemu-trivial

The collision reports before and after this patch are:

before:

warning: subregion collision cfc/4 (pci-conf-data) vs cf8/4 (pci-conf-idx)
warning: subregion collision 8000000/f8000000 (pci-hole) vs 0/8000000 (ram-below-4g)
warning: subregion collision 100000000/4000000000000000 (pci-hole64) vs 8000000/f8000000 (pci-hole)
warning: subregion collision 4d1/1 (kvm-elcr) vs 4d0/1 (kvm-elcr)
warning: subregion collision fec00000/1000 (kvm-ioapic) vs 8000000/f8000000 (pci-hole)
warning: subregion collision 80/1 (ioport80) vs 7e/2 (kvmvapic)
warning: subregion collision fed00000/400 (hpet) vs 8000000/f8000000 (pci-hole)
warning: subregion collision 81/3 (dma-page) vs 80/1 (ioport80)
warning: subregion collision 8/8 (dma-cont) vs 0/8 (dma-chan)
warning: subregion collision d0/10 (dma-cont) vs c0/10 (dma-chan)
warning: subregion collision 0/80 (ich9-pm) vs 8/8 (dma-cont)
warning: subregion collision 0/80 (ich9-pm) vs 0/8 (dma-chan)
warning: subregion collision 0/80 (ich9-pm) vs 64/1 (i8042-cmd)
warning: subregion collision 0/80 (ich9-pm) vs 60/1 (i8042-data)
warning: subregion collision 0/80 (ich9-pm) vs 61/1 (elcr)
warning: subregion collision 0/80 (ich9-pm) vs 40/4 (kvm-pit)
warning: subregion collision 0/80 (ich9-pm) vs 70/2 (rtc)
warning: subregion collision 0/80 (ich9-pm) vs 20/2 (kvm-pic)
warning: subregion collision 0/80 (ich9-pm) vs 7e/2 (kvmvapic)
warning: subregion collision 4/2 (acpi-cnt) vs 0/4 (acpi-evt)
warning: subregion collision 30/8 (apci-smi) vs 20/10 (apci-gpe0)
warning: subregion collision b0000000/10000000 (pcie-mmcfg) vs 8000000/f8000000 (pci-hole)

after:

warning: subregion collision fec00000/1000 (kvm-ioapic) vs 8000000/f8000000 (pci-hole)
warning: subregion collision fed00000/400 (hpet) vs 8000000/f8000000 (pci-hole)
warning: subregion collision 0/80 (ich9-pm) vs 8/8 (dma-cont)
warning: subregion collision 0/80 (ich9-pm) vs 0/8 (dma-chan)
warning: subregion collision 0/80 (ich9-pm) vs 64/1 (i8042-cmd)
warning: subregion collision 0/80 (ich9-pm) vs 60/1 (i8042-data)
warning: subregion collision 0/80 (ich9-pm) vs 61/1 (elcr)
warning: subregion collision 0/80 (ich9-pm) vs 40/4 (kvm-pit)
warning: subregion collision 0/80 (ich9-pm) vs 70/2 (rtc)
warning: subregion collision 0/80 (ich9-pm) vs 20/2 (kvm-pic)
warning: subregion collision 0/80 (ich9-pm) vs 7e/2 (kvmvapic)
warning: subregion collision b0000000/10000000 (pcie-mmcfg) vs 8000000/f8000000 (pci-hole)

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
---
 memory.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/memory.c b/memory.c
index 92a2196..75ca281 100644
--- a/memory.c
+++ b/memory.c
@@ -1321,7 +1321,7 @@ static void memory_region_add_subregion_common(MemoryRegion *mr,
         if (subregion->may_overlap || other->may_overlap) {
             continue;
         }
-        if (int128_gt(int128_make64(offset),
+        if (int128_ge(int128_make64(offset),
                       int128_add(int128_make64(other->addr), other->size))
             || int128_le(int128_add(int128_make64(offset), subregion->size),
                          int128_make64(other->addr))) {
-- 
1.8.1.4



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-trivial] [PATCH] memory: fix a bug of detection of memory region collision
  2013-03-15  6:32 [Qemu-trivial] [PATCH] memory: fix a bug of detection of memory region collision Hu Tao
@ 2013-03-22 12:22 ` Stefan Hajnoczi
  2013-03-22 12:50   ` [Qemu-trivial] [Qemu-devel] " Peter Maydell
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Hajnoczi @ 2013-03-22 12:22 UTC (permalink / raw)
  To: Hu Tao; +Cc: qemu-trivial, qemu-devel

On Fri, Mar 15, 2013 at 02:32:01PM +0800, Hu Tao wrote:
> The collision reports before and after this patch are:
> 
> before:
> 
> warning: subregion collision cfc/4 (pci-conf-data) vs cf8/4 (pci-conf-idx)
> warning: subregion collision 8000000/f8000000 (pci-hole) vs 0/8000000 (ram-below-4g)
> warning: subregion collision 100000000/4000000000000000 (pci-hole64) vs 8000000/f8000000 (pci-hole)
> warning: subregion collision 4d1/1 (kvm-elcr) vs 4d0/1 (kvm-elcr)
> warning: subregion collision fec00000/1000 (kvm-ioapic) vs 8000000/f8000000 (pci-hole)
> warning: subregion collision 80/1 (ioport80) vs 7e/2 (kvmvapic)
> warning: subregion collision fed00000/400 (hpet) vs 8000000/f8000000 (pci-hole)
> warning: subregion collision 81/3 (dma-page) vs 80/1 (ioport80)
> warning: subregion collision 8/8 (dma-cont) vs 0/8 (dma-chan)
> warning: subregion collision d0/10 (dma-cont) vs c0/10 (dma-chan)
> warning: subregion collision 0/80 (ich9-pm) vs 8/8 (dma-cont)
> warning: subregion collision 0/80 (ich9-pm) vs 0/8 (dma-chan)
> warning: subregion collision 0/80 (ich9-pm) vs 64/1 (i8042-cmd)
> warning: subregion collision 0/80 (ich9-pm) vs 60/1 (i8042-data)
> warning: subregion collision 0/80 (ich9-pm) vs 61/1 (elcr)
> warning: subregion collision 0/80 (ich9-pm) vs 40/4 (kvm-pit)
> warning: subregion collision 0/80 (ich9-pm) vs 70/2 (rtc)
> warning: subregion collision 0/80 (ich9-pm) vs 20/2 (kvm-pic)
> warning: subregion collision 0/80 (ich9-pm) vs 7e/2 (kvmvapic)
> warning: subregion collision 4/2 (acpi-cnt) vs 0/4 (acpi-evt)
> warning: subregion collision 30/8 (apci-smi) vs 20/10 (apci-gpe0)
> warning: subregion collision b0000000/10000000 (pcie-mmcfg) vs 8000000/f8000000 (pci-hole)
> 
> after:
> 
> warning: subregion collision fec00000/1000 (kvm-ioapic) vs 8000000/f8000000 (pci-hole)
> warning: subregion collision fed00000/400 (hpet) vs 8000000/f8000000 (pci-hole)
> warning: subregion collision 0/80 (ich9-pm) vs 8/8 (dma-cont)
> warning: subregion collision 0/80 (ich9-pm) vs 0/8 (dma-chan)
> warning: subregion collision 0/80 (ich9-pm) vs 64/1 (i8042-cmd)
> warning: subregion collision 0/80 (ich9-pm) vs 60/1 (i8042-data)
> warning: subregion collision 0/80 (ich9-pm) vs 61/1 (elcr)
> warning: subregion collision 0/80 (ich9-pm) vs 40/4 (kvm-pit)
> warning: subregion collision 0/80 (ich9-pm) vs 70/2 (rtc)
> warning: subregion collision 0/80 (ich9-pm) vs 20/2 (kvm-pic)
> warning: subregion collision 0/80 (ich9-pm) vs 7e/2 (kvmvapic)
> warning: subregion collision b0000000/10000000 (pcie-mmcfg) vs 8000000/f8000000 (pci-hole)
> 
> Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
> ---
>  memory.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

The int128_le() comparison below suggests that int128_gt() really should
be int128_ge().

Thanks, applied to the trivial patches tree:
https://github.com/stefanha/qemu/commits/trivial-patches

Stefan


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-trivial] [Qemu-devel] [PATCH] memory: fix a bug of detection of memory region collision
  2013-03-22 12:22 ` Stefan Hajnoczi
@ 2013-03-22 12:50   ` Peter Maydell
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Maydell @ 2013-03-22 12:50 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: qemu-trivial, Hu Tao, qemu-devel

On 22 March 2013 12:22, Stefan Hajnoczi <stefanha@gmail.com> wrote:
> The int128_le() comparison below suggests that int128_gt() really should
> be int128_ge().

Agreed. It might be clearer to rephrase as:

 AddrRange thisrange = addrrange_make(int128_make64(offset),
                                      int128_make64(subregion->size));

 QTAILQ_FOREACH(....) {
     [...]
     AddrRange otherrange = addrrange_make(int128_make64(other->addr),
                                           int128_make64(other->size));
     if (!addrrange_intersects(thisrange, otherrange)) {
         continue;
     }
     [...]
 }

(maybe with a new utility addrrange_make_64() that takes uint64_ts;
there are a few other places in memory.c that could use it.)

-- PMM


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-03-22 12:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-15  6:32 [Qemu-trivial] [PATCH] memory: fix a bug of detection of memory region collision Hu Tao
2013-03-22 12:22 ` Stefan Hajnoczi
2013-03-22 12:50   ` [Qemu-trivial] [Qemu-devel] " Peter Maydell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).